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
/*******************************************************/
/* "C" Language Integrated Production System */
/* */
/* CLIPS Version 6.40 08/25/16 */
/* */
/* */
/*******************************************************/
/*************************************************************/
/* Purpose: */
/* */
/* Principal Programmer(s): */
/* Brian L. Dantes */
/* */
/* Contributing Programmer(s): */
/* */
/* Revision History: */
/* */
/* 6.23: Correction for FalseSymbol/TrueSymbol. DR0859 */
/* */
/* Corrected compilation errors for files */
/* generated by constructs-to-c. DR0861 */
/* */
/* 6.24: Renamed BOOLEAN macro type to intBool. */
/* */
/* 6.30: Changed integer type/precision. */
/* */
/* Changed garbage collection algorithm. */
/* */
/* Added const qualifiers to remove C++ */
/* deprecation warnings. */
/* */
/* 6.40: Removed LOCALE definition. */
/* */
/* Pragma once and other inclusion changes. */
/* */
/* Added support for booleans with <stdbool.h>. */
/* */
/* Removed use of void pointers for specific */
/* data structures. */
/* */
/* UDF redesign. */
/* */
/*************************************************************/
#ifndef _H_insquery
#pragma once
#define _H_insquery
#if INSTANCE_SET_QUERIES
#include "object.h"
typedef struct query_class
{
Defclass *cls;
Defmodule *theModule;
struct query_class *chain,*nxt;
} QUERY_CLASS;
typedef struct query_soln
{
Instance **soln;
struct query_soln *nxt;
} QUERY_SOLN;
typedef struct query_core
{
Instance **solns;
Expression *query,*action;
QUERY_SOLN *soln_set,*soln_bottom;
unsigned soln_size,soln_cnt;
UDFValue *result;
} QUERY_CORE;
typedef struct query_stack
{
QUERY_CORE *core;
struct query_stack *nxt;
} QUERY_STACK;
#define INSTANCE_QUERY_DATA 31
struct instanceQueryData
{
CLIPSLexeme *QUERY_DELIMITER_SYMBOL;
QUERY_CORE *QueryCore;
QUERY_STACK *QueryCoreStack;
bool AbortQuery;
};
#define InstanceQueryData(theEnv) ((struct instanceQueryData *) GetEnvironmentData(theEnv,INSTANCE_QUERY_DATA))
#define QUERY_DELIMITER_STRING "(QDS)"
void SetupQuery(Environment *);
void GetQueryInstance(Environment *,UDFContext *,UDFValue *);
void GetQueryInstanceSlot(Environment *,UDFContext *,UDFValue *);
void AnyInstances(Environment *,UDFContext *,UDFValue *);
void QueryFindInstance(Environment *,UDFContext *,UDFValue *);
void QueryFindAllInstances(Environment *,UDFContext *,UDFValue *);
void QueryDoForInstance(Environment *,UDFContext *,UDFValue *);
void QueryDoForAllInstances(Environment *,UDFContext *,UDFValue *);
void DelayedQueryDoForAllInstances(Environment *,UDFContext *,UDFValue *);
#endif /* INSTANCE_SET_QUERIES */
#endif /* _H_insquery */