亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? factqury.c

?? clips源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*               CLIPS Version 6.24  07/01/05          */
   /*                                                     */
   /*                                                     */
   /*******************************************************/

/*************************************************************/
/* Purpose: Query Functions for Objects                      */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Brian L. Donnell                                     */
/*                                                           */
/* Contributing Programmer(s):                               */
/*      Gary D. Riley                                        */
/*                                                           */
/* Revision History:                                         */
/*                                                           */
/*      6.23: Added fact-set queries.                        */
/*                                                           */
/*      6.24: Corrected errors when compiling as a C++ file. */
/*            DR0868                                         */
/*                                                           */
/*            Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*************************************************************/

/* =========================================
   *****************************************
               EXTERNAL DEFINITIONS
   =========================================
   ***************************************** */
#include "setup.h"

#if FACT_SET_QUERIES

#include "argacces.h"
#include "envrnmnt.h"
#include "memalloc.h"
#include "exprnpsr.h"
#include "modulutl.h"
#include "tmpltutl.h"
#include "insfun.h"
#include "factqpsr.h"
#include "prcdrfun.h"
#include "router.h"
#include "utility.h"

#define _FACTQURY_SOURCE_
#include "factqury.h"

/* =========================================
   *****************************************
      INTERNALLY VISIBLE FUNCTION HEADERS
   =========================================
   ***************************************** */

static void PushQueryCore(void *);
static void PopQueryCore(void *);
static QUERY_CORE *FindQueryCore(void *,int);
static QUERY_TEMPLATE *DetermineQueryTemplates(void *,EXPRESSION *,char *,unsigned *);
static QUERY_TEMPLATE *FormChain(void *,char *,DATA_OBJECT *);
static void DeleteQueryTemplates(void *,QUERY_TEMPLATE *);
static int TestForFirstInChain(void *,QUERY_TEMPLATE *,int);
static int TestForFirstFactInTemplate(void *,struct deftemplate *,QUERY_TEMPLATE *,int);
static void TestEntireChain(void *,QUERY_TEMPLATE *,int);
static void TestEntireTemplate(void *,struct deftemplate *,QUERY_TEMPLATE *,int);
static void AddSolution(void *);
static void PopQuerySoln(void *);

/****************************************************
  NAME         : SetupFactQuery
  DESCRIPTION  : Initializes fact query H/L
                   functions and parsers
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Sets up kernel functions and parsers
  NOTES        : None
 ****************************************************/
globle void SetupFactQuery(
  void *theEnv)
  {
   AllocateEnvironmentData(theEnv,FACT_QUERY_DATA,sizeof(struct factQueryData),NULL);

#if RUN_TIME                                                 
   FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL = FindSymbolHN(theEnv,QUERY_DELIMETER_STRING);
#endif  

#if ! RUN_TIME
   FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL = (SYMBOL_HN *) EnvAddSymbol(theEnv,QUERY_DELIMETER_STRING);
   IncrementSymbolCount(FactQueryData(theEnv)->QUERY_DELIMETER_SYMBOL);

   EnvDefineFunction2(theEnv,"(query-fact)",'u',
                  PTIEF GetQueryFact,"GetQueryFact",NULL);

   EnvDefineFunction2(theEnv,"(query-fact-slot)",'u',
                  PTIEF GetQueryFactSlot,"GetQueryFactSlot",NULL);

   EnvDefineFunction2(theEnv,"any-factp",'b',PTIEF AnyFacts,"AnyFacts",NULL);
   AddFunctionParser(theEnv,"any-factp",FactParseQueryNoAction);

   EnvDefineFunction2(theEnv,"find-fact",'m',
                  PTIEF QueryFindFact,"QueryFindFact",NULL);
   AddFunctionParser(theEnv,"find-fact",FactParseQueryNoAction);

   EnvDefineFunction2(theEnv,"find-all-facts",'m',
                  PTIEF QueryFindAllFacts,"QueryFindAllFacts",NULL);
   AddFunctionParser(theEnv,"find-all-facts",FactParseQueryNoAction);

   EnvDefineFunction2(theEnv,"do-for-fact",'u',
                  PTIEF QueryDoForFact,"QueryDoForFact",NULL);
   AddFunctionParser(theEnv,"do-for-fact",FactParseQueryAction);

   EnvDefineFunction2(theEnv,"do-for-all-facts",'u',
                  PTIEF QueryDoForAllFacts,"QueryDoForAllFacts",NULL);
   AddFunctionParser(theEnv,"do-for-all-facts",FactParseQueryAction);

   EnvDefineFunction2(theEnv,"delayed-do-for-all-facts",'u',
                  PTIEF DelayedQueryDoForAllFacts,
                  "DelayedQueryDoForAllFacts",NULL);
   AddFunctionParser(theEnv,"delayed-do-for-all-facts",FactParseQueryAction);
#endif
  }

