clipsruby 0.0.32 → 0.0.34

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 +126 -0
  3. data/ext/clipsruby/clipsruby.c +381 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d63c4466f611752b18eac8e195f3614784dd64b80ac007457fb550bc88847ee5
4
- data.tar.gz: 353a3eb4fe11406b0b2b704a669b1933b0a3ec4c6c10c4b288cd0bf7b5a1fe58
3
+ metadata.gz: 5d62cc0e5ccc41bfc4e88590c7a3873859271163fa5dd73b416c0cf2d61b7ed1
4
+ data.tar.gz: d3cd61d58609c516b8c952dbc32393d54251f09bdc3a8a5f15f531cdf2d707ee
5
5
  SHA512:
6
- metadata.gz: 88e76e4afa90cf21db3718ed033a2463c8f38f5f9c17d3e643b901d4f9d83b36ec0c8d904d311db96cdaf6935b9694982508eebb5326c1eb43977c80660b40d5
7
- data.tar.gz: 48665d09ede14f7707abaf1ad38c8202c12ee0fe655402d257399379e074e367b2bd18b3e3bec704bc5cfdfb280286890f325360384eb5e1d2a93d5ae3c57b0e
6
+ metadata.gz: c6473260b0da57bb78894841385c6cc1b4ecddb4448dc80edf7c0542e654b8dca6884efdc37b9be976d6b0bed22fadd24da5313ef8ba59b5cd71639a18cd2f42
7
+ data.tar.gz: 90af7d185f0ca31b1d543e0550cf4520d021525225e3bba8087d5f449591ffe40fa6a34380293b689876ec9d84dc9b3d8860c18b50b525610b3ca890ff727c5a
data/README.md CHANGED
@@ -155,6 +155,16 @@ fact = CLIPS::Environment.assert_hash(env, :my_deftemplate, a: 1, b: "asdf", c:
155
155
  fact2 = env.assert_hash(:my_deftemplate, d: 4.5, e: :asdf)
156
156
  ```
157
157
 
158
+ ### `CLIPS::Environment.make_instance`
159
+ ### `CLIPS::Environment#make_instance`
160
+
161
+ Make a string as an Instance in the CLIPS environment.
162
+
163
+ ```ruby
164
+ instance = CLIPS::Environment.make_instance(env, "(of USER)")
165
+ instance2 = env.make_instance("(of USER)")
166
+ ```
167
+
158
168
  ### `CLIPS::Environment.find_fact`
159
169
  ### `CLIPS::Environment#find_fact`
160
170
 
@@ -404,6 +414,86 @@ CLIPS::Environment::Fact.modify(fact, bar: 123)
404
414
  fact.modify(foo: "my new foo!")
405
415
  ```
406
416
 
417
+ ### `CLIPS::Environment::Instance.unmake`
418
+ ### `CLIPS::Environment::Instance#unmake`
419
+
420
+ Unmakes an instance in the environment, deleting it.
421
+
422
+ ```ruby
423
+ CLIPS::Environment::Instance.unmake(instance)
424
+ instance.unmake
425
+ ```
426
+
427
+ ### `CLIPS::Environment::Instance.delete`
428
+ ### `CLIPS::Environment::Instance#delete`
429
+
430
+ Deletes an instance in the environment.
431
+
432
+ ```ruby
433
+ CLIPS::Environment::Instance.delete(instance)
434
+ instance.delete
435
+ ```
436
+
437
+ ### `CLIPS::Environment::Instance.name`
438
+ ### `CLIPS::Environment::Instance#name`
439
+
440
+ Returns the name of an Instance as a symbol
441
+
442
+ ```ruby
443
+ CLIPS::Environment::Instance.name(instance)
444
+ instance.name
445
+ ```
446
+
447
+ ### `CLIPS::Environment::Instance.pp_form`
448
+ ### `CLIPS::Environment::Instance#pp_form`
449
+
450
+ Returns a pretty printed string representation of an Instance
451
+
452
+ ```ruby
453
+ CLIPS::Environment::Instance.pp_form(instance)
454
+ instance.pp_form
455
+ ```
456
+
457
+ ### `CLIPS::Environment::Instance._class`
458
+ ### `CLIPS::Environment::Instance#_class`
459
+
460
+ Returns the Defclass of an Instance
461
+
462
+ ```ruby
463
+ CLIPS::Environment::Instance._class(instance)
464
+ instance._class
465
+ ```
466
+
467
+ ### `CLIPS::Environment::Defclass.name`
468
+ ### `CLIPS::Environment::Defclass#name`
469
+
470
+ Returns the name of an Defclass as a symbol
471
+
472
+ ```ruby
473
+ CLIPS::Environment::Defclass.name(defclass)
474
+ defclass.name
475
+ ```
476
+
477
+ ### `CLIPS::Environment::Defclass.pp_form`
478
+ ### `CLIPS::Environment::Defclass#pp_form`
479
+
480
+ Returns a pretty printed string representation of an Defclass
481
+
482
+ ```ruby
483
+ CLIPS::Environment::Defclass.pp_form(defclass)
484
+ defclass.pp_form
485
+ ```
486
+
487
+ ### `CLIPS::Environment::Defclass.defmodule_name`
488
+ ### `CLIPS::Environment::Defclass#defmodule_name`
489
+
490
+ Returns the name of the defmodule in which the defclass is defined
491
+
492
+ ```ruby
493
+ CLIPS::Environment::Defclass.defmodule_name(defclass)
494
+ defclass.defmodule_name
495
+ ```
496
+
407
497
  ### `CLIPS::Environment.find_defrule`
408
498
  ### `CLIPS::Environment#find_defrule`
409
499
 
@@ -544,6 +634,22 @@ CLIPS::Environment::Defmodule.get_fact_list(defmodule)
544
634
  defmodule.get_fact_list
545
635
  ```
546
636
 
637
+ ### `CLIPS::Environment.get_defclass_list`
638
+ ### `CLIPS::Environment#get_defclass_list`
639
+
640
+ Return an array of Defclass names as symbols in the environment. Pass an argument of a
641
+ symbol, string, or Defmodule object in order to only get Defclasss
642
+ in that Defmodule. If you do not, it will return all Defclass names in all modules.
643
+
644
+ ```ruby
645
+ CLIPS::Environment.get_defclass_list(env)
646
+ env.get_defclass_list
647
+ CLIPS::Environment.get_defclass_list(env, :MAIN)
648
+ env.get_defclass_list(:MAIN)
649
+ CLIPS::Environment.get_defclass_list(env, defmodule)
650
+ env.get_defclass_list(defmodule)
651
+ ```
652
+
547
653
  ### `CLIPS::Environment.get_deftemplate_list`
548
654
  ### `CLIPS::Environment#get_deftemplate_list`
549
655
 
@@ -596,6 +702,16 @@ CLIPS::Environment.find_deftemplate(:a)
596
702
  env.find_deftemplate("foo")
597
703
  ```
598
704
 
705
+ ### `CLIPS::Environment.find_defclass`
706
+ ### `CLIPS::Environment#find_defclass`
707
+
708
+ Finds a defclass by name and returns a CLIPS::Environment::Defclass object
709
+
710
+ ```ruby
711
+ CLIPS::Environment.find_defclass(:a)
712
+ env.find_defclass("foo")
713
+ ```
714
+
599
715
  ### `CLIPS::Environment::Deftemplate.name`
600
716
  ### `CLIPS::Environment::Deftemplate#name`
601
717
 
@@ -784,6 +900,16 @@ CLIPS::Environment::Deftemplate.slot_defaultp(deftemplate, :foo)
784
900
  deftemplate.slot_defaultp('bar')
785
901
  ```
786
902
 
903
+ ### `CLIPS::Environment::Defmodule.get_defclass_list`
904
+ ### `CLIPS::Environment::Defmodule#get_defclass_list`
905
+
906
+ Return an array of Defclass names as symbols in the Defmodule
907
+
908
+ ```ruby
909
+ CLIPS::Environment::Defmodule.get_defclass_list(defmodule)
910
+ defmodule.get_defclass_list
911
+ ```
912
+
787
913
  ### `CLIPS::Environment::Defmodule.get_deftemplate_list`
788
914
  ### `CLIPS::Environment::Defmodule#get_deftemplate_list`
789
915
 
@@ -37,7 +37,6 @@ static const rb_data_type_t Defmodule_type = {
37
37
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
38
38
  };
39
39
 
40
-
41
40
  size_t defrule_size(const void *data)
42
41
  {
43
42
  return sizeof(Defrule);
@@ -50,6 +49,18 @@ static const rb_data_type_t Defrule_type = {
50
49
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
51
50
  };
52
51
 
52
+ size_t defclass_size(const void *data)
53
+ {
54
+ return sizeof(Defclass);
55
+ }
56
+
57
+ static const rb_data_type_t Defclass_type = {
58
+ .function = {
59
+ .dsize = defclass_size
60
+ },
61
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
62
+ };
63
+
53
64
  size_t fact_size(const void *data)
54
65
  {
55
66
  return sizeof(Fact);
@@ -62,6 +73,18 @@ static const rb_data_type_t Fact_type = {
62
73
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
63
74
  };
64
75
 
76
+ size_t instance_size(const void *data)
77
+ {
78
+ return sizeof(Instance);
79
+ }
80
+
81
+ static const rb_data_type_t Instance_type = {
82
+ .function = {
83
+ .dsize = instance_size
84
+ },
85
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
86
+ };
87
+
65
88
  static VALUE clips_environment_fact_deftemplate(VALUE self)
66
89
  {
67
90
  VALUE rbDeftemplate, rbEnvironment;
@@ -173,6 +196,11 @@ VALUE deftemplate_alloc(VALUE self)
173
196
  return TypedData_Wrap_Struct(self, &Deftemplate_type, NULL);
174
197
  }
175
198
 
199
+ VALUE defclass_alloc(VALUE self)
200
+ {
201
+ return TypedData_Wrap_Struct(self, &Defclass_type, NULL);
202
+ }
203
+
176
204
  VALUE defrule_alloc(VALUE self)
177
205
  {
178
206
  return TypedData_Wrap_Struct(self, &Defrule_type, NULL);
@@ -183,6 +211,11 @@ VALUE fact_alloc(VALUE self)
183
211
  return TypedData_Wrap_Struct(self, &Fact_type, NULL);
184
212
  }
185
213
 
214
+ VALUE instance_alloc(VALUE self)
215
+ {
216
+ return TypedData_Wrap_Struct(self, &Instance_type, NULL);
217
+ }
218
+
186
219
  VALUE environment_alloc(VALUE self)
187
220
  {
188
221
  return TypedData_Wrap_Struct(self, &Environment_type, CreateEnvironment());
@@ -218,6 +251,199 @@ static VALUE clips_environment_static_assert_string(VALUE self, VALUE rbEnvironm
218
251
  return clips_environment_assert_string(rbEnvironment, string);
219
252
  }
220
253
 
254
+ static VALUE clips_environment_defclass_name(VALUE self)
255
+ {
256
+ Defclass *defclass;
257
+
258
+ TypedData_Get_Struct(self, Defclass, &Defclass_type, defclass);
259
+
260
+ return ID2SYM(rb_intern(DefclassName(defclass)));
261
+ }
262
+
263
+ static VALUE clips_environment_defclass_static_name(VALUE self, VALUE rbDefclass)
264
+ {
265
+ return clips_environment_defclass_name(rbDefclass);
266
+ }
267
+
268
+ static VALUE clips_environment_defclass_defmodule_name(VALUE self)
269
+ {
270
+ Defclass *defclass;
271
+
272
+ TypedData_Get_Struct(self, Defclass, &Defclass_type, defclass);
273
+
274
+ return ID2SYM(rb_intern(DefclassModule(defclass)));
275
+ }
276
+
277
+ static VALUE clips_environment_defclass_static_defmodule_name(VALUE self, VALUE rbDefclass)
278
+ {
279
+ return clips_environment_defclass_defmodule_name(rbDefclass);
280
+ }
281
+
282
+ static VALUE clips_environment_defclass_pp_form(VALUE self)
283
+ {
284
+ Defclass *defclass;
285
+
286
+ TypedData_Get_Struct(self, Defclass, &Defclass_type, defclass);
287
+
288
+ return rb_str_new2(DefclassPPForm(defclass));
289
+ }
290
+
291
+ static VALUE clips_environment_defclass_static_pp_form(VALUE self, VALUE rbDefclass)
292
+ {
293
+ return clips_environment_defclass_pp_form(rbDefclass);
294
+ }
295
+
296
+ static VALUE clips_environment_make_instance(VALUE self, VALUE string)
297
+ {
298
+ Environment *env;
299
+
300
+ TypedData_Get_Struct(self, Environment, &Environment_type, env);
301
+
302
+ Instance *instance = MakeInstance(env, StringValueCStr(string));
303
+
304
+ if (instance == NULL) {
305
+ return Qnil;
306
+ }
307
+
308
+ VALUE rb_instance =
309
+ TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Instance")), &Instance_type, instance);
310
+
311
+ rb_iv_set(rb_instance, "@environment", self);
312
+
313
+ return rb_instance;
314
+ }
315
+
316
+ static VALUE clips_environment_static_make_instance(VALUE self, VALUE rbEnvironment, VALUE string)
317
+ {
318
+ return clips_environment_make_instance(rbEnvironment, string);
319
+ }
320
+
321
+ static VALUE clips_environment_instance_unmake(VALUE self)
322
+ {
323
+ Instance *instance;
324
+
325
+ TypedData_Get_Struct(self, Instance, &Instance_type, instance);
326
+
327
+ switch (UnmakeInstance(instance)) {
328
+ case UIE_NO_ERROR:
329
+ break;
330
+ case UIE_NULL_POINTER_ERROR:
331
+ rb_warn("could not unmake instance; null pointer error. This could be a bug in clipsruby!");
332
+ return Qfalse;
333
+ case UIE_COULD_NOT_DELETE_ERROR:
334
+ rb_warn("could not unmake instance! is pattern matching currently happening with this instance?");
335
+ return Qfalse;
336
+ case UIE_DELETED_ERROR:
337
+ rb_warn("could not unmake instance! instance is already deleted");
338
+ return Qfalse;
339
+ case UIE_RULE_NETWORK_ERROR:
340
+ rb_warn("could not unmake instance! An error occurs while the unmaking was being processed in the rule network");
341
+ return Qfalse;
342
+ }
343
+
344
+ return Qtrue;
345
+ }
346
+
347
+ static VALUE clips_environment_instance_static_unmake(VALUE self, VALUE rbInstance)
348
+ {
349
+ return clips_environment_instance_unmake(rbInstance);
350
+ }
351
+
352
+ static VALUE clips_environment_instance_delete(VALUE self)
353
+ {
354
+ Instance *instance;
355
+
356
+ TypedData_Get_Struct(self, Instance, &Instance_type, instance);
357
+
358
+ switch (DeleteInstance(instance)) {
359
+ case UIE_NO_ERROR:
360
+ break;
361
+ case UIE_NULL_POINTER_ERROR:
362
+ rb_warn("could not delete instance; null pointer error. This could be a bug in clipsruby!");
363
+ return Qfalse;
364
+ case UIE_COULD_NOT_DELETE_ERROR:
365
+ rb_warn("could not delete instance! is pattern matching currently happening with this instance?");
366
+ return Qfalse;
367
+ case UIE_DELETED_ERROR:
368
+ rb_warn("could not delete instance! instance is already deleted");
369
+ return Qfalse;
370
+ case UIE_RULE_NETWORK_ERROR:
371
+ rb_warn("could not delete instance! An error occurs while the unmaking was being processed in the rule network");
372
+ return Qfalse;
373
+ }
374
+
375
+ return Qtrue;
376
+ }
377
+
378
+ static VALUE clips_environment_instance_static_delete(VALUE self, VALUE rbInstance)
379
+ {
380
+ return clips_environment_instance_delete(rbInstance);
381
+ }
382
+
383
+ static VALUE clips_environment_instance_class(VALUE self)
384
+ {
385
+ Defclass *defclass;
386
+ Instance *instance;
387
+ VALUE rbEnvironment, rb_defclass;
388
+
389
+ rbEnvironment = rb_iv_get(self, "@environment");
390
+
391
+ TypedData_Get_Struct(self, Instance, &Instance_type, instance);
392
+
393
+ defclass = InstanceClass(instance);
394
+
395
+ rb_defclass =
396
+ TypedData_Wrap_Struct(rb_const_get(rb_obj_class(rbEnvironment), rb_intern("Defclass")), &Defclass_type, defclass);
397
+
398
+ rb_iv_set(rb_defclass, "@environment", rbEnvironment);
399
+
400
+ return rb_defclass;
401
+ }
402
+
403
+ static VALUE clips_environment_instance_static_class(VALUE self, VALUE rbInstance)
404
+ {
405
+ return clips_environment_instance_class(rbInstance);
406
+ }
407
+
408
+ static VALUE clips_environment_instance_name(VALUE self)
409
+ {
410
+ Instance *instance;
411
+
412
+ TypedData_Get_Struct(self, Instance, &Instance_type, instance);
413
+
414
+ return ID2SYM(rb_intern(InstanceName(instance)));
415
+ }
416
+
417
+ static VALUE clips_environment_instance_static_name(VALUE self, VALUE rbInstance)
418
+ {
419
+ return clips_environment_instance_name(rbInstance);
420
+ }
421
+
422
+ static VALUE clips_environment_instance_pp_form(VALUE self)
423
+ {
424
+ Environment *env;
425
+ Instance *instance;
426
+ StringBuilder *sb;
427
+ VALUE toReturn;
428
+
429
+ VALUE rbEnvironment = rb_iv_get(self, "@environment");
430
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
431
+ sb = CreateStringBuilder(env, 0);
432
+
433
+ TypedData_Get_Struct(self, Instance, &Instance_type, instance);
434
+
435
+ InstancePPForm(instance, sb);
436
+ toReturn = rb_str_new2(sb->contents);
437
+ SBDispose(sb);
438
+
439
+ return toReturn;
440
+ }
441
+
442
+ static VALUE clips_environment_instance_static_pp_form(VALUE self, VALUE rbInstance)
443
+ {
444
+ return clips_environment_instance_pp_form(rbInstance);
445
+ }
446
+
221
447
  static VALUE clips_environment_build(VALUE self, VALUE string)
222
448
  {
223
449
  Environment *env;
@@ -1733,6 +1959,40 @@ static VALUE clips_environment_static_find_deftemplate(VALUE self, VALUE rbEnvir
1733
1959
  return clips_environment_find_deftemplate(rbEnvironment, deftemplate_name);
1734
1960
  }
1735
1961
 
1962
+ static VALUE clips_environment_find_defclass(VALUE self, VALUE defclass_name)
1963
+ {
1964
+ Environment *env;
1965
+ Defclass *class;
1966
+
1967
+ TypedData_Get_Struct(self, Environment, &Environment_type, env);
1968
+
1969
+ switch (TYPE(defclass_name)) {
1970
+ case T_STRING:
1971
+ class = FindDefclass(env, StringValueCStr(defclass_name));
1972
+ break;
1973
+ case T_SYMBOL:
1974
+ class = FindDefclass(env, rb_id2name(SYM2ID(defclass_name)));
1975
+ break;
1976
+ default:
1977
+ rb_warn("defclass name must be a symbol or string");
1978
+ return Qnil;
1979
+ }
1980
+
1981
+ if (class == NULL) {
1982
+ return Qnil;
1983
+ } else {
1984
+ VALUE rbDefclass;
1985
+ rbDefclass = TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Defclass")), &Defclass_type, class);
1986
+ rb_iv_set(rbDefclass, "@environment", self);
1987
+ return rbDefclass;
1988
+ }
1989
+ }
1990
+
1991
+ static VALUE clips_environment_static_find_defclass(VALUE self, VALUE rbEnvironment, VALUE defclass_name)
1992
+ {
1993
+ return clips_environment_find_defclass(rbEnvironment, defclass_name);
1994
+ }
1995
+
1736
1996
  static VALUE clips_environment_deftemplate_name(VALUE self)
1737
1997
  {
1738
1998
  Deftemplate *deftemplate;
@@ -1967,6 +2227,74 @@ static VALUE clips_environment_static_get_deftemplate_list(int argc, VALUE *argv
1967
2227
  return out;
1968
2228
  }
1969
2229
 
2230
+ static VALUE clips_environment_get_defclass_list(int argc, VALUE *argv, VALUE rbEnvironment) {
2231
+ VALUE defmodule_or_defmodule_name;
2232
+ Environment *env;
2233
+ Defmodule *module;
2234
+ CLIPSValue value;
2235
+ VALUE out;
2236
+
2237
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2238
+
2239
+ rb_scan_args(argc, argv, "01", &defmodule_or_defmodule_name);
2240
+ switch (TYPE(defmodule_or_defmodule_name)) {
2241
+ case T_NIL:
2242
+ module = NULL;
2243
+ break;
2244
+ case T_STRING:
2245
+ case T_SYMBOL:
2246
+ TypedData_Get_Struct(
2247
+ clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
2248
+ Defmodule, &Defmodule_type, module);
2249
+ break;
2250
+ case T_DATA:
2251
+ TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
2252
+ break;
2253
+ default:
2254
+ rb_warn("defmodule name must be a symbol or string");
2255
+ return Qnil;
2256
+ }
2257
+ GetDefclassList(env, &value, module);
2258
+
2259
+ CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
2260
+
2261
+ return out;
2262
+ }
2263
+
2264
+ static VALUE clips_environment_static_get_defclass_list(int argc, VALUE *argv, VALUE klass) {
2265
+ VALUE rbEnvironment, defmodule_or_defmodule_name;
2266
+ Environment *env;
2267
+ Defmodule *module;
2268
+ CLIPSValue value;
2269
+ VALUE out;
2270
+
2271
+ rb_scan_args(argc, argv, "11", &rbEnvironment, &defmodule_or_defmodule_name);
2272
+
2273
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2274
+ switch (TYPE(defmodule_or_defmodule_name)) {
2275
+ case T_NIL:
2276
+ module = NULL;
2277
+ break;
2278
+ case T_STRING:
2279
+ case T_SYMBOL:
2280
+ TypedData_Get_Struct(
2281
+ clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
2282
+ Defmodule, &Defmodule_type, module);
2283
+ break;
2284
+ case T_DATA:
2285
+ TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
2286
+ break;
2287
+ default:
2288
+ rb_warn("defmodule name must be a symbol or string");
2289
+ return Qnil;
2290
+ }
2291
+ GetDefclassList(env, &value, module);
2292
+
2293
+ CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
2294
+
2295
+ return out;
2296
+ }
2297
+
1970
2298
  static VALUE clips_environment_get_defrule_list(int argc, VALUE *argv, VALUE rbEnvironment) {
1971
2299
  VALUE defmodule_or_defmodule_name;
1972
2300
  Environment *env;
@@ -2107,6 +2435,30 @@ static VALUE clips_environment_defmodule_static_get_fact_list(VALUE self, VALUE
2107
2435
  return clips_environment_defmodule_get_fact_list(rbDefmodule);
2108
2436
  }
2109
2437
 
2438
+ static VALUE clips_environment_defmodule_get_defclass_list(VALUE self)
2439
+ {
2440
+ Defmodule *module;
2441
+ Environment *env;
2442
+ CLIPSValue value;
2443
+ VALUE out;
2444
+
2445
+ VALUE rbEnvironment = rb_iv_get(self, "@environment");
2446
+
2447
+ TypedData_Get_Struct(self, Defmodule, &Defmodule_type, module);
2448
+ TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
2449
+
2450
+ GetDefclassList(env, &value, module);
2451
+
2452
+ CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
2453
+
2454
+ return out;
2455
+ }
2456
+
2457
+ static VALUE clips_environment_defmodule_static_get_defclass_list(VALUE self, VALUE rbDefmodule)
2458
+ {
2459
+ return clips_environment_defmodule_get_defclass_list(rbDefmodule);
2460
+ }
2461
+
2110
2462
  static VALUE clips_environment_defmodule_get_deftemplate_list(VALUE self)
2111
2463
  {
2112
2464
  Defmodule *module;
@@ -3152,6 +3504,8 @@ void Init_clipsruby(void)
3152
3504
  rb_define_method(rbEnvironment, "find_defmodule", clips_environment_find_defmodule, 1);
3153
3505
  rb_define_singleton_method(rbEnvironment, "find_deftemplate", clips_environment_static_find_deftemplate, 2);
3154
3506
  rb_define_method(rbEnvironment, "find_deftemplate", clips_environment_find_deftemplate, 1);
3507
+ rb_define_singleton_method(rbEnvironment, "find_defclass", clips_environment_static_find_defclass, 2);
3508
+ rb_define_method(rbEnvironment, "find_defclass", clips_environment_find_defclass, 1);
3155
3509
  rb_define_singleton_method(rbEnvironment, "get_current_module", clips_environment_static_get_current_module, 1);
3156
3510
  rb_define_method(rbEnvironment, "get_current_module", clips_environment_get_current_module, 0);
3157
3511
  rb_define_singleton_method(rbEnvironment, "set_current_module", clips_environment_static_set_current_module, 2);
@@ -3160,6 +3514,8 @@ void Init_clipsruby(void)
3160
3514
  rb_define_method(rbEnvironment, "get_fact_list", clips_environment_get_fact_list, -1);
3161
3515
  rb_define_singleton_method(rbEnvironment, "get_deftemplate_list", clips_environment_static_get_deftemplate_list, -1);
3162
3516
  rb_define_method(rbEnvironment, "get_deftemplate_list", clips_environment_get_deftemplate_list, -1);
3517
+ rb_define_singleton_method(rbEnvironment, "get_defclass_list", clips_environment_static_get_defclass_list, -1);
3518
+ rb_define_method(rbEnvironment, "get_defclass_list", clips_environment_get_defclass_list, -1);
3163
3519
  rb_define_singleton_method(rbEnvironment, "get_defrule_list", clips_environment_static_get_defrule_list, -1);
3164
3520
  rb_define_method(rbEnvironment, "get_defrule_list", clips_environment_get_defrule_list, -1);
3165
3521
  rb_define_singleton_method(rbEnvironment, "get_defmodule_list", clips_environment_static_get_defmodule_list, 1);
@@ -3232,6 +3588,8 @@ void Init_clipsruby(void)
3232
3588
  rb_define_method(rbEnvironment, "unwatch_focus", clips_environment_unwatch_focus, 0);
3233
3589
  rb_define_singleton_method(rbEnvironment, "get_watch_state", clips_environment_static_get_watch_state, 2);
3234
3590
  rb_define_method(rbEnvironment, "get_watch_state", clips_environment_get_watch_state, 1);
3591
+ rb_define_singleton_method(rbEnvironment, "make_instance", clips_environment_static_make_instance, 2);
3592
+ rb_define_method(rbEnvironment, "make_instance", clips_environment_make_instance, 1);
3235
3593
 
3236
3594
  VALUE rbDeffacts = rb_define_class_under(rbEnvironment, "Deffacts", rb_cObject);
3237
3595
  rb_define_alloc_func(rbDeffacts, deffacts_alloc);
@@ -3283,6 +3641,8 @@ void Init_clipsruby(void)
3283
3641
  rb_define_method(rbDefmodule, "pp_form", clips_environment_defmodule_pp_form, 0);
3284
3642
  rb_define_singleton_method(rbDefmodule, "set_current", clips_environment_defmodule_static_set_current, 1);
3285
3643
  rb_define_method(rbDefmodule, "set_current", clips_environment_defmodule_set_current, 0);
3644
+ rb_define_singleton_method(rbDefmodule, "get_defclass_list", clips_environment_defmodule_static_get_defclass_list, 1);
3645
+ rb_define_method(rbDefmodule, "get_defclass_list", clips_environment_defmodule_get_defclass_list, 0);
3286
3646
  rb_define_singleton_method(rbDefmodule, "get_fact_list", clips_environment_defmodule_static_get_fact_list, 1);
3287
3647
  rb_define_method(rbDefmodule, "get_fact_list", clips_environment_defmodule_get_fact_list, 0);
3288
3648
  rb_define_singleton_method(rbDefmodule, "get_deftemplate_list", clips_environment_defmodule_static_get_deftemplate_list, 1);
@@ -3332,5 +3692,25 @@ void Init_clipsruby(void)
3332
3692
  rb_define_singleton_method(rbDefrule, "defmodule_name", clips_environment_defrule_static_defmodule_name, 1);
3333
3693
  rb_define_method(rbDefrule, "defmodule_name", clips_environment_defrule_defmodule_name, 0);
3334
3694
 
3695
+ VALUE rbDefclass = rb_define_class_under(rbEnvironment, "Defclass", rb_cObject);
3696
+ rb_define_alloc_func(rbDefclass, defclass_alloc);
3697
+ rb_define_singleton_method(rbDefclass, "name", clips_environment_defclass_static_name, 1);
3698
+ rb_define_method(rbDefclass, "name", clips_environment_defclass_name, 0);
3699
+ rb_define_singleton_method(rbDefclass, "defmodule_name", clips_environment_defclass_static_defmodule_name, 1);
3700
+ rb_define_method(rbDefclass, "defmodule_name", clips_environment_defclass_defmodule_name, 0);
3701
+ rb_define_singleton_method(rbDefclass, "pp_form", clips_environment_defclass_static_pp_form, 1);
3702
+ rb_define_method(rbDefclass, "pp_form", clips_environment_defclass_pp_form, 0);
3703
+
3335
3704
  VALUE rbInstance = rb_define_class_under(rbEnvironment, "Instance", rb_cObject);
3705
+ rb_define_alloc_func(rbInstance, instance_alloc);
3706
+ rb_define_singleton_method(rbInstance, "unmake", clips_environment_instance_static_unmake, 1);
3707
+ rb_define_method(rbInstance, "unmake", clips_environment_instance_unmake, 0);
3708
+ rb_define_singleton_method(rbInstance, "delete", clips_environment_instance_static_delete, 1);
3709
+ rb_define_method(rbInstance, "delete", clips_environment_instance_delete, 0);
3710
+ rb_define_singleton_method(rbInstance, "_class", clips_environment_instance_static_class, 1);
3711
+ rb_define_method(rbInstance, "_class", clips_environment_instance_class, 0);
3712
+ rb_define_singleton_method(rbInstance, "name", clips_environment_instance_static_name, 1);
3713
+ rb_define_method(rbInstance, "name", clips_environment_instance_name, 0);
3714
+ rb_define_singleton_method(rbInstance, "pp_form", clips_environment_instance_static_pp_form, 1);
3715
+ rb_define_method(rbInstance, "pp_form", clips_environment_instance_pp_form, 0);
3336
3716
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipsruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Johnston