I need to fetch the Slot Names from CLIPS for a Multislot Field (which is a part of a USER defined class) from C/C++ code.
I tried to use EnvSend/a sample deffunction which prints the Slot Names, but none of them produced the desired result, might be I am missing something.
So is there any way through which I can retrieve the Slot Names/Values for a MultiSlot.
(defclass Card (is-a USER)
( slot CardNumber (type STRING) )
( multislot InfoList (type INSTANCE) )
(defclass CardInfo (is-a USER)
( slot BinRange (type STRING) )
?card<-(object (is-a Card)(CardNumber ?card.CardNumber))
(test (starts-with ?card.CardNumber "AT2"))
(make-instance of CardInfo)
(slot-insert$ ?card InfoList (+ 1 (length$ (send ?card get-InfoList))) (instance-address ))
Now I need to have some output through C function which returns like this, which has both Class Name and Object Names in that Multislot.
(Card CardInfo<Instance-Name of CardInfo class Object1 i.e. cardinfo> ClassName2<Instance-Name of class Object2>)
Any guidance in this matter would be appreciated.
The ClassSlots function can be used to retrieve the names of a slot for a specified class. Given the name of the class, you can use the FindDefclass function to get a pointer to the class data structure which you can pass to ClassSlots. With the names of the slots, you can then use the Send function to retrieve the slot values for a particular instance. For example, if one of the slot names was height, construct the string value "get-height" and pass that value to the instance using the Send function. Without any information on what you attempted in your C code, it's not possible to say why it didn't work properly.