/*************************************************************
  NAME         : GetQueryFact
  DESCRIPTION  : Internal function for referring to fact
                    array on fact-queries
  INPUTS       : None
  RETURNS      : The name of the specified fact-set member
  SIDE EFFECTS : None
  NOTES        : H/L Syntax : ((query-fact) <index>)
 *************************************************************/
globle void GetQueryFact(
  void *theEnv,
  DATA_OBJECT *result)
  {
   register QUERY_CORE *core;

   core = FindQueryCore(theEnv,ValueToInteger(GetpValue(GetFirstArgument())));
   
   result->type = FACT_ADDRESS;
   result->value = core->solns[ValueToInteger(GetpValue(GetFirstArgument()->nextArg))];
  }

/***************************************************************************
  NAME         : GetQueryFactSlot
  DESCRIPTION  : Internal function for referring to slots of fact in
                    fact array on fact-queries
  INPUTS       : The caller's result buffer
  RETURNS      : Nothing useful
  SIDE EFFECTS : Caller's result buffer set appropriately
  NOTES        : H/L Syntax : ((query-fact-slot) <index> <slot-name>)
 **************************************************************************/
globle void GetQueryFactSlot(
  void *theEnv,
  DATA_OBJECT *result)
  {
   struct fact *theFact;
   DATA_OBJECT temp;
   QUERY_CORE *core;
   short position;

   result->type = SYMBOL;
   result->value = EnvFalseSymbol(theEnv);

   core = FindQueryCore(theEnv,ValueToInteger(GetpValue(GetFirstArgument())));
   theFact = core->solns[ValueToInteger(GetpValue(GetFirstArgument()->nextArg))];
   EvaluateExpression(theEnv,GetFirstArgument()->nextArg->nextArg,&temp);
   if (temp.type != SYMBOL)
     {
      ExpectedTypeError1(theEnv,"get",1,"symbol");
      SetEvaluationError(theEnv,TRUE);
      return;
     }
     
   /*==================================================*/
   /* Make sure the slot exists (the symbol implied is */
   /* used for the implied slot of an ordered fact).   */
   /*==================================================*/

   if (theFact->whichDeftemplate->implied)
     {
      if (strcmp(ValueToString(temp.value),"implied") != 0)
        {
         SlotExistError(theEnv,ValueToString(temp.value),"fact-set query");
         return;
        }
      position = 1;
     }

   else if (FindSlot((struct deftemplate *) theFact->whichDeftemplate,
                     (struct symbolHashNode *) temp.value,&position) == NULL)
     {
      SlotExistError(theEnv,ValueToString(temp.value),"fact-set query");
      return;
     }
     
   result->type = theFact->theProposition.theFields[position-1].type;
   result->value = theFact->theProposition.theFields[position-1].value;
   if (result->type == MULTIFIELD)
     {
      SetpDOBegin(result,1);
      SetpDOEnd(result,((struct multifield *) result->value)->multifieldLength);
     }
  }

