clipsruby 0.0.33 → 0.0.35
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 +103 -0
- data/ext/clipsruby/clipsruby.c +635 -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: f9bdca59f142899fe858cb253d57ce0d1b2d3eae763a57cb91d7278196e77f88
|
4
|
+
data.tar.gz: 5c958baae6e99acde4729fb3755bbfa9d8ec613e1dfd53b18b970c3824767872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c57ac8a0cbc763881cfa3275d6f2e3550222e8d575865ce79c9aa0cfebf9eb5d6b66ccc5cae98555d6ba16fe6dca92de1560540cd6252bf5c42353ebdcaf774
|
7
|
+
data.tar.gz: 7c8914796e684ce973ba1058122ed1b4390d1b6043b3086abf70160b5aca79a1ce4e83286daed19a84ea77ff9a7b095f5bd707773763b33bc12e4c205d16635e
|
data/README.md
CHANGED
@@ -494,6 +494,20 @@ CLIPS::Environment::Defclass.defmodule_name(defclass)
|
|
494
494
|
defclass.defmodule_name
|
495
495
|
```
|
496
496
|
|
497
|
+
### `CLIPS::Environment::Defclass.get_instance_list`
|
498
|
+
### `CLIPS::Environment::Defclass#get_instance_list`
|
499
|
+
|
500
|
+
Return an array of Instances of the Defclass.
|
501
|
+
Pass `true` as and argument to include instances of subclasses
|
502
|
+
of this Defclass.
|
503
|
+
|
504
|
+
```ruby
|
505
|
+
CLIPS::Environment::Defclass.get_instance_list(defclass)
|
506
|
+
CLIPS::Environment::Defclass.get_instance_list(defclass, true)
|
507
|
+
defclass.get_instance_list
|
508
|
+
defclass.get_instance_list(true)
|
509
|
+
```
|
510
|
+
|
497
511
|
### `CLIPS::Environment.find_defrule`
|
498
512
|
### `CLIPS::Environment#find_defrule`
|
499
513
|
|
@@ -504,6 +518,24 @@ CLIPS::Environment.find_defrule(:a)
|
|
504
518
|
env.find_defrule("foo")
|
505
519
|
```
|
506
520
|
|
521
|
+
### `CLIPS::Environment.find_instance`
|
522
|
+
### `CLIPS::Environment#find_instance`
|
523
|
+
|
524
|
+
Finds an instance by name and returns a CLIPS::Environment::Instance object.
|
525
|
+
Can take an optional second and third argument for Defmodule or Demodule name
|
526
|
+
and a boolean that represents whether or not the instance should be searched for
|
527
|
+
in imported modules.
|
528
|
+
If the second argument is `nil`, `find_instance` will search the current module only.
|
529
|
+
|
530
|
+
```ruby
|
531
|
+
CLIPS::Environment.find_definstance(:a)
|
532
|
+
env.find_definstance("foo")
|
533
|
+
CLIPS::Environment.find_definstance(:a, :my_module)
|
534
|
+
env.find_definstance("foo", "my_module")
|
535
|
+
CLIPS::Environment.find_definstance(:a, :my_module, true)
|
536
|
+
env.find_definstance("foo", nil, true)
|
537
|
+
```
|
538
|
+
|
507
539
|
### `CLIPS::Environment::Defrule.name`
|
508
540
|
### `CLIPS::Environment::Defrule#name`
|
509
541
|
|
@@ -634,6 +666,57 @@ CLIPS::Environment::Defmodule.get_fact_list(defmodule)
|
|
634
666
|
defmodule.get_fact_list
|
635
667
|
```
|
636
668
|
|
669
|
+
### `CLIPS::Environment::Defmodule.find_instance`
|
670
|
+
### `CLIPS::Environment::Defmodule#find_instance`
|
671
|
+
|
672
|
+
Finds an instance by name and returns a CLIPS::Environment::Instance object.
|
673
|
+
Can take an optional second argument
|
674
|
+
of a boolean that represents whether or not the instance should be searched for
|
675
|
+
in imported modules.
|
676
|
+
|
677
|
+
```ruby
|
678
|
+
CLIPS::Environment::Defmodule.find_instance(:a)
|
679
|
+
defmodule.find_instance("foo")
|
680
|
+
CLIPS::Environment::Defmodule.find_instance(:a, true)
|
681
|
+
defmodule.find_instance("foo", true)
|
682
|
+
```
|
683
|
+
|
684
|
+
### `CLIPS::Environment.get_defclass_list`
|
685
|
+
### `CLIPS::Environment#get_defclass_list`
|
686
|
+
|
687
|
+
Return an array of Defclass names as symbols in the environment. Pass an argument of a
|
688
|
+
symbol, string, or Defmodule object in order to only get Defclasss
|
689
|
+
in that Defmodule. If you do not, it will return all Defclass names in all modules.
|
690
|
+
|
691
|
+
```ruby
|
692
|
+
CLIPS::Environment.get_defclass_list(env)
|
693
|
+
env.get_defclass_list
|
694
|
+
CLIPS::Environment.get_defclass_list(env, :MAIN)
|
695
|
+
env.get_defclass_list(:MAIN)
|
696
|
+
CLIPS::Environment.get_defclass_list(env, defmodule)
|
697
|
+
env.get_defclass_list(defmodule)
|
698
|
+
```
|
699
|
+
|
700
|
+
### `CLIPS::Environment.get_instance_list`
|
701
|
+
### `CLIPS::Environment#get_instance_list`
|
702
|
+
|
703
|
+
Return an array of Instances in the environment. Pass an argument of a
|
704
|
+
symbol, string, or Defclass object in order to only get Instances
|
705
|
+
in that Defclass. If you do not, it will return all Instances of all Defclasses.
|
706
|
+
If you do, you may also pass `true` as the second argument
|
707
|
+
to include instances of subclasses of this Defclass.
|
708
|
+
|
709
|
+
```ruby
|
710
|
+
CLIPS::Environment.get_instance_list(env)
|
711
|
+
env.get_instance_list
|
712
|
+
CLIPS::Environment.get_instance_list(env, :foo_class)
|
713
|
+
env.get_instance_list(:"my-class")
|
714
|
+
CLIPS::Environment.get_instance_list(env, defclass)
|
715
|
+
env.get_instance_list(defclass)
|
716
|
+
CLIPS::Environment.get_instance_list(env, defclass, true)
|
717
|
+
env.get_instance_list(defclass, true)
|
718
|
+
```
|
719
|
+
|
637
720
|
### `CLIPS::Environment.get_deftemplate_list`
|
638
721
|
### `CLIPS::Environment#get_deftemplate_list`
|
639
722
|
|
@@ -686,6 +769,16 @@ CLIPS::Environment.find_deftemplate(:a)
|
|
686
769
|
env.find_deftemplate("foo")
|
687
770
|
```
|
688
771
|
|
772
|
+
### `CLIPS::Environment.find_defclass`
|
773
|
+
### `CLIPS::Environment#find_defclass`
|
774
|
+
|
775
|
+
Finds a defclass by name and returns a CLIPS::Environment::Defclass object
|
776
|
+
|
777
|
+
```ruby
|
778
|
+
CLIPS::Environment.find_defclass(:a)
|
779
|
+
env.find_defclass("foo")
|
780
|
+
```
|
781
|
+
|
689
782
|
### `CLIPS::Environment::Deftemplate.name`
|
690
783
|
### `CLIPS::Environment::Deftemplate#name`
|
691
784
|
|
@@ -874,6 +967,16 @@ CLIPS::Environment::Deftemplate.slot_defaultp(deftemplate, :foo)
|
|
874
967
|
deftemplate.slot_defaultp('bar')
|
875
968
|
```
|
876
969
|
|
970
|
+
### `CLIPS::Environment::Defmodule.get_defclass_list`
|
971
|
+
### `CLIPS::Environment::Defmodule#get_defclass_list`
|
972
|
+
|
973
|
+
Return an array of Defclass names as symbols in the Defmodule
|
974
|
+
|
975
|
+
```ruby
|
976
|
+
CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
|
977
|
+
defmodule.get_defclass_list
|
978
|
+
```
|
979
|
+
|
877
980
|
### `CLIPS::Environment::Defmodule.get_deftemplate_list`
|
878
981
|
### `CLIPS::Environment::Defmodule#get_deftemplate_list`
|
879
982
|
|
data/ext/clipsruby/clipsruby.c
CHANGED
@@ -293,6 +293,92 @@ static VALUE clips_environment_defclass_static_pp_form(VALUE self, VALUE rbDefcl
|
|
293
293
|
return clips_environment_defclass_pp_form(rbDefclass);
|
294
294
|
}
|
295
295
|
|
296
|
+
static VALUE clips_environment_defclass_get_instance_list(int argc, VALUE *argv, VALUE rbDefclass)
|
297
|
+
{
|
298
|
+
VALUE rbEnvironment, rbInstance, include_subclasses, returnArray;
|
299
|
+
Defclass *defclass;
|
300
|
+
Instance *theInstance;
|
301
|
+
UDFValue iterator;
|
302
|
+
|
303
|
+
rbEnvironment = rb_iv_get(rbDefclass, "@environment");
|
304
|
+
|
305
|
+
returnArray = rb_ary_new2(0);
|
306
|
+
|
307
|
+
rb_scan_args(argc, argv, "01", &include_subclasses);
|
308
|
+
|
309
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
310
|
+
|
311
|
+
if (include_subclasses != Qtrue) {
|
312
|
+
for (
|
313
|
+
theInstance = GetNextInstanceInClass(defclass,NULL);
|
314
|
+
theInstance != NULL;
|
315
|
+
theInstance = GetNextInstanceInClass(defclass,theInstance)
|
316
|
+
) {
|
317
|
+
rbInstance =
|
318
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
319
|
+
|
320
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
321
|
+
rb_ary_push(returnArray, rbInstance);
|
322
|
+
}
|
323
|
+
} else {
|
324
|
+
for (
|
325
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,NULL,&iterator);
|
326
|
+
theInstance != NULL;
|
327
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,theInstance,&iterator)
|
328
|
+
) {
|
329
|
+
rbInstance =
|
330
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
331
|
+
|
332
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
333
|
+
rb_ary_push(returnArray, rbInstance);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
return returnArray;
|
337
|
+
}
|
338
|
+
|
339
|
+
static VALUE clips_environment_defclass_static_get_instance_list(int argc, VALUE *argv, VALUE rbDefclass)
|
340
|
+
{
|
341
|
+
VALUE rbEnvironment, rbInstance, include_subclasses, returnArray;
|
342
|
+
Defclass *defclass;
|
343
|
+
Instance *theInstance;
|
344
|
+
UDFValue iterator;
|
345
|
+
|
346
|
+
returnArray = rb_ary_new2(0);
|
347
|
+
|
348
|
+
rb_scan_args(argc, argv, "11", &rbDefclass, &include_subclasses);
|
349
|
+
|
350
|
+
rbEnvironment = rb_iv_get(rbDefclass, "@environment");
|
351
|
+
|
352
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
353
|
+
|
354
|
+
if (include_subclasses != Qtrue) {
|
355
|
+
for (
|
356
|
+
theInstance = GetNextInstanceInClass(defclass,NULL);
|
357
|
+
theInstance != NULL;
|
358
|
+
theInstance = GetNextInstanceInClass(defclass,theInstance)
|
359
|
+
) {
|
360
|
+
rbInstance =
|
361
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
362
|
+
|
363
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
364
|
+
rb_ary_push(returnArray, rbInstance);
|
365
|
+
}
|
366
|
+
} else {
|
367
|
+
for (
|
368
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,NULL,&iterator);
|
369
|
+
theInstance != NULL;
|
370
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,theInstance,&iterator)
|
371
|
+
) {
|
372
|
+
rbInstance =
|
373
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
374
|
+
|
375
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
376
|
+
rb_ary_push(returnArray, rbInstance);
|
377
|
+
}
|
378
|
+
}
|
379
|
+
return returnArray;
|
380
|
+
}
|
381
|
+
|
296
382
|
static VALUE clips_environment_make_instance(VALUE self, VALUE string)
|
297
383
|
{
|
298
384
|
Environment *env;
|
@@ -787,8 +873,13 @@ static void CLIPSValue_to_VALUE(CLIPSValue *from, VALUE *value, VALUE *rbEnviron
|
|
787
873
|
|
788
874
|
rb_iv_set(*value, "@environment", *rbEnvironment);
|
789
875
|
break;
|
790
|
-
case EXTERNAL_ADDRESS_TYPE:
|
791
876
|
case INSTANCE_ADDRESS_TYPE:
|
877
|
+
*value =
|
878
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(*rbEnvironment), rb_intern("Instance")), &Instance_type, from->instanceValue);
|
879
|
+
|
880
|
+
rb_iv_set(*value, "@environment", *rbEnvironment);
|
881
|
+
break;
|
882
|
+
case EXTERNAL_ADDRESS_TYPE:
|
792
883
|
default:
|
793
884
|
WriteString(env,STDERR,"Unsupported data type returned from function\n");
|
794
885
|
*value = Qnil;
|
@@ -839,8 +930,13 @@ static void UDFValue_to_VALUE(UDFValue *from, VALUE *value, VALUE *rbEnvironment
|
|
839
930
|
|
840
931
|
rb_iv_set(*value, "@environment", *rbEnvironment);
|
841
932
|
break;
|
842
|
-
case EXTERNAL_ADDRESS_TYPE:
|
843
933
|
case INSTANCE_ADDRESS_TYPE:
|
934
|
+
*value =
|
935
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(*rbEnvironment), rb_intern("Instance")), &Instance_type, from->instanceValue);
|
936
|
+
|
937
|
+
rb_iv_set(*value, "@environment", *rbEnvironment);
|
938
|
+
break;
|
939
|
+
case EXTERNAL_ADDRESS_TYPE:
|
844
940
|
default:
|
845
941
|
WriteString(env,STDERR,"Unsupported data type returned from function\n");
|
846
942
|
*value = Qnil;
|
@@ -1925,6 +2021,223 @@ static VALUE clips_environment_static_find_defmodule(VALUE self, VALUE rbEnviron
|
|
1925
2021
|
return clips_environment_find_defmodule(rbEnvironment, defmodule_name);
|
1926
2022
|
}
|
1927
2023
|
|
2024
|
+
static VALUE clips_environment_find_instance(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2025
|
+
VALUE instanceName, search_imports, rbInstance, rbDefmodule;
|
2026
|
+
Defmodule *defmodule;
|
2027
|
+
Environment *env;
|
2028
|
+
Instance *instance;
|
2029
|
+
|
2030
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2031
|
+
|
2032
|
+
rb_scan_args(argc, argv, "12", &instanceName, &rbDefmodule, &search_imports);
|
2033
|
+
|
2034
|
+
const char *cinstanceName;
|
2035
|
+
switch(TYPE(instanceName))
|
2036
|
+
{
|
2037
|
+
case T_SYMBOL:
|
2038
|
+
cinstanceName = rb_id2name(SYM2ID(instanceName));
|
2039
|
+
break;
|
2040
|
+
case T_STRING:
|
2041
|
+
cinstanceName = StringValueCStr(instanceName);
|
2042
|
+
break;
|
2043
|
+
default:
|
2044
|
+
rb_warn("instance name must be a String or a Symbol");
|
2045
|
+
return Qnil;
|
2046
|
+
}
|
2047
|
+
|
2048
|
+
switch (TYPE(rbDefmodule)) {
|
2049
|
+
case T_NIL:
|
2050
|
+
defmodule = NULL;
|
2051
|
+
break;
|
2052
|
+
case T_STRING:
|
2053
|
+
case T_SYMBOL:
|
2054
|
+
rbDefmodule = clips_environment_find_defmodule(rbEnvironment, rbDefmodule);
|
2055
|
+
if (rbDefmodule == Qnil) {
|
2056
|
+
return Qnil;
|
2057
|
+
}
|
2058
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2059
|
+
break;
|
2060
|
+
case T_DATA:
|
2061
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2062
|
+
break;
|
2063
|
+
default:
|
2064
|
+
rb_warn("defmodule name must be a symbol or string");
|
2065
|
+
return Qnil;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
instance = FindInstance(
|
2069
|
+
env,
|
2070
|
+
defmodule,
|
2071
|
+
cinstanceName,
|
2072
|
+
RTEST(search_imports));
|
2073
|
+
|
2074
|
+
if (instance == NULL) {
|
2075
|
+
return Qnil;
|
2076
|
+
} else {
|
2077
|
+
rbInstance =
|
2078
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
|
2079
|
+
|
2080
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2081
|
+
|
2082
|
+
return rbInstance;
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
|
2086
|
+
static VALUE clips_environment_static_find_instance(int argc, VALUE *argv, VALUE klass) {
|
2087
|
+
VALUE rbEnvironment, instanceName, rbInstance, rbDefmodule, search_imports;
|
2088
|
+
Defmodule *defmodule;
|
2089
|
+
Environment *env;
|
2090
|
+
Instance *instance;
|
2091
|
+
|
2092
|
+
rb_scan_args(argc, argv, "22", &rbEnvironment, &instanceName, &rbDefmodule, &search_imports);
|
2093
|
+
|
2094
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2095
|
+
|
2096
|
+
const char *cinstanceName;
|
2097
|
+
switch(TYPE(instanceName))
|
2098
|
+
{
|
2099
|
+
case T_SYMBOL:
|
2100
|
+
cinstanceName = rb_id2name(SYM2ID(instanceName));
|
2101
|
+
break;
|
2102
|
+
case T_STRING:
|
2103
|
+
cinstanceName = StringValueCStr(instanceName);
|
2104
|
+
break;
|
2105
|
+
default:
|
2106
|
+
rb_warn("instance name must be a String or a Symbol");
|
2107
|
+
return Qnil;
|
2108
|
+
}
|
2109
|
+
|
2110
|
+
switch (TYPE(rbDefmodule)) {
|
2111
|
+
case T_NIL:
|
2112
|
+
defmodule = NULL;
|
2113
|
+
break;
|
2114
|
+
case T_STRING:
|
2115
|
+
case T_SYMBOL:
|
2116
|
+
rbDefmodule = clips_environment_find_defmodule(rbEnvironment, rbDefmodule);
|
2117
|
+
if (rbDefmodule == Qnil) {
|
2118
|
+
return Qnil;
|
2119
|
+
}
|
2120
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2121
|
+
break;
|
2122
|
+
case T_DATA:
|
2123
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2124
|
+
break;
|
2125
|
+
default:
|
2126
|
+
rb_warn("defmodule name must be a symbol or string");
|
2127
|
+
return Qnil;
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
instance = FindInstance(
|
2131
|
+
env,
|
2132
|
+
defmodule,
|
2133
|
+
cinstanceName,
|
2134
|
+
RTEST(search_imports));
|
2135
|
+
|
2136
|
+
if (instance == NULL) {
|
2137
|
+
return Qnil;
|
2138
|
+
} else {
|
2139
|
+
rbInstance =
|
2140
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
|
2141
|
+
|
2142
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2143
|
+
|
2144
|
+
return rbInstance;
|
2145
|
+
}
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
static VALUE clips_environment_defmodule_find_instance(int argc, VALUE *argv, VALUE rbDefmodule) {
|
2149
|
+
VALUE instanceName, search_imports, rbInstance, rbEnvironment;
|
2150
|
+
Defmodule *defmodule;
|
2151
|
+
Environment *env;
|
2152
|
+
Instance *instance;
|
2153
|
+
const char *cinstanceName;
|
2154
|
+
|
2155
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2156
|
+
|
2157
|
+
rbEnvironment = rb_iv_get(rbDefmodule, "@environment");
|
2158
|
+
|
2159
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2160
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2161
|
+
|
2162
|
+
rb_scan_args(argc, argv, "11", &instanceName, &search_imports);
|
2163
|
+
|
2164
|
+
switch(TYPE(instanceName))
|
2165
|
+
{
|
2166
|
+
case T_SYMBOL:
|
2167
|
+
cinstanceName = rb_id2name(SYM2ID(instanceName));
|
2168
|
+
break;
|
2169
|
+
case T_STRING:
|
2170
|
+
cinstanceName = StringValueCStr(instanceName);
|
2171
|
+
break;
|
2172
|
+
default:
|
2173
|
+
rb_warn("instance name must be a String or a Symbol");
|
2174
|
+
return Qnil;
|
2175
|
+
}
|
2176
|
+
|
2177
|
+
instance = FindInstance(
|
2178
|
+
env,
|
2179
|
+
defmodule,
|
2180
|
+
cinstanceName,
|
2181
|
+
RTEST(search_imports));
|
2182
|
+
|
2183
|
+
if (instance == NULL) {
|
2184
|
+
return Qnil;
|
2185
|
+
} else {
|
2186
|
+
rbInstance =
|
2187
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
|
2188
|
+
|
2189
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2190
|
+
|
2191
|
+
return rbInstance;
|
2192
|
+
}
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
static VALUE clips_environment_defmodule_static_find_instance(int argc, VALUE *argv, VALUE klass) {
|
2196
|
+
VALUE rbDefmodule, rbEnvironment, instanceName, search_imports, rbInstance;
|
2197
|
+
Defmodule *defmodule;
|
2198
|
+
Environment *env;
|
2199
|
+
Instance *instance;
|
2200
|
+
const char *cinstanceName;
|
2201
|
+
|
2202
|
+
rb_scan_args(argc, argv, "21", &rbDefmodule, &instanceName, &search_imports);
|
2203
|
+
|
2204
|
+
rbEnvironment = rb_iv_get(rbDefmodule, "@environment");
|
2205
|
+
|
2206
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2207
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, defmodule);
|
2208
|
+
|
2209
|
+
switch(TYPE(instanceName))
|
2210
|
+
{
|
2211
|
+
case T_SYMBOL:
|
2212
|
+
cinstanceName = rb_id2name(SYM2ID(instanceName));
|
2213
|
+
break;
|
2214
|
+
case T_STRING:
|
2215
|
+
cinstanceName = StringValueCStr(instanceName);
|
2216
|
+
break;
|
2217
|
+
default:
|
2218
|
+
rb_warn("instance name must be a String or a Symbol");
|
2219
|
+
return Qnil;
|
2220
|
+
}
|
2221
|
+
|
2222
|
+
instance = FindInstance(
|
2223
|
+
env,
|
2224
|
+
defmodule,
|
2225
|
+
cinstanceName,
|
2226
|
+
RTEST(search_imports));
|
2227
|
+
|
2228
|
+
if (instance == NULL) {
|
2229
|
+
return Qnil;
|
2230
|
+
} else {
|
2231
|
+
rbInstance =
|
2232
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
|
2233
|
+
|
2234
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2235
|
+
|
2236
|
+
return rbInstance;
|
2237
|
+
}
|
2238
|
+
}
|
2239
|
+
|
2240
|
+
|
1928
2241
|
static VALUE clips_environment_find_deftemplate(VALUE self, VALUE deftemplate_name)
|
1929
2242
|
{
|
1930
2243
|
Environment *env;
|
@@ -1959,6 +2272,40 @@ static VALUE clips_environment_static_find_deftemplate(VALUE self, VALUE rbEnvir
|
|
1959
2272
|
return clips_environment_find_deftemplate(rbEnvironment, deftemplate_name);
|
1960
2273
|
}
|
1961
2274
|
|
2275
|
+
static VALUE clips_environment_find_defclass(VALUE self, VALUE defclass_name)
|
2276
|
+
{
|
2277
|
+
Environment *env;
|
2278
|
+
Defclass *class;
|
2279
|
+
|
2280
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
2281
|
+
|
2282
|
+
switch (TYPE(defclass_name)) {
|
2283
|
+
case T_STRING:
|
2284
|
+
class = FindDefclass(env, StringValueCStr(defclass_name));
|
2285
|
+
break;
|
2286
|
+
case T_SYMBOL:
|
2287
|
+
class = FindDefclass(env, rb_id2name(SYM2ID(defclass_name)));
|
2288
|
+
break;
|
2289
|
+
default:
|
2290
|
+
rb_warn("defclass name must be a symbol or string");
|
2291
|
+
return Qnil;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
if (class == NULL) {
|
2295
|
+
return Qnil;
|
2296
|
+
} else {
|
2297
|
+
VALUE rbDefclass;
|
2298
|
+
rbDefclass = TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Defclass")), &Defclass_type, class);
|
2299
|
+
rb_iv_set(rbDefclass, "@environment", self);
|
2300
|
+
return rbDefclass;
|
2301
|
+
}
|
2302
|
+
}
|
2303
|
+
|
2304
|
+
static VALUE clips_environment_static_find_defclass(VALUE self, VALUE rbEnvironment, VALUE defclass_name)
|
2305
|
+
{
|
2306
|
+
return clips_environment_find_defclass(rbEnvironment, defclass_name);
|
2307
|
+
}
|
2308
|
+
|
1962
2309
|
static VALUE clips_environment_deftemplate_name(VALUE self)
|
1963
2310
|
{
|
1964
2311
|
Deftemplate *deftemplate;
|
@@ -2125,6 +2472,186 @@ static VALUE clips_environment_static_get_fact_list(int argc, VALUE *argv, VALUE
|
|
2125
2472
|
return out;
|
2126
2473
|
}
|
2127
2474
|
|
2475
|
+
static VALUE clips_environment_get_instance_list(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2476
|
+
VALUE rbDefclass_or_defclass_name, rbDefclass, include_subclasses, rbInstance, returnArray;
|
2477
|
+
Environment *env;
|
2478
|
+
Defclass *defclass;
|
2479
|
+
UDFValue iterator;
|
2480
|
+
Instance *theInstance;
|
2481
|
+
|
2482
|
+
returnArray = rb_ary_new2(0);
|
2483
|
+
|
2484
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2485
|
+
|
2486
|
+
rb_scan_args(argc, argv, "02", &rbDefclass_or_defclass_name, &include_subclasses);
|
2487
|
+
// defclass is undefined, ignore include_subclasses
|
2488
|
+
if (rbDefclass_or_defclass_name == Qnil) {
|
2489
|
+
for (
|
2490
|
+
theInstance = GetNextInstance(env,NULL);
|
2491
|
+
theInstance != NULL;
|
2492
|
+
theInstance = GetNextInstance(env,theInstance)
|
2493
|
+
) {
|
2494
|
+
rbInstance =
|
2495
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2496
|
+
|
2497
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2498
|
+
rb_ary_push(returnArray, rbInstance);
|
2499
|
+
}
|
2500
|
+
} else if (include_subclasses != Qtrue) {
|
2501
|
+
switch (TYPE(rbDefclass_or_defclass_name)) {
|
2502
|
+
case T_STRING:
|
2503
|
+
case T_SYMBOL:
|
2504
|
+
if (Qnil == (rbDefclass = clips_environment_find_defclass(rbEnvironment, rbDefclass_or_defclass_name))) {
|
2505
|
+
rb_warn("could not find defclass");
|
2506
|
+
return Qnil;
|
2507
|
+
}
|
2508
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
2509
|
+
break;
|
2510
|
+
case T_DATA:
|
2511
|
+
TypedData_Get_Struct(rbDefclass_or_defclass_name, Defclass, &Defclass_type, defclass);
|
2512
|
+
break;
|
2513
|
+
default:
|
2514
|
+
rb_warn("defclass name must be a symbol or string");
|
2515
|
+
return Qnil;
|
2516
|
+
}
|
2517
|
+
for (
|
2518
|
+
theInstance = GetNextInstanceInClass(defclass,NULL);
|
2519
|
+
theInstance != NULL;
|
2520
|
+
theInstance = GetNextInstanceInClass(defclass,theInstance)
|
2521
|
+
) {
|
2522
|
+
rbInstance =
|
2523
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2524
|
+
|
2525
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2526
|
+
rb_ary_push(returnArray, rbInstance);
|
2527
|
+
}
|
2528
|
+
} else if (include_subclasses == Qtrue) {
|
2529
|
+
switch (TYPE(rbDefclass_or_defclass_name)) {
|
2530
|
+
case T_STRING:
|
2531
|
+
case T_SYMBOL:
|
2532
|
+
if (Qnil == (rbDefclass = clips_environment_find_defclass(rbEnvironment, rbDefclass_or_defclass_name))) {
|
2533
|
+
rb_warn("could not find defclass");
|
2534
|
+
return Qnil;
|
2535
|
+
}
|
2536
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
2537
|
+
break;
|
2538
|
+
case T_DATA:
|
2539
|
+
TypedData_Get_Struct(rbDefclass_or_defclass_name, Defclass, &Defclass_type, defclass);
|
2540
|
+
break;
|
2541
|
+
default:
|
2542
|
+
rb_warn("defclass name must be a symbol or string");
|
2543
|
+
return Qnil;
|
2544
|
+
}
|
2545
|
+
for (
|
2546
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,NULL,&iterator);
|
2547
|
+
theInstance != NULL;
|
2548
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,theInstance,&iterator)
|
2549
|
+
) {
|
2550
|
+
rbInstance =
|
2551
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2552
|
+
|
2553
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2554
|
+
rb_ary_push(returnArray, rbInstance);
|
2555
|
+
}
|
2556
|
+
// unexpected input of some kind...
|
2557
|
+
} else {
|
2558
|
+
rb_warn("unexpected arguments sent to get_instance_list!");
|
2559
|
+
return Qnil;
|
2560
|
+
}
|
2561
|
+
|
2562
|
+
return returnArray;
|
2563
|
+
}
|
2564
|
+
|
2565
|
+
static VALUE clips_environment_static_get_instance_list(int argc, VALUE *argv, VALUE klass) {
|
2566
|
+
VALUE rbEnvironment, rbDefclass_or_defclass_name, rbDefclass, include_subclasses, rbInstance, returnArray;
|
2567
|
+
Environment *env;
|
2568
|
+
Defclass *defclass;
|
2569
|
+
UDFValue iterator;
|
2570
|
+
Instance *theInstance;
|
2571
|
+
|
2572
|
+
returnArray = rb_ary_new2(0);
|
2573
|
+
|
2574
|
+
rb_scan_args(argc, argv, "12", &rbEnvironment, &rbDefclass_or_defclass_name, &include_subclasses);
|
2575
|
+
|
2576
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2577
|
+
// defclass is undefined, ignore include_subclasses
|
2578
|
+
if (rbDefclass_or_defclass_name == Qnil) {
|
2579
|
+
for (
|
2580
|
+
theInstance = GetNextInstance(env,NULL);
|
2581
|
+
theInstance != NULL;
|
2582
|
+
theInstance = GetNextInstance(env,theInstance)
|
2583
|
+
) {
|
2584
|
+
rbInstance =
|
2585
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2586
|
+
|
2587
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2588
|
+
rb_ary_push(returnArray, rbInstance);
|
2589
|
+
}
|
2590
|
+
} else if (include_subclasses != Qtrue) {
|
2591
|
+
switch (TYPE(rbDefclass_or_defclass_name)) {
|
2592
|
+
case T_STRING:
|
2593
|
+
case T_SYMBOL:
|
2594
|
+
if (Qnil == (rbDefclass = clips_environment_find_defclass(rbEnvironment, rbDefclass_or_defclass_name))) {
|
2595
|
+
rb_warn("could not find defclass");
|
2596
|
+
return Qnil;
|
2597
|
+
}
|
2598
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
2599
|
+
break;
|
2600
|
+
case T_DATA:
|
2601
|
+
TypedData_Get_Struct(rbDefclass_or_defclass_name, Defclass, &Defclass_type, defclass);
|
2602
|
+
break;
|
2603
|
+
default:
|
2604
|
+
rb_warn("defclass name must be a symbol or string");
|
2605
|
+
return Qnil;
|
2606
|
+
}
|
2607
|
+
for (
|
2608
|
+
theInstance = GetNextInstanceInClass(defclass,NULL);
|
2609
|
+
theInstance != NULL;
|
2610
|
+
theInstance = GetNextInstanceInClass(defclass,theInstance)
|
2611
|
+
) {
|
2612
|
+
rbInstance =
|
2613
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2614
|
+
|
2615
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2616
|
+
rb_ary_push(returnArray, rbInstance);
|
2617
|
+
}
|
2618
|
+
} else if (include_subclasses == Qtrue) {
|
2619
|
+
switch (TYPE(rbDefclass_or_defclass_name)) {
|
2620
|
+
case T_STRING:
|
2621
|
+
case T_SYMBOL:
|
2622
|
+
if (Qnil == (rbDefclass = clips_environment_find_defclass(rbEnvironment, rbDefclass_or_defclass_name))) {
|
2623
|
+
rb_warn("could not find defclass");
|
2624
|
+
return Qnil;
|
2625
|
+
}
|
2626
|
+
TypedData_Get_Struct(rbDefclass, Defclass, &Defclass_type, defclass);
|
2627
|
+
break;
|
2628
|
+
case T_DATA:
|
2629
|
+
TypedData_Get_Struct(rbDefclass_or_defclass_name, Defclass, &Defclass_type, defclass);
|
2630
|
+
break;
|
2631
|
+
default:
|
2632
|
+
rb_warn("defclass name must be a symbol or string");
|
2633
|
+
return Qnil;
|
2634
|
+
}
|
2635
|
+
for (
|
2636
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,NULL,&iterator);
|
2637
|
+
theInstance != NULL;
|
2638
|
+
theInstance = GetNextInstanceInClassAndSubclasses(&defclass,theInstance,&iterator)
|
2639
|
+
) {
|
2640
|
+
rbInstance =
|
2641
|
+
TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, theInstance);
|
2642
|
+
|
2643
|
+
rb_iv_set(rbInstance, "@environment", rbEnvironment);
|
2644
|
+
rb_ary_push(returnArray, rbInstance);
|
2645
|
+
}
|
2646
|
+
// unexpected input of some kind...
|
2647
|
+
} else {
|
2648
|
+
rb_warn("unexpected arguments sent to get_instance_list!");
|
2649
|
+
return Qnil;
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
return returnArray;
|
2653
|
+
}
|
2654
|
+
|
2128
2655
|
static VALUE clips_environment_get_deftemplate_list(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2129
2656
|
VALUE defmodule_or_defmodule_name;
|
2130
2657
|
Environment *env;
|
@@ -2193,6 +2720,74 @@ static VALUE clips_environment_static_get_deftemplate_list(int argc, VALUE *argv
|
|
2193
2720
|
return out;
|
2194
2721
|
}
|
2195
2722
|
|
2723
|
+
static VALUE clips_environment_get_defclass_list(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2724
|
+
VALUE defmodule_or_defmodule_name;
|
2725
|
+
Environment *env;
|
2726
|
+
Defmodule *module;
|
2727
|
+
CLIPSValue value;
|
2728
|
+
VALUE out;
|
2729
|
+
|
2730
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2731
|
+
|
2732
|
+
rb_scan_args(argc, argv, "01", &defmodule_or_defmodule_name);
|
2733
|
+
switch (TYPE(defmodule_or_defmodule_name)) {
|
2734
|
+
case T_NIL:
|
2735
|
+
module = NULL;
|
2736
|
+
break;
|
2737
|
+
case T_STRING:
|
2738
|
+
case T_SYMBOL:
|
2739
|
+
TypedData_Get_Struct(
|
2740
|
+
clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
|
2741
|
+
Defmodule, &Defmodule_type, module);
|
2742
|
+
break;
|
2743
|
+
case T_DATA:
|
2744
|
+
TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
|
2745
|
+
break;
|
2746
|
+
default:
|
2747
|
+
rb_warn("defmodule name must be a symbol or string");
|
2748
|
+
return Qnil;
|
2749
|
+
}
|
2750
|
+
GetDefclassList(env, &value, module);
|
2751
|
+
|
2752
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
2753
|
+
|
2754
|
+
return out;
|
2755
|
+
}
|
2756
|
+
|
2757
|
+
static VALUE clips_environment_static_get_defclass_list(int argc, VALUE *argv, VALUE klass) {
|
2758
|
+
VALUE rbEnvironment, defmodule_or_defmodule_name;
|
2759
|
+
Environment *env;
|
2760
|
+
Defmodule *module;
|
2761
|
+
CLIPSValue value;
|
2762
|
+
VALUE out;
|
2763
|
+
|
2764
|
+
rb_scan_args(argc, argv, "11", &rbEnvironment, &defmodule_or_defmodule_name);
|
2765
|
+
|
2766
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2767
|
+
switch (TYPE(defmodule_or_defmodule_name)) {
|
2768
|
+
case T_NIL:
|
2769
|
+
module = NULL;
|
2770
|
+
break;
|
2771
|
+
case T_STRING:
|
2772
|
+
case T_SYMBOL:
|
2773
|
+
TypedData_Get_Struct(
|
2774
|
+
clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
|
2775
|
+
Defmodule, &Defmodule_type, module);
|
2776
|
+
break;
|
2777
|
+
case T_DATA:
|
2778
|
+
TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
|
2779
|
+
break;
|
2780
|
+
default:
|
2781
|
+
rb_warn("defmodule name must be a symbol or string");
|
2782
|
+
return Qnil;
|
2783
|
+
}
|
2784
|
+
GetDefclassList(env, &value, module);
|
2785
|
+
|
2786
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
2787
|
+
|
2788
|
+
return out;
|
2789
|
+
}
|
2790
|
+
|
2196
2791
|
static VALUE clips_environment_get_defrule_list(int argc, VALUE *argv, VALUE rbEnvironment) {
|
2197
2792
|
VALUE defmodule_or_defmodule_name;
|
2198
2793
|
Environment *env;
|
@@ -2333,6 +2928,30 @@ static VALUE clips_environment_defmodule_static_get_fact_list(VALUE self, VALUE
|
|
2333
2928
|
return clips_environment_defmodule_get_fact_list(rbDefmodule);
|
2334
2929
|
}
|
2335
2930
|
|
2931
|
+
static VALUE clips_environment_defmodule_get_defclass_list(VALUE self)
|
2932
|
+
{
|
2933
|
+
Defmodule *module;
|
2934
|
+
Environment *env;
|
2935
|
+
CLIPSValue value;
|
2936
|
+
VALUE out;
|
2937
|
+
|
2938
|
+
VALUE rbEnvironment = rb_iv_get(self, "@environment");
|
2939
|
+
|
2940
|
+
TypedData_Get_Struct(self, Defmodule, &Defmodule_type, module);
|
2941
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
2942
|
+
|
2943
|
+
GetDefclassList(env, &value, module);
|
2944
|
+
|
2945
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
2946
|
+
|
2947
|
+
return out;
|
2948
|
+
}
|
2949
|
+
|
2950
|
+
static VALUE clips_environment_defmodule_static_get_defclass_list(VALUE self, VALUE rbDefmodule)
|
2951
|
+
{
|
2952
|
+
return clips_environment_defmodule_get_defclass_list(rbDefmodule);
|
2953
|
+
}
|
2954
|
+
|
2336
2955
|
static VALUE clips_environment_defmodule_get_deftemplate_list(VALUE self)
|
2337
2956
|
{
|
2338
2957
|
Defmodule *module;
|
@@ -3378,14 +3997,22 @@ void Init_clipsruby(void)
|
|
3378
3997
|
rb_define_method(rbEnvironment, "find_defmodule", clips_environment_find_defmodule, 1);
|
3379
3998
|
rb_define_singleton_method(rbEnvironment, "find_deftemplate", clips_environment_static_find_deftemplate, 2);
|
3380
3999
|
rb_define_method(rbEnvironment, "find_deftemplate", clips_environment_find_deftemplate, 1);
|
4000
|
+
rb_define_singleton_method(rbEnvironment, "find_defclass", clips_environment_static_find_defclass, 2);
|
4001
|
+
rb_define_method(rbEnvironment, "find_defclass", clips_environment_find_defclass, 1);
|
4002
|
+
rb_define_singleton_method(rbEnvironment, "find_instance", clips_environment_static_find_instance, -1);
|
4003
|
+
rb_define_method(rbEnvironment, "find_instance", clips_environment_find_instance, -1);
|
3381
4004
|
rb_define_singleton_method(rbEnvironment, "get_current_module", clips_environment_static_get_current_module, 1);
|
3382
4005
|
rb_define_method(rbEnvironment, "get_current_module", clips_environment_get_current_module, 0);
|
3383
4006
|
rb_define_singleton_method(rbEnvironment, "set_current_module", clips_environment_static_set_current_module, 2);
|
3384
4007
|
rb_define_method(rbEnvironment, "set_current_module", clips_environment_set_current_module, 1);
|
3385
4008
|
rb_define_singleton_method(rbEnvironment, "get_fact_list", clips_environment_static_get_fact_list, -1);
|
3386
4009
|
rb_define_method(rbEnvironment, "get_fact_list", clips_environment_get_fact_list, -1);
|
4010
|
+
rb_define_singleton_method(rbEnvironment, "get_instance_list", clips_environment_static_get_instance_list, -1);
|
4011
|
+
rb_define_method(rbEnvironment, "get_instance_list", clips_environment_get_instance_list, -1);
|
3387
4012
|
rb_define_singleton_method(rbEnvironment, "get_deftemplate_list", clips_environment_static_get_deftemplate_list, -1);
|
3388
4013
|
rb_define_method(rbEnvironment, "get_deftemplate_list", clips_environment_get_deftemplate_list, -1);
|
4014
|
+
rb_define_singleton_method(rbEnvironment, "get_defclass_list", clips_environment_static_get_defclass_list, -1);
|
4015
|
+
rb_define_method(rbEnvironment, "get_defclass_list", clips_environment_get_defclass_list, -1);
|
3389
4016
|
rb_define_singleton_method(rbEnvironment, "get_defrule_list", clips_environment_static_get_defrule_list, -1);
|
3390
4017
|
rb_define_method(rbEnvironment, "get_defrule_list", clips_environment_get_defrule_list, -1);
|
3391
4018
|
rb_define_singleton_method(rbEnvironment, "get_defmodule_list", clips_environment_static_get_defmodule_list, 1);
|
@@ -3511,12 +4138,16 @@ void Init_clipsruby(void)
|
|
3511
4138
|
rb_define_method(rbDefmodule, "pp_form", clips_environment_defmodule_pp_form, 0);
|
3512
4139
|
rb_define_singleton_method(rbDefmodule, "set_current", clips_environment_defmodule_static_set_current, 1);
|
3513
4140
|
rb_define_method(rbDefmodule, "set_current", clips_environment_defmodule_set_current, 0);
|
4141
|
+
rb_define_singleton_method(rbDefmodule, "get_defclass_list", clips_environment_defmodule_static_get_defclass_list, 1);
|
4142
|
+
rb_define_method(rbDefmodule, "get_defclass_list", clips_environment_defmodule_get_defclass_list, 0);
|
3514
4143
|
rb_define_singleton_method(rbDefmodule, "get_fact_list", clips_environment_defmodule_static_get_fact_list, 1);
|
3515
4144
|
rb_define_method(rbDefmodule, "get_fact_list", clips_environment_defmodule_get_fact_list, 0);
|
3516
4145
|
rb_define_singleton_method(rbDefmodule, "get_deftemplate_list", clips_environment_defmodule_static_get_deftemplate_list, 1);
|
3517
4146
|
rb_define_method(rbDefmodule, "get_deftemplate_list", clips_environment_defmodule_get_deftemplate_list, 0);
|
3518
4147
|
rb_define_singleton_method(rbDefmodule, "get_defrule_list", clips_environment_defmodule_static_get_defrule_list, 1);
|
3519
4148
|
rb_define_method(rbDefmodule, "get_defrule_list", clips_environment_defmodule_get_defrule_list, 0);
|
4149
|
+
rb_define_singleton_method(rbDefmodule, "find_instance", clips_environment_defmodule_static_find_instance, -1);
|
4150
|
+
rb_define_method(rbDefmodule, "find_instance", clips_environment_defmodule_find_instance, -1);
|
3520
4151
|
|
3521
4152
|
VALUE rbFact = rb_define_class_under(rbEnvironment, "Fact", rb_cObject);
|
3522
4153
|
rb_define_alloc_func(rbFact, fact_alloc);
|
@@ -3568,6 +4199,8 @@ void Init_clipsruby(void)
|
|
3568
4199
|
rb_define_method(rbDefclass, "defmodule_name", clips_environment_defclass_defmodule_name, 0);
|
3569
4200
|
rb_define_singleton_method(rbDefclass, "pp_form", clips_environment_defclass_static_pp_form, 1);
|
3570
4201
|
rb_define_method(rbDefclass, "pp_form", clips_environment_defclass_pp_form, 0);
|
4202
|
+
rb_define_singleton_method(rbDefclass, "get_instance_list", clips_environment_defclass_static_get_instance_list, -1);
|
4203
|
+
rb_define_method(rbDefclass, "get_instance_list", clips_environment_defclass_get_instance_list, -1);
|
3571
4204
|
|
3572
4205
|
VALUE rbInstance = rb_define_class_under(rbEnvironment, "Instance", rb_cObject);
|
3573
4206
|
rb_define_alloc_func(rbInstance, instance_alloc);
|
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.35
|
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-27 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
|