clipsruby 0.0.44 → 0.0.46
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 +262 -1
- data/ext/clipsruby/clipsruby.c +394 -56
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b6972507ec3fa8c18a30ac264f47258ca20143225bd07590f40d6a509a096b5
|
|
4
|
+
data.tar.gz: b173a05a28a045b0246e441911050db29f67af0e3747bd61f1e07020f3a8ac23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93c72f0bf4b5fd4268e7c93d913a62411656cb71a59e6811974a90f14f45ffa88b54fdb20814c32797a291878cc9ec299678f1e754479897291f6da66db0a0a0
|
|
7
|
+
data.tar.gz: e490ed75e9fd2dafbf16d13c0902885ac7a1c135238eb49e3550159ec4d5614db2c836f9d4d125484452d926ebf2ec1c8b206f82fd691f33382bfd153d051676
|
data/README.md
CHANGED
|
@@ -483,6 +483,18 @@ CLIPS::Environment.get_defmodule_list(env)
|
|
|
483
483
|
env.get_defmodule_list
|
|
484
484
|
```
|
|
485
485
|
|
|
486
|
+
#### `CLIPS::Environment.get_deffunction_list` / `CLIPS::Environment#get_deffunction_list`
|
|
487
|
+
|
|
488
|
+
Return an array of Deffunction names as symbols in the environment.
|
|
489
|
+
Optionally pass a `Defmodule`.
|
|
490
|
+
|
|
491
|
+
```ruby
|
|
492
|
+
CLIPS::Environment.get_deffunction_list(env)
|
|
493
|
+
env.get_deffunction_list
|
|
494
|
+
CLIPS::Environment.get_deffunction_list(env, :MAIN)
|
|
495
|
+
env.get_deffunction_list(defmodule)
|
|
496
|
+
```
|
|
497
|
+
|
|
486
498
|
#### `CLIPS::Environment.find_deftemplate` / `CLIPS::Environment#find_deftemplate`
|
|
487
499
|
|
|
488
500
|
Finds a deftemplate by name and returns a CLIPS::Environment::Deftemplate object
|
|
@@ -536,6 +548,110 @@ CLIPS::Environment.unwatch(:facts)
|
|
|
536
548
|
env.unwatch(:statistics)
|
|
537
549
|
```
|
|
538
550
|
|
|
551
|
+
#### `CLIPS::Environment#refresh_all_agendas` / `CLIPS::Environment.refresh_all_agendas`
|
|
552
|
+
|
|
553
|
+
Refresh agendas in all `Defmodule`s in the CLIPS `Environment`.
|
|
554
|
+
|
|
555
|
+
```ruby
|
|
556
|
+
CLIPS::Environment.refresh_all_agendas(env)
|
|
557
|
+
env.refresh_all_agendas
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
#### `CLIPS::Environment#reorder_all_agendas` / `CLIPS::Environment.reorder_all_agendas`
|
|
561
|
+
|
|
562
|
+
Reorder agendas in all `Defmodule`s in the CLIPS `Environment`.
|
|
563
|
+
|
|
564
|
+
```ruby
|
|
565
|
+
CLIPS::Environment.reorder_all_agendas(env)
|
|
566
|
+
env.reorder_all_agendas
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
#### `CLIPS::Environment#get_agenda_changed` / `CLIPS::Environment.get_agenda_changed`
|
|
570
|
+
|
|
571
|
+
Returns whether or not the agenda was changed in the `Environment`.
|
|
572
|
+
|
|
573
|
+
```ruby
|
|
574
|
+
CLIPS::Environment.get_agenda_changed(env)
|
|
575
|
+
env.get_agenda_changed
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
#### `CLIPS::Environment#set_agenda_changed` / `CLIPS::Environment.set_agenda_changed`
|
|
579
|
+
|
|
580
|
+
Sets whether or not the agenda was changed in the `Environment`.
|
|
581
|
+
|
|
582
|
+
```ruby
|
|
583
|
+
CLIPS::Environment.set_agenda_changed(env, false)
|
|
584
|
+
env.set_agenda_changed true
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
#### `CLIPS::Environment#get_salience_evaluation` / `CLIPS::Environment.get_salience_evaluation`
|
|
588
|
+
|
|
589
|
+
Returns the salience evaluation current set in the `Environment`.
|
|
590
|
+
Possible return values are:
|
|
591
|
+
|
|
592
|
+
- `:"when-defined"`
|
|
593
|
+
- `:"when-activated"`
|
|
594
|
+
- `:"every-cycle"`
|
|
595
|
+
- `:unknown`
|
|
596
|
+
|
|
597
|
+
```ruby
|
|
598
|
+
CLIPS::Environment.get_salience_evaluation(env)
|
|
599
|
+
env.get_salience_evaluation
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
#### `CLIPS::Environment#set_salience_evaluation` / `CLIPS::Environment.set_salience_evaluation`
|
|
603
|
+
|
|
604
|
+
Sets the salience evaluation in the `Environment`.
|
|
605
|
+
Possible arguments are:
|
|
606
|
+
|
|
607
|
+
- `:"when-defined"`
|
|
608
|
+
- `:"when-activated"`
|
|
609
|
+
- `:"every-cycle"`
|
|
610
|
+
- `:unknown`
|
|
611
|
+
|
|
612
|
+
```ruby
|
|
613
|
+
CLIPS::Environment.set_salience_evaluation(env, :"when-defined")
|
|
614
|
+
env.set_salience_evaluation :"every-cycle"
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
#### `CLIPS::Environment#get_strategy` / `CLIPS::Environment.get_strategy`
|
|
618
|
+
|
|
619
|
+
Returns the strategy current set in the `Environment`.
|
|
620
|
+
Possible return values are:
|
|
621
|
+
|
|
622
|
+
- `:depth`
|
|
623
|
+
- `:breadth`
|
|
624
|
+
- `:lex`
|
|
625
|
+
- `:mea`
|
|
626
|
+
- `:complexity`
|
|
627
|
+
- `:simplicity`
|
|
628
|
+
- `:random`
|
|
629
|
+
- `:unknown`
|
|
630
|
+
|
|
631
|
+
```ruby
|
|
632
|
+
CLIPS::Environment.get_strategy(env)
|
|
633
|
+
env.get_strategy
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
#### `CLIPS::Environment#set_strategy` / `CLIPS::Environment.set_strategy`
|
|
637
|
+
|
|
638
|
+
Sets the strategy in the `Environment`.
|
|
639
|
+
Possible arguments are:
|
|
640
|
+
|
|
641
|
+
- `:depth`
|
|
642
|
+
- `:breadth`
|
|
643
|
+
- `:lex`
|
|
644
|
+
- `:mea`
|
|
645
|
+
- `:complexity`
|
|
646
|
+
- `:simplicity`
|
|
647
|
+
- `:random`
|
|
648
|
+
- `:unknown`
|
|
649
|
+
|
|
650
|
+
```ruby
|
|
651
|
+
CLIPS::Environment.set_strategy(env, :lex)
|
|
652
|
+
env.set_strategy :mea
|
|
653
|
+
```
|
|
654
|
+
|
|
539
655
|
### Fact Methods
|
|
540
656
|
|
|
541
657
|
#### `CLIPS::Environment::Fact.pp_form` / `CLIPS::Environment::Fact#pp_form`
|
|
@@ -951,6 +1067,50 @@ CLIPS::Environment::Defmodule.get_defrule_list(defmodule)
|
|
|
951
1067
|
defmodule.get_defrule_list
|
|
952
1068
|
```
|
|
953
1069
|
|
|
1070
|
+
#### `CLIPS::Environment::Defmodule.get_deffunction_list` / `CLIPS::Environment::Defmodule#get_deffunction_list`
|
|
1071
|
+
|
|
1072
|
+
Return an array of Deffunction names as symbols in the Defmodule
|
|
1073
|
+
|
|
1074
|
+
```ruby
|
|
1075
|
+
CLIPS::Environment::Defmodule.get_deffunction_list(defmodule)
|
|
1076
|
+
defmodule.get_deffunction_list
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
#### `CLIPS::Environment::Defmodule.refresh_agenda` / `CLIPS::Environment::Defmodule#refresh_agenda`
|
|
1080
|
+
|
|
1081
|
+
Refreshes the agenda in a given Defmodule.
|
|
1082
|
+
If you used `CLIPS::Environment::Activation.set_salience` /
|
|
1083
|
+
`CLIPS::Environment::Activation#set_salience` to set the salience
|
|
1084
|
+
of an activation, using `refresh_agenda` will set it back to its
|
|
1085
|
+
original salience.
|
|
1086
|
+
|
|
1087
|
+
```ruby
|
|
1088
|
+
CLIPS::Environment::Defmodule.refresh_agenda(defmodule)
|
|
1089
|
+
defmodule.refresh_agenda
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
#### `CLIPS::Environment::Defmodule.reorder_agenda` / `CLIPS::Environment::Defmodule#reorder_agenda`
|
|
1093
|
+
|
|
1094
|
+
Refreshes the agenda in a given Defmodule.
|
|
1095
|
+
If you used `CLIPS::Environment::Activation.set_salience` /
|
|
1096
|
+
`CLIPS::Environment::Activation#set_salience` to set the salience
|
|
1097
|
+
of an activation, using `reorder_agenda` will re-order the agenda
|
|
1098
|
+
according to the new salience of activations on the agenda.
|
|
1099
|
+
|
|
1100
|
+
```ruby
|
|
1101
|
+
CLIPS::Environment::Defmodule.reorder_agenda(defmodule)
|
|
1102
|
+
defmodule.reorder_agenda
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
#### `CLIPS::Environment::Defmodule.delete_all_activations` / `CLIPS::Environment::Defmodule#delete_all_activations`
|
|
1106
|
+
|
|
1107
|
+
Deletes all activations in the agenda in a given Defmodule.
|
|
1108
|
+
|
|
1109
|
+
```ruby
|
|
1110
|
+
CLIPS::Environment::Defmodule.delete_all_activations(defmodule)
|
|
1111
|
+
defmodule.delete_all_activations
|
|
1112
|
+
```
|
|
1113
|
+
|
|
954
1114
|
### Deftemplate Methods
|
|
955
1115
|
|
|
956
1116
|
#### `CLIPS::Environment::Deftemplate.name` / `CLIPS::Environment::Deftemplate#name`
|
|
@@ -1143,8 +1303,26 @@ CLIPS::Environment.find_deffacts(:a)
|
|
|
1143
1303
|
env.find_deffacts("foo")
|
|
1144
1304
|
```
|
|
1145
1305
|
|
|
1306
|
+
#### `CLIPS::Environment.find_deffunction` / `CLIPS::Environment#find_deffunction`
|
|
1307
|
+
|
|
1308
|
+
Finds a `Deffunction` by name and returns a CLIPS::Environment::Deffunction object
|
|
1309
|
+
|
|
1310
|
+
```ruby
|
|
1311
|
+
CLIPS::Environment.find_deffunction(:"MAIN::my_deffunction")
|
|
1312
|
+
env.find_deffunction("MAIN::other_deffunction")
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1146
1315
|
### Deffacts Methods
|
|
1147
1316
|
|
|
1317
|
+
#### `CLIPS::Environment::Deffunction.call` / `CLIPS::Environment::Deffunction#call`
|
|
1318
|
+
|
|
1319
|
+
Calls the `Deffunction`, passing it the arguments, returning the return value
|
|
1320
|
+
|
|
1321
|
+
```ruby
|
|
1322
|
+
CLIPS::Environment::Deffunction.call(deffunction, :FOO, :BAR)
|
|
1323
|
+
deffunction.call(:FOO, :BAR)
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1148
1326
|
#### `CLIPS::Environment::Deffacts.name` / `CLIPS::Environment::Deffacts#name`
|
|
1149
1327
|
|
|
1150
1328
|
Returns the name of a deffacts as a symbol
|
|
@@ -1165,7 +1343,16 @@ deffacts.pp_form
|
|
|
1165
1343
|
|
|
1166
1344
|
### Activation Methods
|
|
1167
1345
|
|
|
1168
|
-
#### `CLIPS::Environment::Activation.
|
|
1346
|
+
#### `CLIPS::Environment::Activation.delete` / `CLIPS::Environment::Activation#delete`
|
|
1347
|
+
|
|
1348
|
+
Deletes an `Activation` from the agenda.
|
|
1349
|
+
|
|
1350
|
+
```ruby
|
|
1351
|
+
CLIPS::Environment::Activation.delete
|
|
1352
|
+
activation.delete
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1355
|
+
#### `CLIPS::Environment::Activation.defrule_name` / `CLIPS::Environment::Activation#defrule_name`
|
|
1169
1356
|
|
|
1170
1357
|
Returns the name of a defrule that triggered this activation.
|
|
1171
1358
|
|
|
@@ -1174,6 +1361,80 @@ CLIPS::Environment::Activation.defrule_name
|
|
|
1174
1361
|
activation.defrule_name
|
|
1175
1362
|
```
|
|
1176
1363
|
|
|
1364
|
+
#### `CLIPS::Environment::Activation.get_salience` / `CLIPS::Environment::Activation#get_salience`
|
|
1365
|
+
|
|
1366
|
+
Returns the salience of this activation.
|
|
1367
|
+
|
|
1368
|
+
```ruby
|
|
1369
|
+
CLIPS::Environment::Activation.get_salience(activation)
|
|
1370
|
+
activation.get_salience
|
|
1371
|
+
```
|
|
1372
|
+
|
|
1373
|
+
#### `CLIPS::Environment::Activation.set_salience` / `CLIPS::Environment::Activation#set_salience`
|
|
1374
|
+
|
|
1375
|
+
Sets the salience of this activation.
|
|
1376
|
+
|
|
1377
|
+
```ruby
|
|
1378
|
+
CLIPS::Environment::Activation.set_salience(activation, 11)
|
|
1379
|
+
activation.set_salience 123
|
|
1380
|
+
```
|
|
1381
|
+
|
|
1382
|
+
#### `CLIPS::Environment::Activation.pp_form` / `CLIPS::Environment::Activation#pp_form`
|
|
1383
|
+
|
|
1384
|
+
Returns a pretty printed string representation of the Activation
|
|
1385
|
+
|
|
1386
|
+
```ruby
|
|
1387
|
+
CLIPS::Environment::Activation.pp_form(activation)
|
|
1388
|
+
activation.pp_form
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
### Deffunction Methods
|
|
1392
|
+
|
|
1393
|
+
#### `CLIPS::Environment::Deffunction.name` / `CLIPS::Environment::Deffunction#name`
|
|
1394
|
+
|
|
1395
|
+
Returns the name of the `Deffunction` as a symbol
|
|
1396
|
+
|
|
1397
|
+
```ruby
|
|
1398
|
+
CLIPS::Environment::Deffunction.name(deffunction)
|
|
1399
|
+
deffunction.name
|
|
1400
|
+
```
|
|
1401
|
+
|
|
1402
|
+
#### `CLIPS::Environment::Deffunction.pp_form` / `CLIPS::Environment::Deffunction#pp_form`
|
|
1403
|
+
|
|
1404
|
+
Returns the pretty printed version of the `Deffunction`
|
|
1405
|
+
|
|
1406
|
+
```ruby
|
|
1407
|
+
CLIPS::Environment::Deffunction.pp_form(deffunction)
|
|
1408
|
+
deffunction.pp_form
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
#### `CLIPS::Environment::Deffunction.is_deletable` / `CLIPS::Environment::Deffunction#is_deletable`
|
|
1412
|
+
|
|
1413
|
+
Returns whether the `Deffunction` is deletable or not
|
|
1414
|
+
|
|
1415
|
+
```ruby
|
|
1416
|
+
CLIPS::Environment::Deffunction.is_deletable(deffunction)
|
|
1417
|
+
deffunction.is_deletable
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
#### `CLIPS::Environment::Deffunction.defmodule` / `CLIPS::Environment::Deffunction#defmodule`
|
|
1421
|
+
|
|
1422
|
+
Returns the `Defmodule` that the `Deffunction` is defined in
|
|
1423
|
+
|
|
1424
|
+
```ruby
|
|
1425
|
+
CLIPS::Environment::Deffunction.defmodule(deffunction)
|
|
1426
|
+
deffunction.defmodule
|
|
1427
|
+
```
|
|
1428
|
+
|
|
1429
|
+
#### `CLIPS::Environment::Deffunction.defmodule_name` / `CLIPS::Environment::Deffunction#defmodule_name`
|
|
1430
|
+
|
|
1431
|
+
Returns the name of the `Defmodule` that the `Deffunction` is defined in
|
|
1432
|
+
|
|
1433
|
+
```ruby
|
|
1434
|
+
CLIPS::Environment::Deffunction.defmodule_name(deffunction)
|
|
1435
|
+
deffunction.defmodule_name
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1177
1438
|
## Running the tests
|
|
1178
1439
|
|
|
1179
1440
|
Simply do `rake compile` and then `rake test` in order to run the tests.
|
data/ext/clipsruby/clipsruby.c
CHANGED
|
@@ -115,6 +115,18 @@ static const rb_data_type_t Activation_type = {
|
|
|
115
115
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
size_t deffunction_size(const void *data)
|
|
119
|
+
{
|
|
120
|
+
return sizeof(Deffunction);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static const rb_data_type_t Deffunction_type = {
|
|
124
|
+
.function = {
|
|
125
|
+
.dsize = deffunction_size
|
|
126
|
+
},
|
|
127
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
|
128
|
+
};
|
|
129
|
+
|
|
118
130
|
static VALUE clips_environment_fact_deftemplate(VALUE self)
|
|
119
131
|
{
|
|
120
132
|
VALUE rbDeftemplate, rbEnvironment;
|
|
@@ -293,6 +305,11 @@ VALUE activation_alloc(VALUE self)
|
|
|
293
305
|
return TypedData_Wrap_Struct(self, &Activation_type, NULL);
|
|
294
306
|
}
|
|
295
307
|
|
|
308
|
+
VALUE deffunction_alloc(VALUE self)
|
|
309
|
+
{
|
|
310
|
+
return TypedData_Wrap_Struct(self, &Deffunction_type, NULL);
|
|
311
|
+
}
|
|
312
|
+
|
|
296
313
|
VALUE environment_alloc(VALUE self)
|
|
297
314
|
{
|
|
298
315
|
return TypedData_Wrap_Struct(self, &Environment_type, CreateEnvironment());
|
|
@@ -2671,37 +2688,6 @@ static VALUE clips_environment_static_find_defrule(VALUE self, VALUE rbEnvironme
|
|
|
2671
2688
|
return clips_environment_find_defrule(rbEnvironment, defrule_name);
|
|
2672
2689
|
}
|
|
2673
2690
|
|
|
2674
|
-
static VALUE clips_environment_find_deffacts(VALUE self, VALUE deffacts_name)
|
|
2675
|
-
{
|
|
2676
|
-
Environment *env;
|
|
2677
|
-
Deffacts *deffacts;
|
|
2678
|
-
|
|
2679
|
-
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
|
2680
|
-
|
|
2681
|
-
switch (TYPE(deffacts_name)) {
|
|
2682
|
-
case T_STRING:
|
|
2683
|
-
deffacts = FindDeffacts(env, StringValueCStr(deffacts_name));
|
|
2684
|
-
break;
|
|
2685
|
-
case T_SYMBOL:
|
|
2686
|
-
deffacts = FindDeffacts(env, rb_id2name(SYM2ID(deffacts_name)));
|
|
2687
|
-
break;
|
|
2688
|
-
default:
|
|
2689
|
-
rb_warn("deffacts name must be a symbol or string");
|
|
2690
|
-
return Qnil;
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
if (deffacts == NULL) {
|
|
2694
|
-
return Qnil;
|
|
2695
|
-
} else {
|
|
2696
|
-
return TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Deffacts")), &Deffacts_type, deffacts);
|
|
2697
|
-
}
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
static VALUE clips_environment_static_find_deffacts(VALUE self, VALUE rbEnvironment, VALUE deffacts_name)
|
|
2701
|
-
{
|
|
2702
|
-
return clips_environment_find_deffacts(rbEnvironment, deffacts_name);
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
2691
|
static VALUE clips_environment_deffacts_name(VALUE self)
|
|
2706
2692
|
{
|
|
2707
2693
|
Deffacts *deffacts;
|
|
@@ -2759,24 +2745,6 @@ static VALUE clips_environment_static_get_current_module(VALUE self, VALUE rbEnv
|
|
|
2759
2745
|
return clips_environment_get_current_module(rbEnvironment);
|
|
2760
2746
|
}
|
|
2761
2747
|
|
|
2762
|
-
static VALUE clips_environment_set_current_module(VALUE self, VALUE rbDefmodule)
|
|
2763
|
-
{
|
|
2764
|
-
Environment *env;
|
|
2765
|
-
Defmodule *module;
|
|
2766
|
-
|
|
2767
|
-
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
|
2768
|
-
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, module);
|
|
2769
|
-
|
|
2770
|
-
SetCurrentModule(env, module);
|
|
2771
|
-
|
|
2772
|
-
return rbDefmodule;
|
|
2773
|
-
}
|
|
2774
|
-
|
|
2775
|
-
static VALUE clips_environment_static_set_current_module(VALUE self, VALUE rbEnvironment, VALUE defmodule_name)
|
|
2776
|
-
{
|
|
2777
|
-
return clips_environment_set_current_module(rbEnvironment, defmodule_name);
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
2748
|
static VALUE clips_environment_find_defmodule(VALUE self, VALUE defmodule_name)
|
|
2781
2749
|
{
|
|
2782
2750
|
Environment *env;
|
|
@@ -2811,6 +2779,38 @@ static VALUE clips_environment_static_find_defmodule(VALUE self, VALUE rbEnviron
|
|
|
2811
2779
|
return clips_environment_find_defmodule(rbEnvironment, defmodule_name);
|
|
2812
2780
|
}
|
|
2813
2781
|
|
|
2782
|
+
static VALUE clips_environment_set_current_module(VALUE self, VALUE defmodule_or_defmodule_name)
|
|
2783
|
+
{
|
|
2784
|
+
VALUE rbDefmodule;
|
|
2785
|
+
Environment *env;
|
|
2786
|
+
Defmodule *module;
|
|
2787
|
+
|
|
2788
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
|
2789
|
+
switch (TYPE(defmodule_or_defmodule_name)) {
|
|
2790
|
+
case T_STRING:
|
|
2791
|
+
case T_SYMBOL:
|
|
2792
|
+
rbDefmodule = clips_environment_find_defmodule(self, defmodule_or_defmodule_name);
|
|
2793
|
+
break;
|
|
2794
|
+
case T_DATA:
|
|
2795
|
+
rbDefmodule = defmodule_or_defmodule_name;
|
|
2796
|
+
break;
|
|
2797
|
+
default:
|
|
2798
|
+
rb_raise(rb_eTypeError, "Defmodule must be an instance of CLIPS::Environment::Defmodule, symbol, or string");
|
|
2799
|
+
return Qnil;
|
|
2800
|
+
}
|
|
2801
|
+
TypedData_Get_Struct(rbDefmodule, Defmodule, &Defmodule_type, module);
|
|
2802
|
+
|
|
2803
|
+
SetCurrentModule(env, module);
|
|
2804
|
+
|
|
2805
|
+
return rbDefmodule;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2808
|
+
static VALUE clips_environment_static_set_current_module(VALUE self, VALUE rbEnvironment, VALUE defmodule_name)
|
|
2809
|
+
{
|
|
2810
|
+
return clips_environment_set_current_module(rbEnvironment, defmodule_name);
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
2814
|
static VALUE clips_environment_find_instance(int argc, VALUE *argv, VALUE rbEnvironment) {
|
|
2815
2815
|
VALUE instanceName, search_imports, rbInstance, rbDefmodule;
|
|
2816
2816
|
Defmodule *defmodule;
|
|
@@ -2935,6 +2935,37 @@ static VALUE clips_environment_static_find_instance(int argc, VALUE *argv, VALUE
|
|
|
2935
2935
|
}
|
|
2936
2936
|
}
|
|
2937
2937
|
|
|
2938
|
+
static VALUE clips_environment_find_deffacts(VALUE self, VALUE deffacts_name)
|
|
2939
|
+
{
|
|
2940
|
+
Environment *env;
|
|
2941
|
+
Deffacts *deffacts;
|
|
2942
|
+
|
|
2943
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
|
2944
|
+
|
|
2945
|
+
switch (TYPE(deffacts_name)) {
|
|
2946
|
+
case T_STRING:
|
|
2947
|
+
deffacts = FindDeffacts(env, StringValueCStr(deffacts_name));
|
|
2948
|
+
break;
|
|
2949
|
+
case T_SYMBOL:
|
|
2950
|
+
deffacts = FindDeffacts(env, rb_id2name(SYM2ID(deffacts_name)));
|
|
2951
|
+
break;
|
|
2952
|
+
default:
|
|
2953
|
+
rb_warn("deffacts name must be a symbol or string");
|
|
2954
|
+
return Qnil;
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
if (deffacts == NULL) {
|
|
2958
|
+
return Qnil;
|
|
2959
|
+
} else {
|
|
2960
|
+
return TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Deffacts")), &Deffacts_type, deffacts);
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
static VALUE clips_environment_static_find_deffacts(VALUE self, VALUE rbEnvironment, VALUE deffacts_name)
|
|
2965
|
+
{
|
|
2966
|
+
return clips_environment_find_deffacts(rbEnvironment, deffacts_name);
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2938
2969
|
static VALUE clips_environment_defmodule_find_instance(int argc, VALUE *argv, VALUE rbDefmodule) {
|
|
2939
2970
|
VALUE instanceName, search_imports, rbInstance, rbEnvironment;
|
|
2940
2971
|
Defmodule *defmodule;
|
|
@@ -3027,6 +3058,40 @@ static VALUE clips_environment_defmodule_static_find_instance(int argc, VALUE *a
|
|
|
3027
3058
|
}
|
|
3028
3059
|
}
|
|
3029
3060
|
|
|
3061
|
+
static VALUE clips_environment_find_deffunction(VALUE self, VALUE deffunction_name)
|
|
3062
|
+
{
|
|
3063
|
+
Environment *env;
|
|
3064
|
+
Deffunction *deffunction;
|
|
3065
|
+
|
|
3066
|
+
TypedData_Get_Struct(self, Environment, &Environment_type, env);
|
|
3067
|
+
|
|
3068
|
+
switch (TYPE(deffunction_name)) {
|
|
3069
|
+
case T_STRING:
|
|
3070
|
+
deffunction = FindDeffunction(env, StringValueCStr(deffunction_name));
|
|
3071
|
+
break;
|
|
3072
|
+
case T_SYMBOL:
|
|
3073
|
+
deffunction = FindDeffunction(env, rb_id2name(SYM2ID(deffunction_name)));
|
|
3074
|
+
break;
|
|
3075
|
+
default:
|
|
3076
|
+
rb_warn("deffunction name must be a symbol or string");
|
|
3077
|
+
return Qnil;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
if (deffunction == NULL) {
|
|
3081
|
+
return Qnil;
|
|
3082
|
+
} else {
|
|
3083
|
+
VALUE rbDeffunction;
|
|
3084
|
+
rbDeffunction = TypedData_Wrap_Struct(rb_const_get(CLASS_OF(self), rb_intern("Deffunction")), &Deffunction_type, deffunction);
|
|
3085
|
+
rb_iv_set(rbDeffunction, "@environment", self);
|
|
3086
|
+
return rbDeffunction;
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
static VALUE clips_environment_static_find_deffunction(VALUE self, VALUE rbEnvironment, VALUE deffunction_name)
|
|
3091
|
+
{
|
|
3092
|
+
return clips_environment_find_deffunction(rbEnvironment, deffunction_name);
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3030
3095
|
static VALUE clips_environment_defmodule_refresh_agenda(VALUE self)
|
|
3031
3096
|
{
|
|
3032
3097
|
Defmodule *module;
|
|
@@ -3849,6 +3914,30 @@ static VALUE clips_environment_defmodule_static_get_defrule_list(VALUE self, VAL
|
|
|
3849
3914
|
return clips_environment_defmodule_get_defrule_list(rbDefmodule);
|
|
3850
3915
|
}
|
|
3851
3916
|
|
|
3917
|
+
static VALUE clips_environment_defmodule_get_deffunction_list(VALUE self)
|
|
3918
|
+
{
|
|
3919
|
+
Defmodule *module;
|
|
3920
|
+
Environment *env;
|
|
3921
|
+
CLIPSValue value;
|
|
3922
|
+
VALUE out;
|
|
3923
|
+
|
|
3924
|
+
VALUE rbEnvironment = rb_iv_get(self, "@environment");
|
|
3925
|
+
|
|
3926
|
+
TypedData_Get_Struct(self, Defmodule, &Defmodule_type, module);
|
|
3927
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
|
3928
|
+
|
|
3929
|
+
GetDeffunctionList(env, &value, module);
|
|
3930
|
+
|
|
3931
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
|
3932
|
+
|
|
3933
|
+
return out;
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
static VALUE clips_environment_defmodule_static_get_deffunction_list(VALUE self, VALUE rbDefmodule)
|
|
3937
|
+
{
|
|
3938
|
+
return clips_environment_defmodule_get_deffunction_list(rbDefmodule);
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3852
3941
|
static VALUE clips_environment_get_defmodule_list(VALUE self)
|
|
3853
3942
|
{
|
|
3854
3943
|
Environment *env;
|
|
@@ -5054,6 +5143,73 @@ static VALUE clips_environment_static_set_strategy(VALUE self, VALUE rbEnvironme
|
|
|
5054
5143
|
return clips_environment_set_strategy(rbEnvironment, changed);
|
|
5055
5144
|
}
|
|
5056
5145
|
|
|
5146
|
+
static VALUE clips_environment_get_deffunction_list(int argc, VALUE *argv, VALUE rbEnvironment) {
|
|
5147
|
+
VALUE defmodule_or_defmodule_name;
|
|
5148
|
+
Environment *env;
|
|
5149
|
+
Defmodule *module;
|
|
5150
|
+
CLIPSValue value;
|
|
5151
|
+
VALUE out;
|
|
5152
|
+
|
|
5153
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
|
5154
|
+
|
|
5155
|
+
rb_scan_args(argc, argv, "01", &defmodule_or_defmodule_name);
|
|
5156
|
+
switch (TYPE(defmodule_or_defmodule_name)) {
|
|
5157
|
+
case T_NIL:
|
|
5158
|
+
module = NULL;
|
|
5159
|
+
break;
|
|
5160
|
+
case T_STRING:
|
|
5161
|
+
case T_SYMBOL:
|
|
5162
|
+
TypedData_Get_Struct(
|
|
5163
|
+
clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
|
|
5164
|
+
Defmodule, &Defmodule_type, module);
|
|
5165
|
+
break;
|
|
5166
|
+
case T_DATA:
|
|
5167
|
+
TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
|
|
5168
|
+
break;
|
|
5169
|
+
default:
|
|
5170
|
+
rb_warn("defmodule name must be a symbol or string");
|
|
5171
|
+
return Qnil;
|
|
5172
|
+
}
|
|
5173
|
+
GetDeffunctionList(env, &value, module);
|
|
5174
|
+
|
|
5175
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
|
5176
|
+
|
|
5177
|
+
return out;
|
|
5178
|
+
}
|
|
5179
|
+
|
|
5180
|
+
static VALUE clips_environment_static_get_deffunction_list(int argc, VALUE *argv, VALUE klass) {
|
|
5181
|
+
VALUE rbEnvironment, defmodule_or_defmodule_name;
|
|
5182
|
+
Environment *env;
|
|
5183
|
+
Defmodule *module;
|
|
5184
|
+
CLIPSValue value;
|
|
5185
|
+
VALUE out;
|
|
5186
|
+
|
|
5187
|
+
rb_scan_args(argc, argv, "11", &rbEnvironment, &defmodule_or_defmodule_name);
|
|
5188
|
+
|
|
5189
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
|
5190
|
+
switch (TYPE(defmodule_or_defmodule_name)) {
|
|
5191
|
+
case T_NIL:
|
|
5192
|
+
module = NULL;
|
|
5193
|
+
break;
|
|
5194
|
+
case T_STRING:
|
|
5195
|
+
case T_SYMBOL:
|
|
5196
|
+
TypedData_Get_Struct(
|
|
5197
|
+
clips_environment_find_defmodule(rbEnvironment, defmodule_or_defmodule_name),
|
|
5198
|
+
Defmodule, &Defmodule_type, module);
|
|
5199
|
+
break;
|
|
5200
|
+
case T_DATA:
|
|
5201
|
+
TypedData_Get_Struct(defmodule_or_defmodule_name, Defmodule, &Defmodule_type, module);
|
|
5202
|
+
break;
|
|
5203
|
+
default:
|
|
5204
|
+
rb_warn("defmodule name must be a symbol or string");
|
|
5205
|
+
return Qnil;
|
|
5206
|
+
}
|
|
5207
|
+
GetDeffunctionList(env, &value, module);
|
|
5208
|
+
|
|
5209
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
|
5210
|
+
|
|
5211
|
+
return out;
|
|
5212
|
+
}
|
|
5057
5213
|
|
|
5058
5214
|
static VALUE clips_environment_activation_defrule_name(VALUE self)
|
|
5059
5215
|
{
|
|
@@ -5122,7 +5278,7 @@ static VALUE clips_environment_activation_static_pp_form(VALUE self, VALUE rbAct
|
|
|
5122
5278
|
return clips_environment_activation_pp_form(rbActivation);
|
|
5123
5279
|
}
|
|
5124
5280
|
|
|
5125
|
-
static VALUE
|
|
5281
|
+
static VALUE clips_environment_activation_delete(VALUE self)
|
|
5126
5282
|
{
|
|
5127
5283
|
Activation *activation;
|
|
5128
5284
|
|
|
@@ -5133,9 +5289,170 @@ static VALUE clips_environment_activation_delete_activation(VALUE self)
|
|
|
5133
5289
|
return Qnil;
|
|
5134
5290
|
}
|
|
5135
5291
|
|
|
5136
|
-
static VALUE
|
|
5292
|
+
static VALUE clips_environment_activation_static_delete(VALUE self, VALUE rbActivation)
|
|
5293
|
+
{
|
|
5294
|
+
return clips_environment_activation_delete(rbActivation);
|
|
5295
|
+
}
|
|
5296
|
+
|
|
5297
|
+
static VALUE clips_environment_deffunction_name(VALUE self)
|
|
5298
|
+
{
|
|
5299
|
+
Deffunction *deffunction;
|
|
5300
|
+
|
|
5301
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, deffunction);
|
|
5302
|
+
|
|
5303
|
+
return ID2SYM(rb_intern(DeffunctionName(deffunction)));
|
|
5304
|
+
}
|
|
5305
|
+
|
|
5306
|
+
static VALUE clips_environment_deffunction_static_name(VALUE self, VALUE rbDeffunction)
|
|
5307
|
+
{
|
|
5308
|
+
return clips_environment_deffunction_name(rbDeffunction);
|
|
5309
|
+
}
|
|
5310
|
+
|
|
5311
|
+
static VALUE clips_environment_deffunction_pp_form(VALUE self)
|
|
5312
|
+
{
|
|
5313
|
+
Deffunction *deffunction;
|
|
5314
|
+
|
|
5315
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, deffunction);
|
|
5316
|
+
|
|
5317
|
+
return rb_str_new2(DeffunctionPPForm(deffunction));
|
|
5318
|
+
}
|
|
5319
|
+
|
|
5320
|
+
static VALUE clips_environment_deffunction_static_pp_form(VALUE self, VALUE rbDeffunction)
|
|
5137
5321
|
{
|
|
5138
|
-
return
|
|
5322
|
+
return clips_environment_deffunction_pp_form(rbDeffunction);
|
|
5323
|
+
}
|
|
5324
|
+
|
|
5325
|
+
static VALUE clips_environment_deffunction_is_deletable(VALUE self)
|
|
5326
|
+
{
|
|
5327
|
+
Deffunction *deffunction;
|
|
5328
|
+
|
|
5329
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, deffunction);
|
|
5330
|
+
|
|
5331
|
+
if (DeffunctionIsDeletable(deffunction)) {
|
|
5332
|
+
return Qtrue;
|
|
5333
|
+
} else {
|
|
5334
|
+
return Qfalse;
|
|
5335
|
+
}
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
static VALUE clips_environment_deffunction_static_is_deletable(VALUE self, VALUE rbDeffunction)
|
|
5339
|
+
{
|
|
5340
|
+
return clips_environment_deffunction_is_deletable(rbDeffunction);
|
|
5341
|
+
}
|
|
5342
|
+
|
|
5343
|
+
static VALUE clips_environment_deffunction_defmodule_name(VALUE self)
|
|
5344
|
+
{
|
|
5345
|
+
Deffunction *function;
|
|
5346
|
+
|
|
5347
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, function);
|
|
5348
|
+
|
|
5349
|
+
return ID2SYM(rb_intern(DeffunctionModule(function)));
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5352
|
+
static VALUE clips_environment_deffunction_static_defmodule_name(VALUE self, VALUE rbDeffunction)
|
|
5353
|
+
{
|
|
5354
|
+
return clips_environment_deffunction_defmodule_name(rbDeffunction);
|
|
5355
|
+
}
|
|
5356
|
+
|
|
5357
|
+
static VALUE clips_environment_deffunction_defmodule(VALUE self)
|
|
5358
|
+
{
|
|
5359
|
+
Deffunction *function;
|
|
5360
|
+
const char *defmoduleName;
|
|
5361
|
+
Defmodule *defmodule = NULL;
|
|
5362
|
+
Environment *env;
|
|
5363
|
+
|
|
5364
|
+
VALUE rbEnvironment = rb_iv_get(self, "@environment");
|
|
5365
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
|
5366
|
+
|
|
5367
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, function);
|
|
5368
|
+
|
|
5369
|
+
defmoduleName = DeffunctionModule(function);
|
|
5370
|
+
|
|
5371
|
+
if (defmoduleName != NULL) {
|
|
5372
|
+
defmodule = FindDefmodule(env, defmoduleName);
|
|
5373
|
+
}
|
|
5374
|
+
|
|
5375
|
+
if (defmodule != NULL) {
|
|
5376
|
+
return TypedData_Wrap_Struct(rb_const_get(CLASS_OF(rbEnvironment), rb_intern("Defmodule")), &Defmodule_type, defmodule);
|
|
5377
|
+
} else {
|
|
5378
|
+
return Qnil;
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5382
|
+
static VALUE clips_environment_deffunction_static_defmodule(VALUE self, VALUE rbDeffunction)
|
|
5383
|
+
{
|
|
5384
|
+
return clips_environment_deffunction_defmodule(rbDeffunction);
|
|
5385
|
+
}
|
|
5386
|
+
|
|
5387
|
+
static VALUE clips_environment_deffunction_call(int argc, VALUE *argv, VALUE self)
|
|
5388
|
+
{
|
|
5389
|
+
FunctionCallBuilder *fcb;
|
|
5390
|
+
Deffunction *function;
|
|
5391
|
+
CLIPSValue value;
|
|
5392
|
+
VALUE out;
|
|
5393
|
+
const char *functionName, *defmoduleName, *currentDefmoduleName;
|
|
5394
|
+
Environment *env;
|
|
5395
|
+
|
|
5396
|
+
VALUE rbEnvironment = rb_iv_get(self, "@environment");
|
|
5397
|
+
TypedData_Get_Struct(rbEnvironment, Environment, &Environment_type, env);
|
|
5398
|
+
|
|
5399
|
+
TypedData_Get_Struct(self, Deffunction, &Deffunction_type, function);
|
|
5400
|
+
|
|
5401
|
+
functionName = DeffunctionName(function);
|
|
5402
|
+
defmoduleName = DeffunctionModule(function);
|
|
5403
|
+
currentDefmoduleName = DefmoduleName(GetCurrentModule(env));
|
|
5404
|
+
|
|
5405
|
+
fcb = CreateFunctionCallBuilder(env, argc);
|
|
5406
|
+
|
|
5407
|
+
for (int i = 0; i < argc; i++) {
|
|
5408
|
+
value = VALUE_to_CLIPSValue(argv[i], env);
|
|
5409
|
+
FCBAppend(fcb, &value);
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
switch(FCBCall(fcb, functionName, &value))
|
|
5413
|
+
{
|
|
5414
|
+
case FCBE_NO_ERROR:
|
|
5415
|
+
break;
|
|
5416
|
+
case FCBE_NULL_POINTER_ERROR:
|
|
5417
|
+
FCBDispose(fcb);
|
|
5418
|
+
rb_raise(rb_eStandardError, "Somehow the FunctionCallBuilder or Deffunction name was NULL\n");
|
|
5419
|
+
break;
|
|
5420
|
+
case FCBE_FUNCTION_NOT_FOUND_ERROR:
|
|
5421
|
+
FCBDispose(fcb);
|
|
5422
|
+
rb_raise(rb_eStandardError, "A function, deffunction, or generic function could not be found with the name %s defined in module %s from the current module %s\n", functionName, defmoduleName, currentDefmoduleName);
|
|
5423
|
+
break;
|
|
5424
|
+
case FCBE_INVALID_FUNCTION_ERROR:
|
|
5425
|
+
FCBDispose(fcb);
|
|
5426
|
+
rb_raise(rb_eStandardError, "The function or command has a specialized parser (such as the assert command) and cannot be invoked.\n");
|
|
5427
|
+
break;
|
|
5428
|
+
case FCBE_ARGUMENT_COUNT_ERROR:
|
|
5429
|
+
FCBDispose(fcb);
|
|
5430
|
+
rb_raise(rb_eStandardError,"The function was passed the incorrect number of arguments.\n");
|
|
5431
|
+
break;
|
|
5432
|
+
case FCBE_ARGUMENT_TYPE_ERROR:
|
|
5433
|
+
FCBDispose(fcb);
|
|
5434
|
+
rb_raise(rb_eStandardError,"The function was passed an argument with an invalid type.\n");
|
|
5435
|
+
break;
|
|
5436
|
+
case FCBE_PROCESSING_ERROR:
|
|
5437
|
+
FCBDispose(fcb);
|
|
5438
|
+
rb_raise(rb_eStandardError,"An error occurred while the function was being evaluated.\n");
|
|
5439
|
+
break;
|
|
5440
|
+
default:
|
|
5441
|
+
FCBDispose(fcb);
|
|
5442
|
+
rb_raise(rb_eStandardError,"Something went wrong calling the deffunction %s\n",functionName);
|
|
5443
|
+
break;
|
|
5444
|
+
}
|
|
5445
|
+
|
|
5446
|
+
FCBDispose(fcb);
|
|
5447
|
+
|
|
5448
|
+
CLIPSValue_to_VALUE(&value, &out, &rbEnvironment);
|
|
5449
|
+
|
|
5450
|
+
return out;
|
|
5451
|
+
}
|
|
5452
|
+
|
|
5453
|
+
static VALUE clips_environment_deffunction_static_call(int argc, VALUE *argv, VALUE klass)
|
|
5454
|
+
{
|
|
5455
|
+
return clips_environment_deffunction_call(argc, argv+1, argv[0]);
|
|
5139
5456
|
}
|
|
5140
5457
|
|
|
5141
5458
|
void Init_clipsruby(void)
|
|
@@ -5203,6 +5520,10 @@ void Init_clipsruby(void)
|
|
|
5203
5520
|
rb_define_method(rbEnvironment, "find_defclass", clips_environment_find_defclass, 1);
|
|
5204
5521
|
rb_define_singleton_method(rbEnvironment, "find_instance", clips_environment_static_find_instance, -1);
|
|
5205
5522
|
rb_define_method(rbEnvironment, "find_instance", clips_environment_find_instance, -1);
|
|
5523
|
+
rb_define_singleton_method(rbEnvironment, "find_deffacts", clips_environment_static_find_deffacts, 2);
|
|
5524
|
+
rb_define_method(rbEnvironment, "find_deffacts", clips_environment_find_deffacts, 1);
|
|
5525
|
+
rb_define_singleton_method(rbEnvironment, "find_deffunction", clips_environment_static_find_deffunction, 2);
|
|
5526
|
+
rb_define_method(rbEnvironment, "find_deffunction", clips_environment_find_deffunction, 1);
|
|
5206
5527
|
rb_define_singleton_method(rbEnvironment, "get_current_module", clips_environment_static_get_current_module, 1);
|
|
5207
5528
|
rb_define_method(rbEnvironment, "get_current_module", clips_environment_get_current_module, 0);
|
|
5208
5529
|
rb_define_singleton_method(rbEnvironment, "set_current_module", clips_environment_static_set_current_module, 2);
|
|
@@ -5221,8 +5542,8 @@ void Init_clipsruby(void)
|
|
|
5221
5542
|
rb_define_method(rbEnvironment, "get_defmodule_list", clips_environment_get_defmodule_list, 0);
|
|
5222
5543
|
rb_define_singleton_method(rbEnvironment, "get_activation_list", clips_environment_static_get_activation_list, 1);
|
|
5223
5544
|
rb_define_method(rbEnvironment, "get_activation_list", clips_environment_get_activation_list, 0);
|
|
5224
|
-
rb_define_singleton_method(rbEnvironment, "
|
|
5225
|
-
rb_define_method(rbEnvironment, "
|
|
5545
|
+
rb_define_singleton_method(rbEnvironment, "get_deffunction_list", clips_environment_static_get_deffunction_list, -1);
|
|
5546
|
+
rb_define_method(rbEnvironment, "get_deffunction_list", clips_environment_get_deffunction_list, -1);
|
|
5226
5547
|
rb_define_singleton_method(rbEnvironment, "watch", clips_environment_static_watch, 2);
|
|
5227
5548
|
rb_define_method(rbEnvironment, "watch", clips_environment_watch, 1);
|
|
5228
5549
|
rb_define_singleton_method(rbEnvironment, "watch_all", clips_environment_static_watch_all, 1);
|
|
@@ -5368,6 +5689,8 @@ void Init_clipsruby(void)
|
|
|
5368
5689
|
rb_define_method(rbDefmodule, "get_deftemplate_list", clips_environment_defmodule_get_deftemplate_list, 0);
|
|
5369
5690
|
rb_define_singleton_method(rbDefmodule, "get_defrule_list", clips_environment_defmodule_static_get_defrule_list, 1);
|
|
5370
5691
|
rb_define_method(rbDefmodule, "get_defrule_list", clips_environment_defmodule_get_defrule_list, 0);
|
|
5692
|
+
rb_define_singleton_method(rbDefmodule, "get_deffunction_list", clips_environment_defmodule_static_get_deffunction_list, 1);
|
|
5693
|
+
rb_define_method(rbDefmodule, "get_deffunction_list", clips_environment_defmodule_get_deffunction_list, 0);
|
|
5371
5694
|
rb_define_singleton_method(rbDefmodule, "find_instance", clips_environment_defmodule_static_find_instance, -1);
|
|
5372
5695
|
rb_define_method(rbDefmodule, "find_instance", clips_environment_defmodule_find_instance, -1);
|
|
5373
5696
|
rb_define_singleton_method(rbDefmodule, "refresh_agenda", clips_environment_defmodule_static_refresh_agenda, 1);
|
|
@@ -5467,6 +5790,21 @@ void Init_clipsruby(void)
|
|
|
5467
5790
|
rb_define_method(rbActivation, "set_salience", clips_environment_activation_set_salience, 1);
|
|
5468
5791
|
rb_define_singleton_method(rbActivation, "pp_form", clips_environment_activation_static_pp_form, 1);
|
|
5469
5792
|
rb_define_method(rbActivation, "pp_form", clips_environment_activation_pp_form, 0);
|
|
5470
|
-
rb_define_singleton_method(rbActivation, "
|
|
5471
|
-
rb_define_method(rbActivation, "
|
|
5793
|
+
rb_define_singleton_method(rbActivation, "delete", clips_environment_activation_static_delete, 1);
|
|
5794
|
+
rb_define_method(rbActivation, "delete", clips_environment_activation_delete, 0);
|
|
5795
|
+
|
|
5796
|
+
VALUE rbDeffunction = rb_define_class_under(rbEnvironment, "Deffunction", rb_cObject);
|
|
5797
|
+
rb_define_alloc_func(rbDeffunction, deffunction_alloc);
|
|
5798
|
+
rb_define_singleton_method(rbDeffunction, "name", clips_environment_deffunction_static_name, 1);
|
|
5799
|
+
rb_define_method(rbDeffunction, "name", clips_environment_deffunction_name, 0);
|
|
5800
|
+
rb_define_singleton_method(rbDeffunction, "pp_form", clips_environment_deffunction_static_pp_form, 1);
|
|
5801
|
+
rb_define_method(rbDeffunction, "pp_form", clips_environment_deffunction_pp_form, 0);
|
|
5802
|
+
rb_define_singleton_method(rbDeffunction, "is_deletable", clips_environment_deffunction_static_is_deletable, 1);
|
|
5803
|
+
rb_define_method(rbDeffunction, "is_deletable", clips_environment_deffunction_is_deletable, 0);
|
|
5804
|
+
rb_define_singleton_method(rbDeffunction, "defmodule", clips_environment_deffunction_static_defmodule, 1);
|
|
5805
|
+
rb_define_method(rbDeffunction, "defmodule", clips_environment_deffunction_defmodule, 0);
|
|
5806
|
+
rb_define_singleton_method(rbDeffunction, "defmodule_name", clips_environment_deffunction_static_defmodule_name, 1);
|
|
5807
|
+
rb_define_method(rbDeffunction, "defmodule_name", clips_environment_deffunction_defmodule_name, 0);
|
|
5808
|
+
rb_define_singleton_method(rbDeffunction, "call", clips_environment_deffunction_static_call, -1);
|
|
5809
|
+
rb_define_method(rbDeffunction, "call", clips_environment_deffunction_call, -1);
|
|
5472
5810
|
}
|