1 /*******************************************************/
2 /* "C" Language Integrated Production System */
4 /* CLIPS Version 6.30 08/16/14 */
6 /* FACT RETE PRINT FUNCTIONS MODULE */
7 /*******************************************************/
9 /*************************************************************/
10 /* Purpose: Print routines for the fact rete primitives. */
12 /* Principal Programmer(s): */
15 /* Contributing Programmer(s): */
17 /* Revision History: */
19 /* 6.30: Removed conditional code for unsupported */
20 /* compilers/operating systems (IBM_MCW, */
21 /* MAC_MCW, and IBM_TBC). */
23 /* Changed integer type/precision. */
25 /* Updates to support new struct members. */
27 /* Added const qualifiers to remove C++ */
28 /* deprecation warnings. */
30 /*************************************************************/
32 #define _FACTPRT_SOURCE_
35 #define _STDIO_INCLUDED_
39 #if DEFTEMPLATE_CONSTRUCT && DEFRULE_CONSTRUCT
48 /***************************************/
49 /* PrintFactJNCompVars1: Print routine */
50 /* for the FactJNCompVars1 function. */
51 /***************************************/
52 globle void PrintFactJNCompVars1(
54 const char *logicalName,
58 struct factCompVarsJN1Call *hack;
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,"<> ");
65 EnvPrintRouter(theEnv,logicalName,"p");
66 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern1 + 1);
69 { EnvPrintRouter(theEnv,logicalName," L"); }
71 { EnvPrintRouter(theEnv,logicalName," R"); }
73 EnvPrintRouter(theEnv,logicalName," s");
74 PrintLongInteger(theEnv,logicalName,(long long) hack->slot1);
76 EnvPrintRouter(theEnv,logicalName," p");
77 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern2 + 1);
80 { EnvPrintRouter(theEnv,logicalName," L"); }
82 { EnvPrintRouter(theEnv,logicalName," R"); }
84 EnvPrintRouter(theEnv,logicalName," s");
85 PrintLongInteger(theEnv,logicalName,(long long) hack->slot2);
86 EnvPrintRouter(theEnv,logicalName,")");
89 #pragma unused(theEnv)
90 #pragma unused(logicalName)
91 #pragma unused(theValue)
96 /***************************************/
97 /* PrintFactJNCompVars2: Print routine */
98 /* for the FactJNCompVars2 function. */
99 /***************************************/
100 globle void PrintFactJNCompVars2(
102 const char *logicalName,
106 struct factCompVarsJN2Call *hack;
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,"<> ");
113 EnvPrintRouter(theEnv,logicalName,"p");
114 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern1 + 1);
117 { EnvPrintRouter(theEnv,logicalName," L"); }
118 else if (hack->p1rhs)
119 { EnvPrintRouter(theEnv,logicalName," R"); }
121 EnvPrintRouter(theEnv,logicalName," s");
122 PrintLongInteger(theEnv,logicalName,(long long) hack->slot1);
124 if (hack->fromBeginning1) EnvPrintRouter(theEnv,logicalName, " b");
125 else EnvPrintRouter(theEnv,logicalName," e");
127 EnvPrintRouter(theEnv,logicalName," f");
128 PrintLongInteger(theEnv,logicalName,(long long) hack->offset1);
130 EnvPrintRouter(theEnv,logicalName," p");
131 PrintLongInteger(theEnv,logicalName,(long long) hack->pattern2 + 1);
134 { EnvPrintRouter(theEnv,logicalName," L"); }
135 else if (hack->p2rhs)
136 { EnvPrintRouter(theEnv,logicalName," R"); }
138 EnvPrintRouter(theEnv,logicalName," s");
139 PrintLongInteger(theEnv,logicalName,(long long) hack->slot2);
141 if (hack->fromBeginning2) EnvPrintRouter(theEnv,logicalName," b");
142 else EnvPrintRouter(theEnv,logicalName," e");
144 EnvPrintRouter(theEnv,logicalName," f");
145 PrintLongInteger(theEnv,logicalName,(long long) hack->offset2);
146 EnvPrintRouter(theEnv,logicalName,")");
149 #pragma unused(theEnv)
150 #pragma unused(logicalName)
151 #pragma unused(theValue)
156 /***************************************/
157 /* PrintFactPNCompVars1: Print routine */
158 /* for the FactPNCompVars1 function. */
159 /***************************************/
160 globle void PrintFactPNCompVars1(
162 const char *logicalName,
166 struct factCompVarsPN1Call *hack;
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,")");
178 #pragma unused(theEnv)
179 #pragma unused(logicalName)
180 #pragma unused(theValue)
185 /**************************************/
186 /* PrintFactSlotLength: Print routine */
187 /* for the FactSlotLength function. */
188 /**************************************/
189 globle void PrintFactSlotLength(
191 const char *logicalName,
195 struct factCheckLengthPNCall *hack;
197 hack = (struct factCheckLengthPNCall *) ValueToBitMap(theValue);
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,")");
208 #pragma unused(theEnv)
209 #pragma unused(logicalName)
210 #pragma unused(theValue)
215 /*************************************/
216 /* PrintFactJNGetVar1: Print routine */
217 /* for the FactJNGetvar1 function. */
218 /*************************************/
219 globle void PrintFactJNGetVar1(
221 const char *logicalName,
225 struct factGetVarJN1Call *hack;
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 ");
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);
242 { EnvPrintRouter(theEnv,logicalName," L"); }
244 { EnvPrintRouter(theEnv,logicalName," R"); }
245 EnvPrintRouter(theEnv,logicalName,")");
248 #pragma unused(theEnv)
249 #pragma unused(logicalName)
250 #pragma unused(theValue)
255 /*************************************/
256 /* PrintFactJNGetVar2: Print routine */
257 /* for the FactJNGetvar2 function. */
258 /*************************************/
259 globle void PrintFactJNGetVar2(
261 const char *logicalName,
265 struct factGetVarJN2Call *hack;
267 hack = (struct factGetVarJN2Call *) ValueToBitMap(theValue);
268 EnvPrintRouter(theEnv,logicalName,"(fact-jn-getvar-2");
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);
275 { EnvPrintRouter(theEnv,logicalName," L"); }
277 { EnvPrintRouter(theEnv,logicalName," R"); }
278 EnvPrintRouter(theEnv,logicalName,")");
281 #pragma unused(theEnv)
282 #pragma unused(logicalName)
283 #pragma unused(theValue)
288 /*************************************/
289 /* PrintFactJNGetVar3: Print routine */
290 /* for the FactJNGetVar3 function. */
291 /*************************************/
292 globle void PrintFactJNGetVar3(
294 const char *logicalName,
298 struct factGetVarJN3Call *hack;
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 ");
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);
313 EnvPrintRouter(theEnv,logicalName," p");
314 PrintLongInteger(theEnv,logicalName,(long long) hack->whichPattern + 1);
317 { EnvPrintRouter(theEnv,logicalName," L"); }
319 { EnvPrintRouter(theEnv,logicalName," R"); }
321 EnvPrintRouter(theEnv,logicalName,")");
324 #pragma unused(theEnv)
325 #pragma unused(logicalName)
326 #pragma unused(theValue)
331 /*************************************/
332 /* PrintFactPNGetVar1: Print routine */
333 /* for the FactPNGetvar1 function. */
334 /*************************************/
335 globle void PrintFactPNGetVar1(
337 const char *logicalName,
341 struct factGetVarPN1Call *hack;
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");
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,")");
356 #pragma unused(theEnv)
357 #pragma unused(logicalName)
358 #pragma unused(theValue)
363 /*************************************/
364 /* PrintFactPNGetVar2: Print routine */
365 /* for the FactPNGetvar2 function. */
366 /*************************************/
367 globle void PrintFactPNGetVar2(
369 const char *logicalName,
373 struct factGetVarPN2Call *hack;
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,")");
381 #pragma unused(theEnv)
382 #pragma unused(logicalName)
383 #pragma unused(theValue)
388 /*************************************/
389 /* PrintFactPNGetVar3: Print routine */
390 /* for the FactPNGetvar3 function. */
391 /*************************************/
392 globle void PrintFactPNGetVar3(
394 const char *logicalName,
398 struct factGetVarPN3Call *hack;
400 hack = (struct factGetVarPN3Call *) ValueToBitMap(theValue);
401 EnvPrintRouter(theEnv,logicalName,"(fact-pn-getvar-3 ");
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");
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,")");
416 #pragma unused(theEnv)
417 #pragma unused(logicalName)
418 #pragma unused(theValue)
423 /***************************************/
424 /* PrintFactPNConstant1: Print routine */
425 /* for the FactPNConstant1 function. */
426 /***************************************/
427 globle void PrintFactPNConstant1(
429 const char *logicalName,
433 struct factConstantPN1Call *hack;
435 hack = (struct factConstantPN1Call *) ValueToBitMap(theValue);
437 EnvPrintRouter(theEnv,logicalName,"(fact-pn-constant1 ");
439 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
441 if (hack->testForEquality) EnvPrintRouter(theEnv,logicalName," = ");
442 else EnvPrintRouter(theEnv,logicalName," != ");
444 PrintAtom(theEnv,logicalName,GetFirstArgument()->type,GetFirstArgument()->value);
445 EnvPrintRouter(theEnv,logicalName,")");
448 #pragma unused(theEnv)
449 #pragma unused(logicalName)
450 #pragma unused(theValue)
455 /***************************************/
456 /* PrintFactPNConstant2: Print routine */
457 /* for the FactPNConstant2 function. */
458 /***************************************/
459 globle void PrintFactPNConstant2(
461 const char *logicalName,
465 struct factConstantPN2Call *hack;
467 hack = (struct factConstantPN2Call *) ValueToBitMap(theValue);
469 EnvPrintRouter(theEnv,logicalName,"(fact-pn-constant2 ");
471 PrintLongInteger(theEnv,logicalName,(long long) hack->whichSlot);
473 EnvPrintRouter(theEnv,logicalName," ");
475 PrintLongInteger(theEnv,logicalName,(long long) hack->offset);
477 if (hack->testForEquality) EnvPrintRouter(theEnv,logicalName," = ");
478 else EnvPrintRouter(theEnv,logicalName," != ");
480 PrintAtom(theEnv,logicalName,GetFirstArgument()->type,GetFirstArgument()->value);
481 EnvPrintRouter(theEnv,logicalName,")");
484 #pragma unused(theEnv)
485 #pragma unused(logicalName)
486 #pragma unused(theValue)
491 #endif /* DEFTEMPLATE_CONSTRUCT && DEFRULE_CONSTRUCT */