clips-sys 0.4.0

Bindgen generated wrapper for CLIPS (clipsrules.net)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
TRUE
CLIPS> (batch "coolcmd.bat")
TRUE
CLIPS> (defclass PP-TEST (is-a USER)
   (multislot x)
   (slot y))
CLIPS> (ppdefclass)
[ARGACCES1] Function 'ppdefclass' expected at least 1 argument.
CLIPS> (ppdefclass USER)
CLIPS> (ppdefclass BOGUS)
[PRNTUTIL1] Unable to find defclass 'BOGUS'.
CLIPS> (ppdefclass PP-TEST)
(defclass MAIN::PP-TEST
   (is-a USER)
   (multislot x)
   (slot y))
CLIPS> (ppdefclass PP-TEST stdout)
(defclass MAIN::PP-TEST
   (is-a USER)
   (multislot x)
   (slot y))
CLIPS> (ppdefclass PP-TEST bogus)
[ROUTER1] Logical name 'bogus' was not recognized by any routers.
CLIPS> (ppdefclass PP-TEST nil)
"(defclass MAIN::PP-TEST
   (is-a USER)
   (multislot x)
   (slot y))
"
CLIPS> (list-defclasses)
FLOAT
INTEGER
SYMBOL
STRING
MULTIFIELD
EXTERNAL-ADDRESS
FACT-ADDRESS
INSTANCE-ADDRESS
INSTANCE-NAME
OBJECT
PRIMITIVE
NUMBER
LEXEME
ADDRESS
INSTANCE
USER
PP-TEST
For a total of 17 defclasses.
CLIPS> (defclass TEST (is-a USER) (role concrete))
CLIPS> (defclass ANOTHER-TEST (is-a TEST))
CLIPS> (defclass * (is-a OBJECT))
CLIPS> (undefclass BOGUS)
[PRNTUTIL1] Unable to find defclass 'BOGUS'.
CLIPS> (undefclass *)
CLIPS> (undefclass OBJECT)
[PRNTUTIL4] Unable to delete defclass 'OBJECT'.
CLIPS> (undefclass PRIMITIVE)
[PRNTUTIL4] Unable to delete defclass 'PRIMITIVE'.
CLIPS> (undefclass MULTIFIELD)
[PRNTUTIL4] Unable to delete defclass 'MULTIFIELD'.
CLIPS> (undefclass EXTERNAL-ADDRESS)
[PRNTUTIL4] Unable to delete defclass 'EXTERNAL-ADDRESS'.
CLIPS> (undefclass NUMBER)
[PRNTUTIL4] Unable to delete defclass 'NUMBER'.
CLIPS> (undefclass LEXEME)
[PRNTUTIL4] Unable to delete defclass 'LEXEME'.
CLIPS> (undefclass INTEGER)
[PRNTUTIL4] Unable to delete defclass 'INTEGER'.
CLIPS> (undefclass FLOAT)
[PRNTUTIL4] Unable to delete defclass 'FLOAT'.
CLIPS> (undefclass SYMBOL)
[PRNTUTIL4] Unable to delete defclass 'SYMBOL'.
CLIPS> (undefclass STRING)
[PRNTUTIL4] Unable to delete defclass 'STRING'.
CLIPS> (make-instance t of TEST)
[t]
CLIPS> (undefclass TEST)
[PRNTUTIL4] Unable to delete defclass 'TEST'.
CLIPS> (unmake-instance *)
TRUE
CLIPS> (defmethod foo ((?a TEST)))
CLIPS> (undefclass TEST)
[PRNTUTIL4] Unable to delete defclass 'TEST'.
CLIPS> (undefgeneric foo)
CLIPS> (undefclass TEST)
CLIPS> (list-defclasses)
FLOAT
INTEGER
SYMBOL
STRING
MULTIFIELD
EXTERNAL-ADDRESS
FACT-ADDRESS
INSTANCE-ADDRESS
INSTANCE-NAME
OBJECT
PRIMITIVE
NUMBER
LEXEME
ADDRESS
INSTANCE
USER
PP-TEST
For a total of 17 defclasses.
CLIPS> (undefclass *)
CLIPS> (list-defclasses)
FLOAT
INTEGER
SYMBOL
STRING
MULTIFIELD
EXTERNAL-ADDRESS
FACT-ADDRESS
INSTANCE-ADDRESS
INSTANCE-NAME
OBJECT
PRIMITIVE
NUMBER
LEXEME
ADDRESS
INSTANCE
USER
For a total of 16 defclasses.
CLIPS> (defclass CHILD (is-a USER) (role abstract)
  (slot age (create-accessor ?NONE))
  (slot sex (access read-only)
            (storage shared)
            (create-accessor ?NONE)))
