clipsruby 0.0.26 → 0.0.27
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 +50 -0
- data/ext/clipsruby/clipsruby.c +138 -0
- 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: 78727d42b56ea442a2ff5b487d3cc209bcfda2068724a7507021fa44845dee9c
|
4
|
+
data.tar.gz: f22f44dc57cdf4d8e1491b1b9790c45a15264b9fcad34b3b768e6deb9655a475
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd28dcfe9303c838636a209fdcd1d043ae7c0fa72b84ae49ea52c2e79aed9f2d65c58cd02746cdfd9bc4230476dcb4289ea32cc36f2e335ba54371008146e3b
|
7
|
+
data.tar.gz: a9dd833a9d045713eb20ab356d65bb80c7a61d528518f5b7dd83482a059042a3499f3fb33f06259ab667af3fc2dea22102bcb103acf50f41900537301980d5d0
|
data/README.md
CHANGED
@@ -666,6 +666,56 @@ CLIPS::Environment::Deftemplate.slot_cardinality(deftemplate, :foo)
|
|
666
666
|
deftemplate.slot_cardinality('bar')
|
667
667
|
```
|
668
668
|
|
669
|
+
### `CLIPS::Environment::Deftemplate.slot_existp`
|
670
|
+
### `CLIPS::Environment::Deftemplate#slot_existp`
|
671
|
+
|
672
|
+
Returns a boolean for whether or not the slot with a given name
|
673
|
+
exists on the Deftemplate.
|
674
|
+
|
675
|
+
```ruby
|
676
|
+
CLIPS::Environment::Deftemplate.slot_existp(deftemplate, :foo)
|
677
|
+
deftemplate.slot_existp('bar')
|
678
|
+
```
|
679
|
+
|
680
|
+
### `CLIPS::Environment::Deftemplate.slot_singlep`
|
681
|
+
### `CLIPS::Environment::Deftemplate#slot_singlep`
|
682
|
+
|
683
|
+
Returns a boolean for whether or not the slot with a given name
|
684
|
+
on the Deftemplate is a single slot.
|
685
|
+
|
686
|
+
```ruby
|
687
|
+
CLIPS::Environment::Deftemplate.slot_singlep(deftemplate, :foo)
|
688
|
+
deftemplate.slot_singlep('bar')
|
689
|
+
```
|
690
|
+
|
691
|
+
### `CLIPS::Environment::Deftemplate.slot_multip`
|
692
|
+
### `CLIPS::Environment::Deftemplate#slot_multip`
|
693
|
+
|
694
|
+
Returns a boolean for whether or not the slot with a given name
|
695
|
+
on the Deftemplate is a multislot.
|
696
|
+
|
697
|
+
```ruby
|
698
|
+
CLIPS::Environment::Deftemplate.slot_multip(deftemplate, :foo)
|
699
|
+
deftemplate.slot_multip('bar')
|
700
|
+
```
|
701
|
+
|
702
|
+
### `CLIPS::Environment::Deftemplate.slot_defaultp`
|
703
|
+
### `CLIPS::Environment::Deftemplate#slot_defaultp`
|
704
|
+
|
705
|
+
Returns a symbol representing the type of default value a slot has
|
706
|
+
on the Deftemplate. Possible return values are as follows:
|
707
|
+
|
708
|
+
```ruby
|
709
|
+
:NO_DEFAULT
|
710
|
+
:STATIC_DEFAULT
|
711
|
+
:DYNAMIC_DEFAULT
|
712
|
+
```
|
713
|
+
|
714
|
+
```ruby
|
715
|
+
CLIPS::Environment::Deftemplate.slot_defaultp(deftemplate, :foo)
|
716
|
+
deftemplate.slot_defaultp('bar')
|
717
|
+
```
|
718
|
+
|
669
719
|
### `CLIPS::Environment::Defmodule.get_deftemplate_list`
|
670
720
|
### `CLIPS::Environment::Defmodule#get_deftemplate_list`
|
671
721
|
|
data/ext/clipsruby/clipsruby.c
CHANGED
@@ -2092,6 +2092,136 @@ static VALUE clips_environment_deftemplate_static_is_deletable(VALUE self, VALUE
|
|
2092
2092
|
return clips_environment_deftemplate_is_deletable(rbDeftemplate);
|
2093
2093
|
}
|
2094
2094
|
|
2095
|
+
static VALUE clips_environment_deftemplate_slot_existp(VALUE self, VALUE slot_name)
|
2096
|
+
{
|
2097
|
+
Deftemplate *deftemplate;
|
2098
|
+
const char *cslot_name;
|
2099
|
+
switch(TYPE(slot_name))
|
2100
|
+
{
|
2101
|
+
case T_SYMBOL:
|
2102
|
+
cslot_name = rb_id2name(SYM2ID(slot_name));
|
2103
|
+
break;
|
2104
|
+
case T_STRING:
|
2105
|
+
cslot_name = StringValueCStr(slot_name);
|
2106
|
+
break;
|
2107
|
+
default:
|
2108
|
+
rb_raise(rb_eTypeError, "Slot name must be a String or a Symbol");
|
2109
|
+
return ST_CONTINUE;
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
TypedData_Get_Struct(self, Deftemplate, &Deftemplate_type, deftemplate);
|
2113
|
+
|
2114
|
+
if (DeftemplateSlotExistP(deftemplate, cslot_name)) {
|
2115
|
+
return Qtrue;
|
2116
|
+
} else {
|
2117
|
+
return Qfalse;
|
2118
|
+
}
|
2119
|
+
}
|
2120
|
+
|
2121
|
+
static VALUE clips_environment_deftemplate_static_slot_existp(VALUE self, VALUE rbDeftemplate, VALUE slot_name)
|
2122
|
+
{
|
2123
|
+
return clips_environment_deftemplate_slot_existp(rbDeftemplate, slot_name);
|
2124
|
+
}
|
2125
|
+
|
2126
|
+
static VALUE clips_environment_deftemplate_slot_singlep(VALUE self, VALUE slot_name)
|
2127
|
+
{
|
2128
|
+
Deftemplate *deftemplate;
|
2129
|
+
const char *cslot_name;
|
2130
|
+
switch(TYPE(slot_name))
|
2131
|
+
{
|
2132
|
+
case T_SYMBOL:
|
2133
|
+
cslot_name = rb_id2name(SYM2ID(slot_name));
|
2134
|
+
break;
|
2135
|
+
case T_STRING:
|
2136
|
+
cslot_name = StringValueCStr(slot_name);
|
2137
|
+
break;
|
2138
|
+
default:
|
2139
|
+
rb_raise(rb_eTypeError, "Slot name must be a String or a Symbol");
|
2140
|
+
return ST_CONTINUE;
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
TypedData_Get_Struct(self, Deftemplate, &Deftemplate_type, deftemplate);
|
2144
|
+
|
2145
|
+
if (DeftemplateSlotSingleP(deftemplate, cslot_name)) {
|
2146
|
+
return Qtrue;
|
2147
|
+
} else {
|
2148
|
+
return Qfalse;
|
2149
|
+
}
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
static VALUE clips_environment_deftemplate_static_slot_singlep(VALUE self, VALUE rbDeftemplate, VALUE slot_name)
|
2153
|
+
{
|
2154
|
+
return clips_environment_deftemplate_slot_singlep(rbDeftemplate, slot_name);
|
2155
|
+
}
|
2156
|
+
|
2157
|
+
static VALUE clips_environment_deftemplate_slot_multip(VALUE self, VALUE slot_name)
|
2158
|
+
{
|
2159
|
+
Deftemplate *deftemplate;
|
2160
|
+
const char *cslot_name;
|
2161
|
+
switch(TYPE(slot_name))
|
2162
|
+
{
|
2163
|
+
case T_SYMBOL:
|
2164
|
+
cslot_name = rb_id2name(SYM2ID(slot_name));
|
2165
|
+
break;
|
2166
|
+
case T_STRING:
|
2167
|
+
cslot_name = StringValueCStr(slot_name);
|
2168
|
+
break;
|
2169
|
+
default:
|
2170
|
+
rb_raise(rb_eTypeError, "Slot name must be a String or a Symbol");
|
2171
|
+
return ST_CONTINUE;
|
2172
|
+
}
|
2173
|
+
|
2174
|
+
TypedData_Get_Struct(self, Deftemplate, &Deftemplate_type, deftemplate);
|
2175
|
+
|
2176
|
+
if (DeftemplateSlotMultiP(deftemplate, cslot_name)) {
|
2177
|
+
return Qtrue;
|
2178
|
+
} else {
|
2179
|
+
return Qfalse;
|
2180
|
+
}
|
2181
|
+
}
|
2182
|
+
|
2183
|
+
static VALUE clips_environment_deftemplate_static_slot_multip(VALUE self, VALUE rbDeftemplate, VALUE slot_name)
|
2184
|
+
{
|
2185
|
+
return clips_environment_deftemplate_slot_multip(rbDeftemplate, slot_name);
|
2186
|
+
}
|
2187
|
+
|
2188
|
+
static VALUE clips_environment_deftemplate_slot_defaultp(VALUE self, VALUE slot_name)
|
2189
|
+
{
|
2190
|
+
Deftemplate *deftemplate;
|
2191
|
+
const char *cslot_name;
|
2192
|
+
switch(TYPE(slot_name))
|
2193
|
+
{
|
2194
|
+
case T_SYMBOL:
|
2195
|
+
cslot_name = rb_id2name(SYM2ID(slot_name));
|
2196
|
+
break;
|
2197
|
+
case T_STRING:
|
2198
|
+
cslot_name = StringValueCStr(slot_name);
|
2199
|
+
break;
|
2200
|
+
default:
|
2201
|
+
rb_warn("Slot name must be a String or a Symbol");
|
2202
|
+
return Qnil;
|
2203
|
+
}
|
2204
|
+
|
2205
|
+
TypedData_Get_Struct(self, Deftemplate, &Deftemplate_type, deftemplate);
|
2206
|
+
|
2207
|
+
switch (DeftemplateSlotDefaultP(deftemplate, cslot_name)) {
|
2208
|
+
case NO_DEFAULT:
|
2209
|
+
return ID2SYM(rb_intern("NO_DEFAULT"));
|
2210
|
+
case STATIC_DEFAULT:
|
2211
|
+
return ID2SYM(rb_intern("STATIC_DEFAULT"));
|
2212
|
+
case DYNAMIC_DEFAULT:
|
2213
|
+
return ID2SYM(rb_intern("DYNAMIC_DEFAULT"));
|
2214
|
+
default:
|
2215
|
+
rb_warn("CLIPS returned something we didn't expect for slot_defaultp...");
|
2216
|
+
return Qnil;
|
2217
|
+
}
|
2218
|
+
}
|
2219
|
+
|
2220
|
+
static VALUE clips_environment_deftemplate_static_slot_defaultp(VALUE self, VALUE rbDeftemplate, VALUE slot_name)
|
2221
|
+
{
|
2222
|
+
return clips_environment_deftemplate_slot_defaultp(rbDeftemplate, slot_name);
|
2223
|
+
}
|
2224
|
+
|
2095
2225
|
static VALUE clips_environment_defrule_has_breakpoint(VALUE self)
|
2096
2226
|
{
|
2097
2227
|
Defrule *defrule;
|
@@ -2943,6 +3073,14 @@ void Init_clipsruby(void)
|
|
2943
3073
|
rb_define_method(rbDeftemplate, "slot_range", clips_environment_deftemplate_slot_range, 1);
|
2944
3074
|
rb_define_singleton_method(rbDeftemplate, "slot_cardinality", clips_environment_deftemplate_static_slot_cardinality, 2);
|
2945
3075
|
rb_define_method(rbDeftemplate, "slot_cardinality", clips_environment_deftemplate_slot_cardinality, 1);
|
3076
|
+
rb_define_singleton_method(rbDeftemplate, "slot_existp", clips_environment_deftemplate_static_slot_existp, 2);
|
3077
|
+
rb_define_method(rbDeftemplate, "slot_existp", clips_environment_deftemplate_slot_existp, 1);
|
3078
|
+
rb_define_singleton_method(rbDeftemplate, "slot_singlep", clips_environment_deftemplate_static_slot_singlep, 2);
|
3079
|
+
rb_define_method(rbDeftemplate, "slot_singlep", clips_environment_deftemplate_slot_singlep, 1);
|
3080
|
+
rb_define_singleton_method(rbDeftemplate, "slot_multip", clips_environment_deftemplate_static_slot_multip, 2);
|
3081
|
+
rb_define_method(rbDeftemplate, "slot_multip", clips_environment_deftemplate_slot_multip, 1);
|
3082
|
+
rb_define_singleton_method(rbDeftemplate, "slot_defaultp", clips_environment_deftemplate_static_slot_defaultp, 2);
|
3083
|
+
rb_define_method(rbDeftemplate, "slot_defaultp", clips_environment_deftemplate_slot_defaultp, 1);
|
2946
3084
|
|
2947
3085
|
VALUE rbDefmodule = rb_define_class_under(rbEnvironment, "Defmodule", rb_cObject);
|
2948
3086
|
rb_define_alloc_func(rbDefmodule, defmodule_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.27
|
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-18 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
|