/* =============================================================================
   =============================================================================
   Following are the instance query functions :

     any-factp         : Determines if any facts satisfy the query
     find-fact         : Finds first (set of) fact(s) which satisfies
                               the query and stores it in a multi-field
     find-all-facts    : Finds all (sets of) facts which satisfy the
                               the query and stores them in a multi-field
     do-for-fact       : Executes a given action for the first (set of)
                               fact(s) which satisfy the query
     do-for-all-facts  : Executes an action for all facts which satisfy
                               the query as they are found
     delayed-do-for-all-facts : Same as above - except that the list of facts
                               which satisfy the query is formed before any
                               actions are executed

     Fact candidate search algorithm :

     All permutations of first restriction template facts with other
       restriction template facts (Rightmost are varied first)

     For any one template, fact are examined in the order they were defined

     Example :
     (deftemplate a (slot v))
     (deftemplate b (slot v))
     (deftemplate c (slot v))
     (assert (a (v a1)))
     (assert (a (v a2)))
     (assert (b (v b1)))
     (assert (b (v b2)))
     (assert (c (v c1)))
     (assert (c (v c2)))
     (assert (d (v d1)))
     (assert (d (v d2)))

     (any-factp ((?a a b) (?b c)) <query>)

     The permutations (?a ?b) would be examined in the following order :

     (a1 c1),(a1 c2),(a2 c1),(a2 c2),
     (b1 c1),(b1 c2),(b2 c1),(b2 c2)

   =============================================================================
   ============================================================================= */

/******************************************************************************
  NAME         : AnyFacts
  DESCRIPTION  : Determines if there any existing facts which satisfy
                   the query
  INPUTS       : None
  RETURNS      : TRUE if the query is satisfied, FALSE otherwise
  SIDE EFFECTS : The query template-expressions are evaluated once,
                   and the query boolean-expression is evaluated
                   zero or more times (depending on fact restrictions
                   and how early the expression evaluates to TRUE - if at all).
  NOTES        : H/L Syntax : See FactParseQueryNoAction()
 ******************************************************************************/
globle intBool AnyFacts(
  void *theEnv)
  {
   QUERY_TEMPLATE *qtemplates;
   unsigned rcnt;
   int TestResult;

   qtemplates = DetermineQueryTemplates(theEnv,GetFirstArgument()->nextArg,
                                      "any-factp",&rcnt);
   if (qtemplates == NULL)
     return(FALSE);
   PushQueryCore(theEnv);
   FactQueryData(theEnv)->QueryCore = get_struct(theEnv,query_core);
   FactQueryData(theEnv)->QueryCore->solns = (struct fact **) gm2(theEnv,(sizeof(struct fact *) * rcnt));
   FactQueryData(theEnv)->QueryCore->query = GetFirstArgument();
   TestResult = TestForFirstInChain(theEnv,qtemplates,0);
   FactQueryData(theEnv)->AbortQuery = FALSE;
   rm(theEnv,(void *) FactQueryData(theEnv)->QueryCore->solns,(sizeof(struct fact *) * rcnt));
   rtn_struct(theEnv,query_core,FactQueryData(theEnv)->QueryCore);
   PopQueryCore(theEnv);
   DeleteQueryTemplates(theEnv,qtemplates);
   return(TestResult);
  }

/******************************************************************************
  NAME         : QueryFindFact
  DESCRIPTION  : Finds the first set of facts which satisfy the query and
                   stores their addresses in the user's multi-field variable
  INPUTS       : Caller's result buffer
  RETURNS      : TRUE if the query is satisfied, FALSE otherwise
  SIDE EFFECTS : The query template-expressions are evaluated once,
                   and the query boolean-expression is evaluated
                   zero or more times (depending on fact restrictions
                   and how early the expression evaulates to TRUE - if at all).
  NOTES        : H/L Syntax : See ParseQueryNoAction()
 ******************************************************************************/
globle void QueryFindFact(
  void *theEnv,
  DATA_OBJECT *result)
  {
   QUERY_TEMPLATE *qtemplates;
   unsigned rcnt,i;

   result->type = MULTIFIELD;
   result->begin = 0;
   result->end = -1;
   qtemplates = DetermineQueryTemplates(theEnv,GetFirstArgument()->nextArg,
                                      "find-fact",&rcnt);
   if (qtemplates == NULL)
     {
      result->value = (void *) EnvCreateMultifield(theEnv,0L);
      return;
     }
   PushQueryCore(theEnv);
   FactQueryData(theEnv)->QueryCore = get_struct(theEnv,query_core);
   FactQueryData(theEnv)->QueryCore->solns = (struct fact **)
                      gm2(theEnv,(sizeof(struct fact *) * rcnt));
   FactQueryData(theEnv)->QueryCore->query = GetFirstArgument();
   if (TestForFirstInChain(theEnv,qtemplates,0) == TRUE)
     {
      result->value = (void *) EnvCreateMultifield(theEnv,rcnt);
      SetpDOEnd(result,rcnt);
      for (i = 1 ; i <= rcnt ; i++)
        {
         SetMFType(result->value,i,FACT_ADDRESS);
         SetMFValue(result->value,i,FactQueryData(theEnv)->QueryCore->solns[i - 1]);
        }
     }
   else
      result->value = (void *) EnvCreateMultifield(theEnv,0L);
   FactQueryData(theEnv)->AbortQuery = FALSE;
   rm(theEnv,(void *) FactQueryData(theEnv)->QueryCore->solns,(sizeof(struct fact *) * rcnt));
   rtn_struct(theEnv,query_core,FactQueryData(theEnv)->QueryCore);
   PopQueryCore(theEnv);
   DeleteQueryTemplates(theEnv,qtemplates);
  }

