--- ../clipssrc_orig/factqury.c	Thu Jan 20 09:16:20 2005
+++ ../clipssrc/factqury.c	Sun Jan 22 15:48:04 2006
@@ -18,6 +18,8 @@
 /* Revision History:                                         */
 /*      6.23: Added fact-set queries.                        */
 /*                                                           */
+/*      6.24: Corrected errors when compiling as a C++ file. */
+/*                                                           */
 /*************************************************************/
 
 /* =========================================
@@ -181,7 +183,8 @@
       position = 1;
      }
 
-   else if (FindSlot(theFact->whichDeftemplate,temp.value,&position) == NULL)
+   else if (FindSlot((struct deftemplate *) theFact->whichDeftemplate,
+                     (struct symbolHashNode *) temp.value,&position) == NULL)
      {
       SlotExistError(theEnv,ValueToString(temp.value),"fact-set query");
       return;
@@ -710,7 +713,7 @@
   char *func,
   DATA_OBJECT *val)
   {
-   struct deftemplate *template;
+   struct deftemplate *templatePtr;
    QUERY_TEMPLATE *head,*bot,*tmp;
    register long i,end; /* 6.04 Bug Fix */
    char *templateName;
@@ -720,7 +723,7 @@
      {
       IncrementDeftemplateBusyCount(theEnv,(void *) val->value);
       head = get_struct(theEnv,query_template);
-      head->template = (struct deftemplate *) val->value;
+      head->templatePtr = (struct deftemplate *) val->value;
 
       head->chain = NULL;
       head->nxt = NULL;
@@ -735,17 +738,17 @@
          module specifier is not given
          =============================================== */
          
-      template = (struct deftemplate *)
+      templatePtr = (struct deftemplate *)
                        FindImportedConstruct(theEnv,"deftemplate",NULL,DOPToString(val),
                                              &count,TRUE,NULL);
-      if (template == NULL)
+      if (templatePtr == NULL)
         {
          CantFindItemInFunctionErrorMessage(theEnv,"deftemplate",DOPToString(val),func);
          return(NULL);
         }
-      IncrementDeftemplateBusyCount(theEnv,(void *) template);
+      IncrementDeftemplateBusyCount(theEnv,(void *) templatePtr);
       head = get_struct(theEnv,query_template);
-      head->template = template;
+      head->templatePtr = templatePtr;
 
       head->chain = NULL;
       head->nxt = NULL;
@@ -761,11 +764,11 @@
            {
             templateName = ValueToString(GetMFValue(val->value,i));
             
-            template = (struct deftemplate *)
+            templatePtr = (struct deftemplate *)
                        FindImportedConstruct(theEnv,"deftemplate",NULL,templateName,
                                              &count,TRUE,NULL);
 
-            if (template == NULL)
+            if (templatePtr == NULL)
               {
                CantFindItemInFunctionErrorMessage(theEnv,"deftemplate",templateName,func);
                DeleteQueryTemplates(theEnv,head);
@@ -777,9 +780,9 @@
             DeleteQueryTemplates(theEnv,head);
             return(NULL);
            }
-         IncrementDeftemplateBusyCount(theEnv,(void *) template);
+         IncrementDeftemplateBusyCount(theEnv,(void *) templatePtr);
          tmp = get_struct(theEnv,query_template);
-         tmp->template = template;
+         tmp->templatePtr = templatePtr;
 
          tmp->chain = NULL;
          tmp->nxt = NULL;
@@ -815,12 +818,12 @@
         {
          tmp = qlist->chain;
          qlist->chain = qlist->chain->chain;
-         DecrementDeftemplateBusyCount(theEnv,(void *) tmp->template);
+         DecrementDeftemplateBusyCount(theEnv,(void *) tmp->templatePtr);
          rtn_struct(theEnv,query_template,tmp);
         }
       tmp = qlist;
       qlist = qlist->nxt;
-      DecrementDeftemplateBusyCount(theEnv,(void *) tmp->template);
+      DecrementDeftemplateBusyCount(theEnv,(void *) tmp->templatePtr);
       rtn_struct(theEnv,query_template,tmp);
      }
   }
@@ -849,7 +852,7 @@
      {
       FactQueryData(theEnv)->AbortQuery = FALSE;
 
-      if (TestForFirstFactInTemplate(theEnv,qptr->template,qchain,indx))
+      if (TestForFirstFactInTemplate(theEnv,qptr->templatePtr,qchain,indx))
         { return(TRUE); }
         
       if ((EvaluationData(theEnv)->HaltExecution == TRUE) || (FactQueryData(theEnv)->AbortQuery == TRUE))
@@ -871,14 +874,14 @@
  *****************************************************************/
 static int TestForFirstFactInTemplate(
   void *theEnv,
-  struct deftemplate *template,
+  struct deftemplate *templatePtr,
   QUERY_TEMPLATE *qchain,
   int indx)
   {
    struct fact *theFact;
    DATA_OBJECT temp;
 
-   theFact = template->factList;
+   theFact = templatePtr->factList;
    while (theFact != NULL)
      {
       FactQueryData(theEnv)->QueryCore->solns[indx] = theFact;
@@ -945,7 +948,7 @@
      {
       FactQueryData(theEnv)->AbortQuery = FALSE;
 
-      TestEntireTemplate(theEnv,qptr->template,qchain,indx);
+      TestEntireTemplate(theEnv,qptr->templatePtr,qchain,indx);
 
       if ((EvaluationData(theEnv)->HaltExecution == TRUE) || (FactQueryData(theEnv)->AbortQuery == TRUE))
         return;
@@ -967,14 +970,14 @@
  *****************************************************************/
 static void TestEntireTemplate(
   void *theEnv,
-  struct deftemplate *template,
+  struct deftemplate *templatePtr,
   QUERY_TEMPLATE *qchain,
   int indx)
   {
    struct fact *theFact;
    DATA_OBJECT temp;
 
-   theFact = template->factList;
+   theFact = templatePtr->factList;
    while (theFact != NULL)
      {
       FactQueryData(theEnv)->QueryCore->solns[indx] = theFact;
