1 /*******************************************************/
2 /* "C" Language Integrated Production System */
3 /* */
4 /* CLIPS Version 6.30 08/16/14 */
5 /* */
6 /* FACT RETE PRINT FUNCTIONS MODULE */
7 /*******************************************************/
8
9 /*************************************************************/
10 /* Purpose: Print routines for the fact rete primitives. */
11 /* */
12 /* Principal Programmer(s): */
13 /* Gary D. Riley */
14 /* */
15 /* Contributing Programmer(s): */
16 /* */
17 /* Revision History: */
18 /* */
19 /* 6.30: Removed conditional code for unsupported */
20 /* compilers/operating systems (IBM_MCW, */
21 /* MAC_MCW, and IBM_TBC). */
22 /* */
23 /* Changed integer type/precision. */
24 /* */
25 /* Updates to support new struct members. */
26 /* */
27 /* Added const qualifiers to remove C++ */
28 /* deprecation warnings. */
29 /* */
30 /*************************************************************/
31
32 #define _FACTPRT_SOURCE_
33
34 #include <stdio.h>
35 #define _STDIO_INCLUDED_
36
37 #include "setup.h"
38
39 #if DEFTEMPLATE_CONSTRUCT && DEFRULE_CONSTRUCT
40
41 #include "envrnmnt.h"
42 #include "symbol.h"
43 #include "router.h"
44 #include "factgen.h"
45
46 #include "factprt.h"
47
48 /***************************************/
49 /* PrintFactJNCompVars1: Print routine */
50 /* for the FactJNCompVars1 function. */
51 /***************************************/
PrintFactJNCompVars1(void * theEnv,const char * logicalName,void * theValue)52 globle void PrintFactJNCompVars1(
53 void *theEnv,
54 const char *logicalName,
55 void *theValue)
56 {
57 #if DEVELOPER
58 struct factCompVarsJN1Call *hack;
59
60 hack = (struct factCompVarsJN1Call *) ValueToBitMap(theValue);
61 EnvPrintRouter(theEnv,logicalName,"(fact-jn-cmp-vars1 ");
62 if (hack->pass) EnvPrintRouter(theEnv,logicalName,"= ");
63 else EnvPrintRouter(theEnv,logicalName,"<> ");
64
65 EnvPrintRouter(theEnv,logicalName,"p");
66 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern1 + 1);
67
68 if (hack->p1lhs)
69 { EnvPrintRouter(theEnv,logicalName," L"); }
70 else if (hack->p1rhs)
71 { EnvPrintRouter(theEnv,logicalName," R"); }
72
73 EnvPrintRouter(theEnv,logicalName," s");
74 PrintLongInteger(theEnv,logicalName,(long long) hack->slot1);
75
76 EnvPrintRouter(theEnv,logicalName," p");
77 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern2 + 1);
78
79 if (hack->p2lhs)
80 { EnvPrintRouter(theEnv,logicalName," L"); }
81 else if (hack->p2rhs)
82 { EnvPrintRouter(theEnv,logicalName," R"); }
83
84 EnvPrintRouter(theEnv,logicalName," s");
85 PrintLongInteger(theEnv,logicalName,(long long) hack->slot2);
86 EnvPrintRouter(theEnv,logicalName,")");
87 #else
88 #if MAC_XCD
89 #pragma unused(theEnv)
90 #pragma unused(logicalName)
91 #pragma unused(theValue)
92 #endif
93 #endif
94 }
95
96 /***************************************/
97 /* PrintFactJNCompVars2: Print routine */
98 /* for the FactJNCompVars2 function. */
99 /***************************************/
PrintFactJNCompVars2(void * theEnv,const char * logicalName,void * theValue)100 globle void PrintFactJNCompVars2(
101 void *theEnv,
102 const char *logicalName,
103 void *theValue)
104 {
105 #if DEVELOPER
106 struct factCompVarsJN2Call *hack;
107
108 hack = (struct factCompVarsJN2Call *) ValueToBitMap(theValue);
109 EnvPrintRouter(theEnv,logicalName,"(fact-jn-cmp-vars2 ");
110 if (hack->pass) EnvPrintRouter(theEnv,logicalName,"= ");
111 else EnvPrintRouter(theEnv,logicalName,"<> ");
112
113 EnvPrintRouter(theEnv,logicalName,"p");
114 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern1 + 1);
115
116 if (hack->p1lhs)
117 { EnvPrintRouter(theEnv,logicalName," L"); }
118 else if (hack->p1rhs)
119 { EnvPrintRouter(theEnv,logicalName," R"); }
120
121 EnvPrintRouter(theEnv,logicalName," s");
122 PrintLongInteger(theEnv,logicalName,(long long) hack->slot1);
123
124 if (hack->fromBeginning1) EnvPrintRouter(theEnv,logicalName, " b");
125 else EnvPrintRouter(theEnv,logicalName," e");
126
127 EnvPrintRouter(theEnv,logicalName," f");
128 PrintLongInteger(theEnv,logicalName,(long long) hack->offset1);
129
130 EnvPrintRouter(theEnv,logicalName," p");
131 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern2 + 1);
132
133 if (hack->p2lhs)
134 { EnvPrintRouter(theEnv,logicalName," L"); }
135 else if (hack->p2rhs)
136 { EnvPrintRouter(theEnv,logicalName," R"); }
137
138 EnvPrintRouter(theEnv,logicalName," s");
139 PrintLongInteger(theEnv,logicalName,(long long) hack->slot2);
140
141 if (hack->fromBeginning2) EnvPrintRouter(theEnv,logicalName," b");
142 else EnvPrintRouter(theEnv,logicalName," e");
143
144 EnvPrintRouter(theEnv,logicalName," f");
145 PrintLongInteger(theEnv,logicalName,(long long) hack->offset2);
146 EnvPrintRouter(theEnv,logicalName,")");
147 #else
148 #if MAC_XCD
149 #pragma unused(theEnv)
150 #pragma unused(logicalName)
151 #pragma unused(theValue)
152 #endif
153 #endif
154 }
155
156 /***************************************/
157 /* PrintFactPNCompVars1: Print routine */
158 /* for the FactPNCompVars1 function. */
159 /***************************************/
PrintFactPNCompVars1(void * theEnv,const char * logicalName,void * theValue)160 globle void PrintFactPNCompVars1(
161 void *theEnv,
162 const char *logicalName,
163 void *theValue)
164 {
165 #if DEVELOPER
166 struct factCompVarsPN1Call *hack;
167
168 hack = (struct factCompVarsPN1Call *) ValueToBitMap(theValue);
169 EnvPrintRouter(theEnv,logicalName,"(fact-pn-cmp-vars ");
170 if (hack->pass) EnvPrintRouter(theEnv,logicalName,"p ");
171 else EnvPrintRouter(theEnv,logicalName,"n ");
172 PrintLongInteger(theEnv,logicalName,(long long) hack->field1);
173 EnvPrintRouter(theEnv,logicalName," ");
174 PrintLongInteger(theEnv,logicalName,(long long) hack->field2);
175 EnvPrintRouter(theEnv,logicalName,")");
176 #else
177 #if MAC_XCD
178 #pragma unused(theEnv)
179 #pragma unused(logicalName)
180 #pragma unused(theValue)
181 #endif
182 #endif
183 }
184
185 /**************************************/
186 /* PrintFactSlotLength: Print routine */
187 /* for the FactSlotLength function. */
188 /**************************************/
PrintFactSlotLength(void * theEnv,const char * logicalName,void * theValue)189 globle void PrintFactSlotLength(
190 void *theEnv,
191 const char *logicalName,
192 void *theValue)
193 {
194 #if DEVELOPER
195 struct factCheckLengthPNCall *hack;
196
197 hack = (struct factCheckLengthPNCall *) ValueToBitMap(theValue);
198
199 EnvPrintRouter(theEnv,logicalName,"(slot-length ");
200 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
201 EnvPrintRouter(theEnv,logicalName," ");
202 if (hack->exactly) EnvPrintRouter(theEnv,logicalName,"= ");
203 else EnvPrintRouter(theEnv,logicalName,">= ");
204 PrintLongInteger(theEnv,logicalName,(long long) hack->minLength);
205 EnvPrintRouter(theEnv,logicalName,")");
206 #else
207 #if MAC_XCD
208 #pragma unused(theEnv)
209 #pragma unused(logicalName)
210 #pragma unused(theValue)
211 #endif
212 #endif
213 }
214
215 /*************************************/
216 /* PrintFactJNGetVar1: Print routine */
217 /* for the FactJNGetvar1 function. */
218 /*************************************/
PrintFactJNGetVar1(void * theEnv,const char * logicalName,void * theValue)219 globle void PrintFactJNGetVar1(
220 void *theEnv,
221 const char *logicalName,
222 void *theValue)
223 {
224 #if DEVELOPER
225 struct factGetVarJN1Call *hack;
226
227 hack = (struct factGetVarJN1Call *) ValueToBitMap(theValue);
228 EnvPrintRouter(theEnv,logicalName,"(fact-jn-getvar-1 ");
229 if (hack->factAddress) EnvPrintRouter(theEnv,logicalName,"t ");
230 else EnvPrintRouter(theEnv,logicalName,"f ");
231 if (hack->allFields) EnvPrintRouter(theEnv,logicalName,"t ");
232 else EnvPrintRouter(theEnv,logicalName,"f ");
233
234 EnvPrintRouter(theEnv,logicalName,"p");
235 PrintLongInteger(theEnv,logicalName,(long long) hack->whichPattern + 1);
236 EnvPrintRouter(theEnv,logicalName," ");
237 PrintLongInteger(theEnv,logicalName,(long long) hack->whichField);
238 EnvPrintRouter(theEnv,logicalName," s");
239 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
240
241 if (hack->lhs)
242 { EnvPrintRouter(theEnv,logicalName," L"); }
243 else if (hack->rhs)
244 { EnvPrintRouter(theEnv,logicalName," R"); }
245 EnvPrintRouter(theEnv,logicalName,")");
246 #else
247 #if MAC_XCD
248 #pragma unused(theEnv)
249 #pragma unused(logicalName)
250 #pragma unused(theValue)
251 #endif
252 #endif
253 }
254
255 /*************************************/
256 /* PrintFactJNGetVar2: Print routine */
257 /* for the FactJNGetvar2 function. */
258 /*************************************/
PrintFactJNGetVar2(void * theEnv,const char * logicalName,void * theValue)259 globle void PrintFactJNGetVar2(
260 void *theEnv,
261 const char *logicalName,
262 void *theValue)
263 {
264 #if DEVELOPER
265 struct factGetVarJN2Call *hack;
266
267 hack = (struct factGetVarJN2Call *) ValueToBitMap(theValue);
268 EnvPrintRouter(theEnv,logicalName,"(fact-jn-getvar-2");
269
270 EnvPrintRouter(theEnv,logicalName," p");
271 PrintLongInteger(theEnv,logicalName,(long long) hack->whichPattern + 1);
272 EnvPrintRouter(theEnv,logicalName," s");
273 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
274 if (hack->lhs)
275 { EnvPrintRouter(theEnv,logicalName," L"); }
276 else if (hack->rhs)
277 { EnvPrintRouter(theEnv,logicalName," R"); }
278 EnvPrintRouter(theEnv,logicalName,")");
279 #else
280 #if MAC_XCD
281 #pragma unused(theEnv)
282 #pragma unused(logicalName)
283 #pragma unused(theValue)
284 #endif
285 #endif
286 }
287
288 /*************************************/
289 /* PrintFactJNGetVar3: Print routine */
290 /* for the FactJNGetVar3 function. */
291 /*************************************/
PrintFactJNGetVar3(void * theEnv,const char * logicalName,void * theValue)292 globle void PrintFactJNGetVar3(
293 void *theEnv,
294 const char *logicalName,
295 void *theValue)
296 {
297 #if DEVELOPER
298 struct factGetVarJN3Call *hack;
299
300 hack = (struct factGetVarJN3Call *) ValueToBitMap(theValue);
301 EnvPrintRouter(theEnv,logicalName,"(fact-jn-getvar-3 ");
302 if (hack->fromBeginning) EnvPrintRouter(theEnv,logicalName,"t ");
303 else EnvPrintRouter(theEnv,logicalName,"f ");
304 if (hack->fromEnd) EnvPrintRouter(theEnv,logicalName,"t ");
305 else EnvPrintRouter(theEnv,logicalName,"f ");
306
307 PrintLongInteger(theEnv,logicalName,(long long) hack->beginOffset);
308 EnvPrintRouter(theEnv,logicalName," ");
309 PrintLongInteger(theEnv,logicalName,(long long) hack->endOffset);
310 EnvPrintRouter(theEnv,logicalName," ");
311 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
312
313 EnvPrintRouter(theEnv,logicalName," p");
314 PrintLongInteger(theEnv,logicalName,(long long) hack->whichPattern + 1);
315
316 if (hack->lhs)
317 { EnvPrintRouter(theEnv,logicalName," L"); }
318 else if (hack->rhs)
319 { EnvPrintRouter(theEnv,logicalName," R"); }
320
321 EnvPrintRouter(theEnv,logicalName,")");
322 #else
323 #if MAC_XCD
324 #pragma unused(theEnv)
325 #pragma unused(logicalName)
326 #pragma unused(theValue)
327 #endif
328 #endif
329 }
330
331 /*************************************/
332 /* PrintFactPNGetVar1: Print routine */
333 /* for the FactPNGetvar1 function. */
334 /*************************************/
PrintFactPNGetVar1(void * theEnv,const char * logicalName,void * theValue)335 globle void PrintFactPNGetVar1(
336 void *theEnv,
337 const char *logicalName,
338 void *theValue)
339 {
340 #if DEVELOPER
341 struct factGetVarPN1Call *hack;
342
343 hack = (struct factGetVarPN1Call *) ValueToBitMap(theValue);
344 EnvPrintRouter(theEnv,logicalName,"(fact-pn-getvar-1 ");
345 if (hack->factAddress) EnvPrintRouter(theEnv,logicalName,"t ");
346 else EnvPrintRouter(theEnv,logicalName,"f ");
347 if (hack->allFields) EnvPrintRouter(theEnv,logicalName,"t F");
348 else EnvPrintRouter(theEnv,logicalName,"f F");
349
350 PrintLongInteger(theEnv,logicalName,(long long) hack->whichField);
351 EnvPrintRouter(theEnv,logicalName," S");
352 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
353 EnvPrintRouter(theEnv,logicalName,")");
354 #else
355 #if MAC_XCD
356 #pragma unused(theEnv)
357 #pragma unused(logicalName)
358 #pragma unused(theValue)
359 #endif
360 #endif
361 }
362
363 /*************************************/
364 /* PrintFactPNGetVar2: Print routine */
365 /* for the FactPNGetvar2 function. */
366 /*************************************/
PrintFactPNGetVar2(void * theEnv,const char * logicalName,void * theValue)367 globle void PrintFactPNGetVar2(
368 void *theEnv,
369 const char *logicalName,
370 void *theValue)
371 {
372 #if DEVELOPER
373 struct factGetVarPN2Call *hack;
374
375 hack = (struct factGetVarPN2Call *) ValueToBitMap(theValue);;
376 EnvPrintRouter(theEnv,logicalName,"(fact-pn-getvar-2 S");
377 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
378 EnvPrintRouter(theEnv,logicalName,")");
379 #else
380 #if MAC_XCD
381 #pragma unused(theEnv)
382 #pragma unused(logicalName)
383 #pragma unused(theValue)
384 #endif
385 #endif
386 }
387
388 /*************************************/
389 /* PrintFactPNGetVar3: Print routine */
390 /* for the FactPNGetvar3 function. */
391 /*************************************/
PrintFactPNGetVar3(void * theEnv,const char * logicalName,void * theValue)392 globle void PrintFactPNGetVar3(
393 void *theEnv,
394 const char *logicalName,
395 void *theValue)
396 {
397 #if DEVELOPER
398 struct factGetVarPN3Call *hack;
399
400 hack = (struct factGetVarPN3Call *) ValueToBitMap(theValue);
401 EnvPrintRouter(theEnv,logicalName,"(fact-pn-getvar-3 ");
402
403 if (hack->fromBeginning) EnvPrintRouter(theEnv,logicalName,"t ");
404 else EnvPrintRouter(theEnv,logicalName,"f ");
405 if (hack->fromEnd) EnvPrintRouter(theEnv,logicalName,"t B");
406 else EnvPrintRouter(theEnv,logicalName,"f B");
407
408 PrintLongInteger(theEnv,logicalName,(long long) hack->beginOffset);
409 EnvPrintRouter(theEnv,logicalName," E");
410 PrintLongInteger(theEnv,logicalName,(long long) hack->endOffset);
411 EnvPrintRouter(theEnv,logicalName," S");
412 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
413 EnvPrintRouter(theEnv,logicalName,")");
414 #else
415 #if MAC_XCD
416 #pragma unused(theEnv)
417 #pragma unused(logicalName)
418 #pragma unused(theValue)
419 #endif
420 #endif
421 }
422
423 /***************************************/
424 /* PrintFactPNConstant1: Print routine */
425 /* for the FactPNConstant1 function. */
426 /***************************************/
PrintFactPNConstant1(void * theEnv,const char * logicalName,void * theValue)427 globle void PrintFactPNConstant1(
428 void *theEnv,
429 const char *logicalName,
430 void *theValue)
431 {
432 #if DEVELOPER
433 struct factConstantPN1Call *hack;
434
435 hack = (struct factConstantPN1Call *) ValueToBitMap(theValue);
436
437 EnvPrintRouter(theEnv,logicalName,"(fact-pn-constant1 ");
438
439 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
440
441 if (hack->testForEquality) EnvPrintRouter(theEnv,logicalName," = ");
442 else EnvPrintRouter(theEnv,logicalName," != ");
443
444 PrintAtom(theEnv,logicalName,GetFirstArgument()->type,GetFirstArgument()->value);
445 EnvPrintRouter(theEnv,logicalName,")");
446 #else
447 #if MAC_XCD
448 #pragma unused(theEnv)
449 #pragma unused(logicalName)
450 #pragma unused(theValue)
451 #endif
452 #endif
453 }
454
455 /***************************************/
456 /* PrintFactPNConstant2: Print routine */
457 /* for the FactPNConstant2 function. */
458 /***************************************/
PrintFactPNConstant2(void * theEnv,const char * logicalName,void * theValue)459 globle void PrintFactPNConstant2(
460 void *theEnv,
461 const char *logicalName,
462 void *theValue)
463 {
464 #if DEVELOPER
465 struct factConstantPN2Call *hack;
466
467 hack = (struct factConstantPN2Call *) ValueToBitMap(theValue);
468
469 EnvPrintRouter(theEnv,logicalName,"(fact-pn-constant2 ");
470
471 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
472
473 EnvPrintRouter(theEnv,logicalName," ");
474
475 PrintLongInteger(theEnv,logicalName,(long long) hack->offset);
476
477 if (hack->testForEquality) EnvPrintRouter(theEnv,logicalName," = ");
478 else EnvPrintRouter(theEnv,logicalName," != ");
479
480 PrintAtom(theEnv,logicalName,GetFirstArgument()->type,GetFirstArgument()->value);
481 EnvPrintRouter(theEnv,logicalName,")");
482 #else
483 #if MAC_XCD
484 #pragma unused(theEnv)
485 #pragma unused(logicalName)
486 #pragma unused(theValue)
487 #endif
488 #endif
489 }
490
491 #endif /* DEFTEMPLATE_CONSTRUCT && DEFRULE_CONSTRUCT */
492
493
494