CLIPS> (defclass BOY (is-a CHILD)
   (role concrete)
   (slot sex (source composite)
             (default male)
             (create-accessor ?NONE)))
CLIPS> (defmessage-handler BOY play ()
   (printout t "The boy is now playing..." crlf))
CLIPS> (describe-class CHILD)
================================================================================
********************************************************************************
Abstract: direct instances of this class cannot be created.

Direct Superclasses: USER
Inheritance Precedence: CHILD USER OBJECT
Direct Subclasses: BOY
--------------------------------------------------------------------------------
SLOTS : FLD DEF PRP ACC STO MCH SRC VIS CRT OVRD-MSG SOURCE(S)
age   : SGL STC INH RW  LCL RCT EXC PRV NIL put-age  CHILD
sex   : SGL STC INH  R  SHR RCT EXC PRV NIL NIL      CHILD

Constraint information for slots:

SLOTS : SYM STR INN INA EXA FTA INT FLT
age   :  +   +   +   +   +   +   +   +  RNG:[-oo..+oo] 
sex   :  +   +   +   +   +   +   +   +  RNG:[-oo..+oo] 
--------------------------------------------------------------------------------
Recognized message-handlers:
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
********************************************************************************
================================================================================
CLIPS> (describe-class BOY)
================================================================================
********************************************************************************
Concrete: direct instances of this class can be created.
Non-reactive: direct instances of this class cannot match defrule patterns.

Direct Superclasses: CHILD
Inheritance Precedence: BOY CHILD USER OBJECT
Direct Subclasses:
--------------------------------------------------------------------------------
SLOTS : FLD DEF PRP ACC STO MCH SRC VIS CRT OVRD-MSG SOURCE(S)
age   : SGL STC INH RW  LCL RCT EXC PRV NIL put-age  CHILD
sex   : SGL STC INH  R  SHR RCT CMP PRV NIL NIL      CHILD BOY

Constraint information for slots:

SLOTS : SYM STR INN INA EXA FTA INT FLT
age   :  +   +   +   +   +   +   +   +  RNG:[-oo..+oo] 
sex   :  +   +   +   +   +   +   +   +  RNG:[-oo..+oo] 
--------------------------------------------------------------------------------
Recognized message-handlers:
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
play primary in class BOY
********************************************************************************
================================================================================
CLIPS> (defclass a (is-a USER))
CLIPS> (defclass b (is-a USER))
CLIPS> (defclass c (is-a a b))
CLIPS> (defclass d (is-a USER))
CLIPS> (defclass e (is-a c d))
CLIPS> (defclass f (is-a e))
CLIPS> (browse-classes)
OBJECT
  PRIMITIVE
    NUMBER
      INTEGER
      FLOAT
    LEXEME
      SYMBOL
      STRING
    MULTIFIELD
    ADDRESS
      EXTERNAL-ADDRESS
      FACT-ADDRESS
      INSTANCE-ADDRESS *
    INSTANCE
      INSTANCE-ADDRESS *
      INSTANCE-NAME
  USER
    CHILD
      BOY
    a
      c *
        e *
          f
    b
      c *
        e *
          f
    d
      e *
        f
CLIPS> (browse-classes a)
a
  c *
    e *
      f
CLIPS> (browse-classes BOGUS)
[CLASSFUN1] Unable to find class 'BOGUS' in function 'browse-classes'.
CLIPS> (browse-classes 34)
[ARGACCES2] Function 'browse-classes' expected argument #1 to be of type symbol.
CLIPS> (ppdefmessage-handler)
[ARGACCES1] Function 'ppdefmessage-handler' expected at least 2 arguments.
CLIPS> (ppdefmessage-handler bogus)
[ARGACCES1] Function 'ppdefmessage-handler' expected at least 2 arguments.
CLIPS> (ppdefmessage-handler bogus bogus)
[MSGCOM2] Unable to find message-handler 'bogus' primary for class 'bogus' in function 'ppdefmessage-handler'.
CLIPS> (ppdefmessage-handler USER bogus)
[MSGCOM2] Unable to find message-handler 'bogus' primary for class 'USER' in function 'ppdefmessage-handler'.
CLIPS> (ppdefmessage-handler bogus init)
[MSGCOM2] Unable to find message-handler 'init' primary for class 'bogus' in function 'ppdefmessage-handler'.
CLIPS> (ppdefmessage-handler USER init)
CLIPS> (ppdefmessage-handler BOY play)
(defmessage-handler MAIN::BOY play
   ()
   (printout t "The boy is now playing..." crlf))
CLIPS> (ppdefmessage-handler BOY play primary)
(defmessage-handler MAIN::BOY play
   ()
   (printout t "The boy is now playing..." crlf))
