clipsruby 0.0.40 → 0.0.42

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +388 -404
  3. data/ext/clipsruby/clipsruby.c +471 -27
  4. metadata +2 -2
@@ -476,31 +476,6 @@ static VALUE clips_environment_defclass_static_get_instance_list(int argc, VALUE
476
476
  }
477
477
 
478
478
 
479
- static VALUE clips_environment_make_instance(VALUE self, VALUE string)
480
- {
481
- Environment *env;
482
-
483
- TypedData_Get_Struct(self, Environment, &Environment_type, env);
484
-
485
- Instance *instance = MakeInstance(env, StringValueCStr(string));
486
-
487
- if (instance == NULL) {
488
- return Qnil;
489
- }
490
-
491
- VALUE rb_instance =
492
- TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Instance")), &Instance_type, instance);
493
-
494
- rb_iv_set(rb_instance, "@environment", self);
495
-
496
- return rb_instance;
497
- }
498
-
499
- static VALUE clips_environment_static_make_instance(VALUE self, VALUE rbEnvironment, VALUE string)
500
- {
501
- return clips_environment_make_instance(rbEnvironment, string);
502
- }
503
-
504
479
  static VALUE clips_environment_instance_unmake(VALUE self)
505
480
  {
506
481
  Instance *instance;
@@ -869,6 +844,329 @@ static VALUE clips_environment_static_assert_hash(VALUE self, VALUE environment,
869
844
  return clips_environment_assert_hash(environment, deftemplate_name, hash);
870
845
  }
871
846
 
847
+ static int _clips_environment_make_instance(VALUE key, VALUE value, VALUE args)
848
+ {
849
+ const char *cslot_name;
850
+ switch(TYPE(key))
851
+ {
852
+ case T_SYMBOL:
853
+ cslot_name = rb_id2name(SYM2ID(key));
854
+ break;
855
+ case T_STRING:
856
+ cslot_name = StringValueCStr(key);
857
+ break;
858
+ default:
859
+ rb_raise(rb_eTypeError, "Slot name must be a String or a Symbol");
860
+ return ST_CONTINUE;
861
+ }
862
+
863
+ VALUE *ib_and_env = (VALUE*)args;
864
+ InstanceBuilder *ib = (InstanceBuilder*) ib_and_env[0];
865
+ Environment *env = (Environment*) ib_and_env[1];
866
+ CLIPSValue cv = VALUE_to_CLIPSValue(value, env);
867
+ handle_pse_error(IBPutSlot(ib, cslot_name, &cv), cslot_name);
868
+
869
+ return ST_CONTINUE;
870
+ }
871
+
872
+ static VALUE clips_environment_make_instance(int argc, VALUE *argv, VALUE rbEnvironment) {
873
+ VALUE first_argument, second_argument, third_argument, defclass_class, rb_instance;
874
+ Environment *env;
875
+ Defclass *defclass;
876
+ InstanceBuilder *ib;
877
+ Instance *instance;
878
+ const char *instance_name;
879
+
880
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
881
+
882
+ rb_scan_args(argc, argv, "12", &first_argument, &second_argument, &third_argument);
883
+
884
+ defclass_class = rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Defclass"));
885
+
886
+ // first argument must be a defclass
887
+ switch (TYPE(first_argument))
888
+ {
889
+ case T_OBJECT:
890
+ case T_DATA:
891
+ if (CLASS_OF(first_argument) == defclass_class) {
892
+ TypedData_Get_Struct(first_argument, Defclass, &Defclass_type, defclass);
893
+ ib = CreateInstanceBuilder(env, DefclassName(defclass));
894
+ break;
895
+ } else {
896
+ rb_warn("First argument must be a Defclass; first argument was an object, but not %s class; it was a %s", rb_class2name(defclass_class), rb_class2name(first_argument));
897
+ return Qnil;
898
+ }
899
+ case T_STRING:
900
+ ib = CreateInstanceBuilder(env, StringValueCStr(first_argument));
901
+ break;
902
+ case T_SYMBOL:
903
+ ib = CreateInstanceBuilder(env, rb_id2name(SYM2ID(first_argument)));
904
+ break;
905
+ default:
906
+ rb_warn("First argument must be a Defclass; type wasn't a Defclass, a string, or a symbol; it was a %s!", rb_class2name(rb_obj_class(first_argument)));
907
+ return Qnil;
908
+ }
909
+
910
+ switch (IBError(env))
911
+ {
912
+ case IBE_NO_ERROR:
913
+ break;
914
+ case IBE_NULL_POINTER_ERROR:
915
+ rb_warn("Could not make instance; null pointer error. This could be a bug in clipsruby!");
916
+ IBDispose(ib);
917
+ return Qnil;
918
+ case IBE_DEFCLASS_NOT_FOUND_ERROR:
919
+ IBDispose(ib);
920
+ switch (TYPE(first_argument)) {
921
+ case T_STRING:
922
+ instance = MakeInstance(env, StringValueCStr(first_argument));
923
+ break;
924
+ case T_SYMBOL:
925
+ instance = MakeInstance(env, rb_id2name(SYM2ID(first_argument)));
926
+ break;
927
+ default:
928
+ instance = NULL;
929
+ break;
930
+ }
931
+ if (instance == NULL) {
932
+ rb_warn("Could not make instance; defclass not found, and first argument was not a valid make-instance string!");
933
+ return Qnil;
934
+ } else {
935
+ rb_instance =
936
+ TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
937
+
938
+ rb_iv_set(rb_instance, "@environment", rbEnvironment);
939
+
940
+ return rb_instance;
941
+ }
942
+ case IBE_COULD_NOT_CREATE_ERROR:
943
+ rb_warn("Could not make instance; This could be a bug in clipsruby!");
944
+ IBDispose(ib);
945
+ return Qnil;
946
+ case IBE_RULE_NETWORK_ERROR:
947
+ rb_warn("Could not make instance; Rule network error!");
948
+ IBDispose(ib);
949
+ return Qnil;
950
+ }
951
+
952
+ void *args[2] = { (void *)ib, (void *)env };
953
+
954
+ switch(TYPE(second_argument))
955
+ {
956
+ case T_STRING:
957
+ case T_SYMBOL:
958
+ instance_name = rb_id2name(SYM2ID(second_argument));
959
+ break;
960
+ case T_NIL:
961
+ instance_name = NULL;
962
+ break;
963
+ case T_HASH:
964
+ instance_name = NULL;
965
+ rb_hash_foreach(second_argument, _clips_environment_make_instance, (VALUE)args);
966
+ break;
967
+ default:
968
+ rb_warn("Could not make instance; second argument must be the name of the new instance or the slot hash!");
969
+ IBDispose(ib);
970
+ return Qnil;
971
+ }
972
+
973
+ switch(TYPE(third_argument))
974
+ {
975
+ case T_NIL:
976
+ break;
977
+ case T_HASH:
978
+ rb_hash_foreach(third_argument, _clips_environment_make_instance, (VALUE)args);
979
+ break;
980
+ default:
981
+ rb_warn("Could not make instance; third argument must be nil or the slot hash!");
982
+ IBDispose(ib);
983
+ return Qnil;
984
+ }
985
+
986
+ if ((instance = IBMake(ib, instance_name)) == NULL)
987
+ {
988
+ switch (IBError(env))
989
+ {
990
+ case IBE_NO_ERROR:
991
+ break;
992
+ case IBE_NULL_POINTER_ERROR:
993
+ rb_warn("Could not make instance; null pointer error. This could be a bug in clipsruby!");
994
+ IBDispose(ib);
995
+ return Qnil;
996
+ case IBE_DEFCLASS_NOT_FOUND_ERROR:
997
+ rb_warn("Could not make instance; defclass not found!");
998
+ IBDispose(ib);
999
+ return Qnil;
1000
+ case IBE_COULD_NOT_CREATE_ERROR:
1001
+ rb_warn("Could not make instance; This could be a bug in clipsruby!");
1002
+ IBDispose(ib);
1003
+ return Qnil;
1004
+ case IBE_RULE_NETWORK_ERROR:
1005
+ rb_warn("Could not make instance; Rule network error!");
1006
+ IBDispose(ib);
1007
+ return Qnil;
1008
+ }
1009
+ }
1010
+
1011
+ IBDispose(ib);
1012
+
1013
+ rb_instance =
1014
+ TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
1015
+
1016
+ rb_iv_set(rb_instance, "@environment", rbEnvironment);
1017
+
1018
+ return rb_instance;
1019
+ }
1020
+
1021
+ static VALUE clips_environment_static_make_instance(int argc, VALUE *argv, VALUE klass) {
1022
+ VALUE rbEnvironment, first_argument, second_argument, third_argument, defclass_class, rb_instance;
1023
+ Environment *env;
1024
+ Defclass *defclass;
1025
+ InstanceBuilder *ib;
1026
+ Instance *instance;
1027
+ const char *instance_name;
1028
+
1029
+ rb_scan_args(argc, argv, "22", &rbEnvironment, &first_argument, &second_argument, &third_argument);
1030
+
1031
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
1032
+
1033
+ defclass_class = rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Defclass"));
1034
+
1035
+ // first argument must be a defclass
1036
+ switch (TYPE(first_argument))
1037
+ {
1038
+ case T_OBJECT:
1039
+ case T_DATA:
1040
+ if (CLASS_OF(first_argument) == defclass_class) {
1041
+ TypedData_Get_Struct(first_argument, Defclass, &Defclass_type, defclass);
1042
+ ib = CreateInstanceBuilder(env, DefclassName(defclass));
1043
+ break;
1044
+ } else {
1045
+ rb_warn("First argument must be a Defclass; first argument was an object, but not %s class; it was a %s", rb_class2name(defclass_class), rb_class2name(first_argument));
1046
+ return Qnil;
1047
+ }
1048
+ case T_STRING:
1049
+ ib = CreateInstanceBuilder(env, StringValueCStr(first_argument));
1050
+ break;
1051
+ case T_SYMBOL:
1052
+ ib = CreateInstanceBuilder(env, rb_id2name(SYM2ID(first_argument)));
1053
+ break;
1054
+ default:
1055
+ rb_warn("First argument must be a Defclass; type wasn't a Defclass, a string, or a symbol; it was a %s!", rb_class2name(rb_obj_class(first_argument)));
1056
+ return Qnil;
1057
+ }
1058
+
1059
+ switch (IBError(env))
1060
+ {
1061
+ case IBE_NO_ERROR:
1062
+ break;
1063
+ case IBE_NULL_POINTER_ERROR:
1064
+ rb_warn("Could not make instance; null pointer error. This could be a bug in clipsruby!");
1065
+ IBDispose(ib);
1066
+ return Qnil;
1067
+ case IBE_DEFCLASS_NOT_FOUND_ERROR:
1068
+ IBDispose(ib);
1069
+ switch (TYPE(first_argument)) {
1070
+ case T_STRING:
1071
+ instance = MakeInstance(env, StringValueCStr(first_argument));
1072
+ break;
1073
+ case T_SYMBOL:
1074
+ instance = MakeInstance(env, rb_id2name(SYM2ID(first_argument)));
1075
+ break;
1076
+ default:
1077
+ instance = NULL;
1078
+ break;
1079
+ }
1080
+ if (instance == NULL) {
1081
+ rb_warn("Could not make instance; defclass not found, and first argument was not a valid make-instance string!");
1082
+ return Qnil;
1083
+ } else {
1084
+ rb_instance =
1085
+ TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
1086
+
1087
+ rb_iv_set(rb_instance, "@environment", rbEnvironment);
1088
+
1089
+ return rb_instance;
1090
+ }
1091
+ case IBE_COULD_NOT_CREATE_ERROR:
1092
+ rb_warn("Could not make instance; This could be a bug in clipsruby!");
1093
+ IBDispose(ib);
1094
+ return Qnil;
1095
+ case IBE_RULE_NETWORK_ERROR:
1096
+ rb_warn("Could not make instance; Rule network error!");
1097
+ IBDispose(ib);
1098
+ return Qnil;
1099
+ }
1100
+
1101
+ void *args[2] = { (void *)ib, (void *)env };
1102
+
1103
+ switch(TYPE(second_argument))
1104
+ {
1105
+ case T_STRING:
1106
+ case T_SYMBOL:
1107
+ instance_name = rb_id2name(SYM2ID(second_argument));
1108
+ break;
1109
+ case T_NIL:
1110
+ instance_name = NULL;
1111
+ break;
1112
+ case T_HASH:
1113
+ instance_name = NULL;
1114
+ rb_hash_foreach(second_argument, _clips_environment_make_instance, (VALUE)args);
1115
+ break;
1116
+ default:
1117
+ rb_warn("Could not make instance; second argument must be the name of the new instance or the slot hash!");
1118
+ IBDispose(ib);
1119
+ return Qnil;
1120
+ }
1121
+
1122
+ switch(TYPE(third_argument))
1123
+ {
1124
+ case T_NIL:
1125
+ break;
1126
+ case T_HASH:
1127
+ rb_hash_foreach(third_argument, _clips_environment_make_instance, (VALUE)args);
1128
+ break;
1129
+ default:
1130
+ rb_warn("Could not make instance; third argument must be nil or the slot hash!");
1131
+ IBDispose(ib);
1132
+ return Qnil;
1133
+ }
1134
+
1135
+ if ((instance = IBMake(ib, instance_name)) == NULL)
1136
+ {
1137
+ switch (IBError(env))
1138
+ {
1139
+ case IBE_NO_ERROR:
1140
+ break;
1141
+ case IBE_NULL_POINTER_ERROR:
1142
+ rb_warn("Could not make instance; null pointer error. This could be a bug in clipsruby!");
1143
+ IBDispose(ib);
1144
+ return Qnil;
1145
+ case IBE_DEFCLASS_NOT_FOUND_ERROR:
1146
+ rb_warn("Could not make instance; defclass not found!");
1147
+ IBDispose(ib);
1148
+ return Qnil;
1149
+ case IBE_COULD_NOT_CREATE_ERROR:
1150
+ rb_warn("Could not make instance; This could be a bug in clipsruby!");
1151
+ IBDispose(ib);
1152
+ return Qnil;
1153
+ case IBE_RULE_NETWORK_ERROR:
1154
+ rb_warn("Could not make instance; Rule network error!");
1155
+ IBDispose(ib);
1156
+ return Qnil;
1157
+ }
1158
+ }
1159
+
1160
+ IBDispose(ib);
1161
+
1162
+ rb_instance =
1163
+ TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Instance")), &Instance_type, instance);
1164
+
1165
+ rb_iv_set(rb_instance, "@environment", rbEnvironment);
1166
+
1167
+ return rb_instance;
1168
+ }
1169
+
872
1170
  static VALUE clips_environment_deftemplate_assert_hash(VALUE self, VALUE hash)
873
1171
  {
874
1172
  const char *cdeftemplate_name;
@@ -1686,6 +1984,74 @@ static VALUE clips_environment_static_load_facts(VALUE self, VALUE rbEnvironment
1686
1984
  return clips_environment_load_facts(rbEnvironment, path);
1687
1985
  }
1688
1986
 
1987
+ static VALUE clips_environment_save_instances(int argc, VALUE *argv, VALUE rbEnvironment) {
1988
+ VALUE path, scope;
1989
+ Environment *env;
1990
+
1991
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
1992
+
1993
+ rb_scan_args(argc, argv, "11", &path, &scope);
1994
+ if (NIL_P(scope)) {
1995
+ scope = ID2SYM(rb_intern("local"));
1996
+ }
1997
+
1998
+ int number_of_instances_saved;
1999
+
2000
+ if (scope == ID2SYM(rb_intern("visible"))) {
2001
+ number_of_instances_saved = SaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
2002
+ } else if (scope == ID2SYM(rb_intern("local"))) {
2003
+ number_of_instances_saved = SaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
2004
+ } else {
2005
+ rb_warn("could not save_instances: unsupported scope.");
2006
+ return Qnil;
2007
+ }
2008
+ return INT2NUM(number_of_instances_saved);
2009
+ }
2010
+
2011
+ static VALUE clips_environment_static_save_instances(int argc, VALUE *argv, VALUE klass) {
2012
+ VALUE rbEnvironment, path, scope;
2013
+ Environment *env;
2014
+
2015
+ rb_scan_args(argc, argv, "21", &rbEnvironment, &path, &scope);
2016
+
2017
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2018
+
2019
+ if (NIL_P(scope)) {
2020
+ scope = ID2SYM(rb_intern("local"));
2021
+ }
2022
+
2023
+ int number_of_instances_saved;
2024
+
2025
+ if (scope == ID2SYM(rb_intern("visible"))) {
2026
+ number_of_instances_saved = SaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
2027
+ } else if (scope == ID2SYM(rb_intern("local"))) {
2028
+ number_of_instances_saved = SaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
2029
+ } else {
2030
+ rb_warn("could not save_instances: unsupported scope.");
2031
+ return Qnil;
2032
+ }
2033
+ return INT2NUM(number_of_instances_saved);
2034
+ }
2035
+
2036
+ static VALUE clips_environment_load_instances(VALUE self, VALUE path)
2037
+ {
2038
+ Environment *env;
2039
+
2040
+ TypedData_Get_Struct(self, Environment, &Environment_type, env);
2041
+ int number_of_instances_loaded = LoadInstances(env, StringValueCStr(path));
2042
+
2043
+ if (number_of_instances_loaded == -1) {
2044
+ return Qnil;
2045
+ } else {
2046
+ return INT2NUM(number_of_instances_loaded);
2047
+ }
2048
+ }
2049
+
2050
+ static VALUE clips_environment_static_load_instances(VALUE self, VALUE rbEnvironment, VALUE path)
2051
+ {
2052
+ return clips_environment_load_instances(rbEnvironment, path);
2053
+ }
2054
+
1689
2055
  static VALUE clips_environment_bsave(VALUE self, VALUE path)
1690
2056
  {
1691
2057
  Environment *env;
@@ -1791,6 +2157,76 @@ static VALUE clips_environment_static_bload_facts(VALUE self, VALUE rbEnvironmen
1791
2157
  return clips_environment_bload_facts(rbEnvironment, path);
1792
2158
  }
1793
2159
 
2160
+ static VALUE clips_environment_bsave_instances(int argc, VALUE *argv, VALUE rbEnvironment) {
2161
+ VALUE path, scope;
2162
+ Environment *env;
2163
+
2164
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2165
+
2166
+ rb_scan_args(argc, argv, "11", &path, &scope);
2167
+ if (NIL_P(scope)) {
2168
+ scope = ID2SYM(rb_intern("local"));
2169
+ }
2170
+
2171
+ int number_of_instances_saved;
2172
+
2173
+ if (scope == ID2SYM(rb_intern("visible"))) {
2174
+ number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
2175
+ } else if (scope == ID2SYM(rb_intern("local"))) {
2176
+ number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
2177
+ } else {
2178
+ rb_warn("could not bsave_instances: unsupported scope.");
2179
+ return Qnil;
2180
+ }
2181
+
2182
+ return INT2NUM(number_of_instances_saved);
2183
+ }
2184
+
2185
+ static VALUE clips_environment_static_bsave_instances(int argc, VALUE *argv, VALUE klass) {
2186
+ VALUE rbEnvironment, path, scope;
2187
+ Environment *env;
2188
+
2189
+ rb_scan_args(argc, argv, "21", &rbEnvironment, &path, &scope);
2190
+
2191
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2192
+
2193
+ if (NIL_P(scope)) {
2194
+ scope = ID2SYM(rb_intern("local"));
2195
+ }
2196
+
2197
+ int number_of_instances_saved;
2198
+
2199
+ if (scope == ID2SYM(rb_intern("visible"))) {
2200
+ number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), VISIBLE_SAVE);
2201
+ } else if (scope == ID2SYM(rb_intern("local"))) {
2202
+ number_of_instances_saved = BinarySaveInstances(env, StringValueCStr(path), LOCAL_SAVE);
2203
+ } else {
2204
+ rb_warn("could not bsave_instances: unsupported scope.");
2205
+ return Qnil;
2206
+ }
2207
+ return INT2NUM(number_of_instances_saved);
2208
+ }
2209
+
2210
+ static VALUE clips_environment_bload_instances(VALUE self, VALUE path)
2211
+ {
2212
+ Environment *env;
2213
+
2214
+ TypedData_Get_Struct(self, Environment, &Environment_type, env);
2215
+ int number_of_instances_loaded = BinaryLoadInstances(env, StringValueCStr(path));
2216
+
2217
+ if (number_of_instances_loaded == -1) {
2218
+ return Qnil;
2219
+ } else {
2220
+ return INT2NUM(number_of_instances_loaded);
2221
+ }
2222
+ }
2223
+
2224
+ static VALUE clips_environment_static_bload_instances(VALUE self, VALUE rbEnvironment, VALUE path)
2225
+ {
2226
+ return clips_environment_bload_instances(rbEnvironment, path);
2227
+ }
2228
+
2229
+
1794
2230
  static VALUE clips_environment_fact_slot_names(VALUE self)
1795
2231
  {
1796
2232
  Fact *fact;
@@ -4275,6 +4711,10 @@ void Init_clipsruby(void)
4275
4711
  rb_define_method(rbEnvironment, "save_facts", clips_environment_save_facts, -1);
4276
4712
  rb_define_singleton_method(rbEnvironment, "load_facts", clips_environment_static_load_facts, 2);
4277
4713
  rb_define_method(rbEnvironment, "load_facts", clips_environment_load_facts, 1);
4714
+ rb_define_singleton_method(rbEnvironment, "save_instances", clips_environment_static_save_instances, -1);
4715
+ rb_define_method(rbEnvironment, "save_instances", clips_environment_save_instances, -1);
4716
+ rb_define_singleton_method(rbEnvironment, "load_instances", clips_environment_static_load_instances, 2);
4717
+ rb_define_method(rbEnvironment, "load_instances", clips_environment_load_instances, 1);
4278
4718
  rb_define_singleton_method(rbEnvironment, "bsave", clips_environment_static_bsave, 2);
4279
4719
  rb_define_method(rbEnvironment, "bsave", clips_environment_bsave, 1);
4280
4720
  rb_define_singleton_method(rbEnvironment, "bload", clips_environment_static_bload, 2);
@@ -4283,6 +4723,10 @@ void Init_clipsruby(void)
4283
4723
  rb_define_method(rbEnvironment, "bsave_facts", clips_environment_bsave_facts, -1);
4284
4724
  rb_define_singleton_method(rbEnvironment, "bload_facts", clips_environment_static_bload_facts, 2);
4285
4725
  rb_define_method(rbEnvironment, "bload_facts", clips_environment_bload_facts, 1);
4726
+ rb_define_singleton_method(rbEnvironment, "bsave_instances", clips_environment_static_bsave_instances, -1);
4727
+ rb_define_method(rbEnvironment, "bsave_instances", clips_environment_bsave_instances, -1);
4728
+ rb_define_singleton_method(rbEnvironment, "bload_instances", clips_environment_static_bload_instances, 2);
4729
+ rb_define_method(rbEnvironment, "bload_instances", clips_environment_bload_instances, 1);
4286
4730
  rb_define_singleton_method(rbEnvironment, "find_defrule", clips_environment_static_find_defrule, 2);
4287
4731
  rb_define_method(rbEnvironment, "find_defrule", clips_environment_find_defrule, 1);
4288
4732
  rb_define_singleton_method(rbEnvironment, "find_defmodule", clips_environment_static_find_defmodule, 2);
@@ -4377,8 +4821,8 @@ void Init_clipsruby(void)
4377
4821
  rb_define_method(rbEnvironment, "unwatch_focus", clips_environment_unwatch_focus, 0);
4378
4822
  rb_define_singleton_method(rbEnvironment, "get_watch_state", clips_environment_static_get_watch_state, 2);
4379
4823
  rb_define_method(rbEnvironment, "get_watch_state", clips_environment_get_watch_state, 1);
4380
- rb_define_singleton_method(rbEnvironment, "make_instance", clips_environment_static_make_instance, 2);
4381
- rb_define_method(rbEnvironment, "make_instance", clips_environment_make_instance, 1);
4824
+ rb_define_singleton_method(rbEnvironment, "make_instance", clips_environment_static_make_instance, -1);
4825
+ rb_define_method(rbEnvironment, "make_instance", clips_environment_make_instance, -1);
4382
4826
 
4383
4827
  VALUE rbDeffacts = rb_define_class_under(rbEnvironment, "Deffacts", rb_cObject);
4384
4828
  rb_define_alloc_func(rbDeffacts, deffacts_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.40
4
+ version: 0.0.42
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-30 00:00:00.000000000 Z
11
+ date: 2024-10-08 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