/******************************************************************************
  NAME         : QueryFindAllFacts
  DESCRIPTION  : Finds all sets of facts which satisfy the query and
                   stores their names in the user's multi-field variable

                 The sets are stored sequentially :

                   Number of sets = (Multi-field length) / (Set length)

                 The first set is if the first (set length) atoms of the
                   multi-field variable, and so on.
  INPUTS       : Caller's result buffer
  RETURNS      : Nothing useful
  SIDE EFFECTS : The query template-expressions are evaluated once,
                   and the query boolean-expression is evaluated
                   once for every fact set.
  NOTES        : H/L Syntax : See ParseQueryNoAction()
 ******************************************************************************/
globle void QueryFindAllFacts(
  void *theEnv,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情一区二区三区不卡| 久久精品99久久久| 精彩视频一区二区| 精品国产自在久精品国产| 日本va欧美va瓶| 久久久青草青青国产亚洲免观| 国产三级精品三级| 亚洲国产人成综合网站| 91精品国产色综合久久不卡蜜臀 | 欧美日韩精品久久久| 亚洲曰韩产成在线| 69久久99精品久久久久婷婷| 日韩电影免费一区| 中文字幕在线一区| 欧美区视频在线观看| 国产二区国产一区在线观看| 亚洲国产成人91porn| 久久夜色精品一区| 欧美视频一区二区在线观看| 国内精品伊人久久久久影院对白| 经典一区二区三区| 中文字幕欧美区| 亚洲精品一区二区三区影院| 91精品国产综合久久久久久漫画| 久久夜色精品国产欧美乱极品| jizz一区二区| 国产白丝精品91爽爽久久| 国产精品一卡二卡| 激情综合网天天干| 丁香六月综合激情| 首页综合国产亚洲丝袜| 欧美精品乱码久久久久久按摩| 粉嫩一区二区三区在线看| 亚洲成人黄色小说| 91网址在线看| 国产嫩草影院久久久久| 午夜精品福利一区二区三区av | 91免费版在线| 99久久久国产精品免费蜜臀| 色婷婷综合久久| 91精品国产综合久久福利| 亚洲精品一区二区精华| 一区二区三区四区视频精品免费| 国产欧美视频在线观看| 久久久不卡网国产精品二区| 国产午夜亚洲精品羞羞网站| 久久精品水蜜桃av综合天堂| 国产精品成人在线观看| 亚洲手机成人高清视频| 中文字幕在线观看不卡视频| 亚洲欧美日韩久久| 亚洲黄色av一区| 日韩—二三区免费观看av| 麻豆成人91精品二区三区| 另类小说图片综合网| 青青草视频一区| 日本韩国欧美一区二区三区| 欧美一区二区国产| 欧美精品一卡两卡| 91传媒视频在线播放| 欧美亚洲综合在线| 日韩一区二区电影网| 精品国产一区二区亚洲人成毛片| 久久综合久久99| 亚洲六月丁香色婷婷综合久久| 日本特黄久久久高潮| 国产91丝袜在线观看| 欧美亚洲图片小说| 日韩欧美123| 一区二区三区高清| 国产视频在线观看一区二区三区| 亚洲第一精品在线| 91精品免费在线观看| 综合久久久久综合| 《视频一区视频二区| 日韩电影一二三区| 日韩欧美成人一区二区| 日韩成人精品视频| 亚洲国产综合91精品麻豆| 美女精品一区二区| 国产一区二区在线影院| 69av一区二区三区| 亚洲国产精品人人做人人爽| 99久久久久久99| 日韩电影一区二区三区四区| 亚洲女女做受ⅹxx高潮| 亚洲欧美一区二区三区国产精品| 高清不卡一二三区| 亚洲视频狠狠干| 久久综合九色欧美综合狠狠| 老司机免费视频一区二区| 欧美日本精品一区二区三区| 欧美国产精品劲爆| 成人h精品动漫一区二区三区| 日韩综合在线视频| 精品久久人人做人人爽| 国产成人精品免费网站| 一区二区理论电影在线观看| 不卡av免费在线观看| 日本一区二区动态图| 粉嫩高潮美女一区二区三区| 国产精品黄色在线观看| 99精品视频在线观看| 亚洲图片欧美色图| 国产精品夜夜爽| 亚洲欧美日韩中文播放| 亚洲天堂av一区| 911精品国产一区二区在线| 成人午夜精品在线| 香蕉成人伊视频在线观看| 国产欧美精品区一区二区三区 | 97久久超碰国产精品| 日韩午夜小视频| 中文字幕国产一区二区| av色综合久久天堂av综合| 国模一区二区三区白浆| 亚洲精品成a人| 国产精品久久久久国产精品日日| 日韩欧美二区三区| 日韩一区二区三区电影在线观看 | 悠悠色在线精品| 中文字幕在线一区二区三区| 中文字幕一区二区三区不卡在线| 国产亚洲精品aa午夜观看| 一区二区三区四区乱视频| 91精品国产手机| 欧美精品1区2区3区| 精品中文字幕一区二区小辣椒| 天堂久久一区二区三区| 亚洲韩国一区二区三区| 视频一区在线播放| 男女性色大片免费观看一区二区| 蜜臀av一区二区在线免费观看 | 国产成人精品免费网站| 亚洲三级小视频| 日韩一区中文字幕| 洋洋成人永久网站入口| 天堂成人国产精品一区| 国内成+人亚洲+欧美+综合在线| 国产91丝袜在线播放九色| 在线电影国产精品| xf在线a精品一区二区视频网站| 91精品国产福利在线观看| 日韩一二三四区| 亚洲欧美日韩中文字幕一区二区三区| 一区二区成人在线| 亚洲欧洲精品天堂一级| 欧美激情综合在线| 一区二区三区四区精品在线视频| 久久成人精品无人区| 成人动漫一区二区三区| 日韩欧美国产高清| 亚洲一区二区三区在线| 国产一区二区三区免费看| 欧美亚洲国产bt| 国产欧美一区二区精品久导航| 亚洲成人精品一区| 91免费看视频| 国产精品少妇自拍| 蜜臀av亚洲一区中文字幕| 国内一区二区在线| 日本精品裸体写真集在线观看| 91麻豆精品91久久久久久清纯| 国产精品免费丝袜| 国产激情视频一区二区三区欧美| 欧美丰满一区二区免费视频| 亚洲欧美在线高清| 国产河南妇女毛片精品久久久| 在线播放视频一区| 亚洲一区在线电影| 在线一区二区三区| 伊人色综合久久天天| 亚洲成人免费在线| 午夜精品视频在线观看| 色婷婷久久综合| 亚洲成人免费观看| 91在线观看一区二区| 精品久久国产97色综合| 国产一区二区三区久久久| 日韩欧美一区二区不卡| 精品无人区卡一卡二卡三乱码免费卡| 欧美精品电影在线播放| 丝袜脚交一区二区| 精品黑人一区二区三区久久| 国产精品99久久久久| 亚洲免费毛片网站| av亚洲精华国产精华精华| 亚洲一区二区三区四区在线观看 | 久久久久久一级片| 国产真实乱子伦精品视频| 久久久欧美精品sm网站| 成人一区在线观看| 午夜精品成人在线视频| 日本福利一区二区| 亚洲欧美日韩小说| 一区av在线播放| 欧美日韩三级在线| 懂色av中文一区二区三区| 亚洲综合一区在线| 26uuu亚洲婷婷狠狠天堂|