CLIPS> (ppdefmessage-handler BOY play primary stdout)
(defmessage-handler MAIN::BOY play
   ()
   (printout t "The boy is now playing..." crlf))
CLIPS> (ppdefmessage-handler BOY play primary bogus)
[ROUTER1] Logical name 'bogus' was not recognized by any routers.
CLIPS> (ppdefmessage-handler BOY play primary nil)
"(defmessage-handler MAIN::BOY play
   ()
   (printout t "The boy is now playing..." crlf))
"
CLIPS> (ppdefmessage-handler USER init around)
[MSGCOM2] Unable to find message-handler 'init' around for class 'USER' in function 'ppdefmessage-handler'.
CLIPS> (ppdefmessage-handler USER init before)
[MSGCOM2] Unable to find message-handler 'init' before for class 'USER' in function 'ppdefmessage-handler'.
CLIPS> (ppdefmessage-handler USER init after)
[MSGCOM2] Unable to find message-handler 'init' after for class 'USER' in function 'ppdefmessage-handler'.
CLIPS> (defmessage-handler BOY init after ())
CLIPS> (list-defmessage-handlers)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
play primary in class BOY
init after in class BOY
For a total of 10 message-handlers.
CLIPS> (list-defmessage-handlers *)
[CLASSFUN1] Unable to find class '*' in function 'list-defmessage-handlers'.
CLIPS> (defclass * (is-a USER))
CLIPS> (list-defmessage-handlers)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
play primary in class BOY
init after in class BOY
For a total of 10 message-handlers.
CLIPS> (undefclass *)
CLIPS> (list-defmessage-handlers USER)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
For a total of 8 message-handlers.
CLIPS> (defmessage-handler USER * ())
CLIPS> (defmessage-handler USER bogus ())
CLIPS> (list-defmessage-handlers USER)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
* primary in class USER
bogus primary in class USER
For a total of 10 message-handlers.
CLIPS> (undefmessage-handler USER *)
CLIPS> (list-defmessage-handlers USER)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
bogus primary in class USER
For a total of 9 message-handlers.
CLIPS> (undefmessage-handler)
[ARGACCES1] Function 'undefmessage-handler' expected at least 2 arguments.
CLIPS> (undefmessage-handler * *)
CLIPS> (list-defmessage-handlers)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
init after in class BOY
For a total of 9 message-handlers.
CLIPS> (undefmessage-handler * * *)
CLIPS> (list-defmessage-handlers)
init primary in class USER
delete primary in class USER
create primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
For a total of 8 message-handlers.
CLIPS> (clear)
CLIPS> (defmessage-handler USER my-message around ())
CLIPS> (defmessage-handler USER my-message before ())
CLIPS> (defmessage-handler USER my-message ())
CLIPS> (defmessage-handler USER my-message after ())
CLIPS> (defmessage-handler OBJECT my-message around ())
CLIPS> (defmessage-handler OBJECT my-message before ())
CLIPS> (defmessage-handler OBJECT my-message primary ())
CLIPS> (defmessage-handler OBJECT my-message after ())
CLIPS> (preview-send)
[ARGACCES1] Function 'preview-send' expected exactly 2 arguments.
CLIPS> (preview-send BOGUS blah)
[CLASSFUN1] Unable to find class 'BOGUS' in function 'preview-send'.
CLIPS> (preview-send USER blah)
[MSGFUN1] No applicable primary message-handlers found for 'blah'.
CLIPS> (preview-send USER my-message)
>> my-message around in class USER
| >> my-message around in class OBJECT
| | >> my-message before in class USER
| | << my-message before in class USER
| | >> my-message before in class OBJECT
| | << my-message before in class OBJECT
| | >> my-message primary in class USER
| | | >> my-message primary in class OBJECT
| | | << my-message primary in class OBJECT
| | << my-message primary in class USER
| | >> my-message after in class OBJECT
| | << my-message after in class OBJECT
| | >> my-message after in class USER
| | << my-message after in class USER
| << my-message around in class OBJECT
<< my-message around in class USER
CLIPS> (preview-send OBJECT my-message)
>> my-message around in class OBJECT
| >> my-message before in class OBJECT
| << my-message before in class OBJECT
| >> my-message primary in class OBJECT
| << my-message primary in class OBJECT
| >> my-message after in class OBJECT
| << my-message after in class OBJECT
<< my-message around in class OBJECT
CLIPS> (clear)
CLIPS> (defclass TEST (is-a USER) (role concrete)
   (slot x (create-accessor write)) 
   (multislot y (default ?NONE) (create-accessor write))
   (slot z (create-accessor write)))
CLIPS> (definstances TEST-CASES "Random comment..."
   (t1 of TEST (x 100) (y a b c d e f))
   (t2 of TEST (y blah)))
CLIPS> (ppdefinstances)
[ARGACCES1] Function 'ppdefinstances' expected at least 1 argument.
CLIPS> (ppdefinstances BOGUS)
[PRNTUTIL1] Unable to find definstances 'BOGUS'.
CLIPS> (ppdefinstances 34)
[ARGACCES2] Function 'ppdefinstances' expected argument #1 to be of type symbol.
CLIPS> (ppdefinstances TEST-CASES)
(definstances MAIN::TEST-CASES "Random comment..."
   (t1 of TEST
      (x 100)
      (y a b c d e f))
   (t2 of TEST
      (y blah)))
CLIPS> (ppdefinstances TEST-CASES stdout)
(definstances MAIN::TEST-CASES "Random comment..."
   (t1 of TEST
      (x 100)
      (y a b c d e f))
   (t2 of TEST
      (y blah)))
CLIPS> (ppdefinstances TEST-CASES bogus)
[ROUTER1] Logical name 'bogus' was not recognized by any routers.
CLIPS> (ppdefinstances TEST-CASES nil)
"(definstances MAIN::TEST-CASES "Random comment..."
   (t1 of TEST
      (x 100)
      (y a b c d e f))
   (t2 of TEST
      (y blah)))
"
CLIPS> (list-definstances)
TEST-CASES
For a total of 1 definstances.
CLIPS> (reset)
CLIPS> (instances)
[t1] of TEST
[t2] of TEST
For a total of 2 instances.
CLIPS> (instances MAIN TEST)
[t1] of TEST
[t2] of TEST
For a total of 2 instances.
CLIPS> (instances MAIN USER)
CLIPS> (instances MAIN USER inherit)
[t1] of TEST
[t2] of TEST
For a total of 2 instances.
CLIPS> (instances MAIN BOGUS)
[CLASSFUN1] Unable to find class 'BOGUS' in function 'instances'.
CLIPS> (instances MAIN USER junk)
[ARGACCES2] Function 'instances' expected argument #3 to be of type keyword "inherit".
CLIPS> (send [t1] print)
[t1] of TEST
(x 100)
(y a b c d e f)
(z nil)
CLIPS> (defmessage-handler TEST print ()
   (printout t "Printing twice..." crlf)
   (ppinstance)
   (call-next-handler)
   (printout t "Done!" crlf))
CLIPS> (send [t2] print)
Printing twice...
[t2] of TEST
(x nil)
(y blah)
(z nil)
[t2] of TEST
(x nil)
(y blah)
(z nil)
Done!
CLIPS> (undefinstances)
[ARGACCES1] Function 'undefinstances' expected exactly 1 argument.
CLIPS> (definstances * (t3 of TEST))
CLIPS> (undefinstances *)
CLIPS> (list-definstances)
TEST-CASES
For a total of 1 definstances.
CLIPS> (undefinstances *)
CLIPS> (list-definstances)
CLIPS> (load-instances)
[ARGACCES1] Function 'load-instances' expected exactly 1 argument.
CLIPS> (load-instances 34)
[ARGACCES2] Function 'load-instances' expected argument #1 to be of type symbol or string.
CLIPS> (load-instances "coolcmd.bat")

[PRNTUTIL2] Syntax Error:  Check appropriate syntax for make-instance.
[INSFILE1] Function 'load-instances' could not completely process file 'coolcmd.bat'.
0
CLIPS> (save-instances)
[ARGACCES1] Function 'save-instances' expected at least 1 argument.
CLIPS> (save-instances 34)
[ARGACCES2] Function 'save-instances' expected argument #1 to be of type symbol or string.
CLIPS> (send [t2] put-z (instance-address t1))
<Instance-t1>
CLIPS> (slot-replace$ t1 y 2 2 (instance-address t2))
(a <Instance-t2> c d e f)
CLIPS> (save-instances "Actual//coolcmd2.out")
2
CLIPS> (reset)
CLIPS> (load-instances "Actual//coolcmd2.out")
2
CLIPS> (restore-instances "Actual//coolcmd2.out")
2
CLIPS> (do-for-all-instances ((?a OBJECT)) TRUE (send ?a print))
Printing twice...
[t1] of TEST
(x 100)
(y a [t2] c d e f)
(z nil)
[t1] of TEST
(x 100)
(y a [t2] c d e f)
(z nil)
Done!
Printing twice...
[t2] of TEST
(x nil)
(y blah)
(z [t1])
[t2] of TEST
(x nil)
(y blah)
(z [t1])
Done!
CLIPS> (dribble-off)