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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tmpltfun.c

?? clips源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*             CLIPS Version 6.24  07/01/05            */
   /*                                                     */
   /*             DEFTEMPLATE FUNCTIONS MODULE            */
   /*******************************************************/

/*************************************************************/
/* Purpose: Implements the modify and duplicate functions.   */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Gary D. Riley                                        */
/*                                                           */
/* Contributing Programmer(s):                               */
/*                                                           */
/* Revision History:                                         */
/*      6.23: Correction for FalseSymbol/TrueSymbol. DR0859  */
/*                                                           */
/*      6.24: Added deftemplate-slot-names,                  */
/*            deftemplate-slot-default-value,                */
/*            deftemplate-slot-cardinality,                  */
/*            deftemplate-slot-allowed-values,               */
/*            deftemplate-slot-range,                        */
/*            deftemplate-slot-types,                        */
/*            deftemplate-slot-multip,                       */
/*            deftemplate-slot-singlep,                      */
/*            deftemplate-slot-existp, and                   */
/*            deftemplate-slot-defaultp functions.           */
/*                                                           */
/*            Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*************************************************************/

#define _TMPLTFUN_SOURCE_

#include "setup.h"

#if DEFTEMPLATE_CONSTRUCT

#include <stdio.h>
#define _STDIO_INCLUDED_
#include <string.h>

#include "constant.h"
#include "memalloc.h"
#include "symbol.h"
#include "scanner.h"
#include "exprnpsr.h"
#include "envrnmnt.h"
#include "argacces.h"
#include "router.h"
#include "cstrnchk.h"
#include "default.h"
#include "factmngr.h"
#include "commline.h"
#include "factrhs.h"
#include "modulutl.h"
#include "reorder.h"
#include "sysdep.h"
#include "tmpltdef.h"
#include "tmpltlhs.h"
#include "tmpltutl.h"
#include "tmpltrhs.h"

#include "tmpltfun.h"

/***************************************/
/* LOCAL INTERNAL FUNCTION DEFINITIONS */
/***************************************/

   static void                    DuplicateModifyCommand(void *,int,DATA_OBJECT_PTR);
   static SYMBOL_HN              *CheckDeftemplateAndSlotArguments(void *,char *,struct deftemplate **);

#if (! RUN_TIME) && (! BLOAD_ONLY)
   static struct expr            *ModAndDupParse(void *,struct expr *,char *,char *);
   static SYMBOL_HN              *FindTemplateForFactAddress(SYMBOL_HN *,struct lhsParseNode *);
#endif

/****************************************************************/
/* DeftemplateFunctions: Initializes the deftemplate functions. */
/****************************************************************/
globle void DeftemplateFunctions(
  void *theEnv)
  {
#if ! RUN_TIME
   EnvDefineFunction(theEnv,"modify",'u', PTIEF ModifyCommand,"ModifyCommand");
   EnvDefineFunction(theEnv,"duplicate",'u', PTIEF DuplicateCommand,"DuplicateCommand");

   EnvDefineFunction2(theEnv,"deftemplate-slot-names",'u', PTIEF DeftemplateSlotNamesFunction,
                   "DeftemplateSlotNamesFunction", "11z");
   EnvDefineFunction2(theEnv,"deftemplate-slot-default-value",'u',PTIEF DeftemplateSlotDefaultValueFunction,
                   "DeftemplateSlotDefaultValueFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-cardinality",'u',PTIEF DeftemplateSlotCardinalityFunction,
                   "DeftemplateSlotCardinalityFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-allowed-values",'u',PTIEF DeftemplateSlotAllowedValuesFunction,
                   "DeftemplateSlotAllowedValuesFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-range",'u',PTIEF DeftemplateSlotRangeFunction,
                   "DeftemplateSlotRangeFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-types",'u',PTIEF DeftemplateSlotTypesFunction,
                   "DeftemplateSlotTypesFunction","22w");

   EnvDefineFunction2(theEnv,"deftemplate-slot-multip",'b',PTIEF DeftemplateSlotMultiPFunction,
                   "DeftemplateSlotMultiPFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-singlep",'b',PTIEF DeftemplateSlotSinglePFunction,
                   "DeftemplateSlotSinglePFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-existp",'b',PTIEF DeftemplateSlotExistPFunction,
                   "DeftemplateSlotExistPFunction","22w");
   EnvDefineFunction2(theEnv,"deftemplate-slot-defaultp",'w',PTIEF DeftemplateSlotDefaultPFunction,
                   "DeftemplateSlotDefaultPFunction","22w");

#if (! BLOAD_ONLY)
   AddFunctionParser(theEnv,"modify",ModifyParse);
   AddFunctionParser(theEnv,"duplicate",DuplicateParse);
#endif
   FuncSeqOvlFlags(theEnv,"modify",FALSE,FALSE);
   FuncSeqOvlFlags(theEnv,"duplicate",FALSE,FALSE);
#else
#if MAC_MCW || IBM_MCW || MAC_XCD
#pragma unused(theEnv)
#endif
#endif
  }

/*********************************************************************/
/* ModifyCommand: H/L access routine for the modify command. Calls   */
/*   the DuplicateModifyCommand function to perform the actual work. */
/*********************************************************************/
globle void ModifyCommand(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   DuplicateModifyCommand(theEnv,TRUE,returnValue);
  }

/***************************************************************************/
/* DuplicateCommand: H/L access routine for the duplicate command. Calls   */
/*   the DuplicateModifyCommand function to perform the actual work.       */
/***************************************************************************/
globle void DuplicateCommand(
  void *theEnv,
  DATA_OBJECT_PTR returnValue)
  {
   DuplicateModifyCommand(theEnv,FALSE,returnValue);
  }

/***************************************************************/
/* DuplicateModifyCommand: Implements the duplicate and modify */
/*   commands. The fact being duplicated or modified is first  */
/*   copied to a new fact. Replacements to the fields of the   */
/*   new fact are then made. If a modify command is being      */
/*   performed, the original fact is retracted. Lastly, the    */
/*   new fact is asserted.                                     */
/***************************************************************/
static void DuplicateModifyCommand(
  void *theEnv,
  int retractIt,
  DATA_OBJECT_PTR returnValue)
  {
   long long factNum;
   struct fact *oldFact, *newFact, *theFact;
   struct expr *testPtr;
   DATA_OBJECT computeResult;
   struct deftemplate *templatePtr;
   struct templateSlot *slotPtr;
   int i, position, found;

   /*===================================================*/
   /* Set the default return value to the symbol FALSE. */
   /*===================================================*/

   SetpType(returnValue,SYMBOL);
   SetpValue(returnValue,EnvFalseSymbol(theEnv));

   /*==================================================*/
   /* Evaluate the first argument which is used to get */
   /* a pointer to the fact to be modified/duplicated. */
   /*==================================================*/

   testPtr = GetFirstArgument();
   EvaluateExpression(theEnv,testPtr,&computeResult);

   /*==============================================================*/
   /* If an integer is supplied, then treat it as a fact-index and */
   /* search the fact-list for the fact with that fact-index.      */
   /*==============================================================*/

   if (computeResult.type == INTEGER)
     {
      factNum = ValueToLong(computeResult.value);
      if (factNum < 0)
        {
         if (retractIt) ExpectedTypeError2(theEnv,"modify",1);
         else ExpectedTypeError2(theEnv,"duplicate",1);
         SetEvaluationError(theEnv,TRUE);
         return;
        }

      oldFact = (struct fact *) EnvGetNextFact(theEnv,NULL);
      while (oldFact != NULL)
        {
         if (oldFact->factIndex == factNum)
           { break; }
         else
           { oldFact = oldFact->nextFact; }
        }

      if (oldFact == NULL)
        {
         char tempBuffer[20];
         gensprintf(tempBuffer,"f-%lld",factNum);
         CantFindItemErrorMessage(theEnv,"fact",tempBuffer);
         return;
        }
     }

   /*==========================================*/
   /* Otherwise, if a pointer is supplied then */
   /* no lookup is required.                   */
   /*==========================================*/

   else if (computeResult.type == FACT_ADDRESS)
     { oldFact = (struct fact *) computeResult.value; }

   /*===========================================*/
   /* Otherwise, the first argument is invalid. */
   /*===========================================*/

   else
     {
      if (retractIt) ExpectedTypeError2(theEnv,"modify",1);
      else ExpectedTypeError2(theEnv,"duplicate",1);
      SetEvaluationError(theEnv,TRUE);
      return;
     }

   /*==================================*/
   /* See if it is a deftemplate fact. */
   /*==================================*/

   templatePtr = oldFact->whichDeftemplate;

   if (templatePtr->implied) return;

   /*================================================================*/
   /* Duplicate the values from the old fact (skipping multifields). */
   /*================================================================*/

   newFact = (struct fact *) CreateFactBySize(theEnv,oldFact->theProposition.multifieldLength);
   newFact->whichDeftemplate = templatePtr;
   for (i = 0; i < (int) oldFact->theProposition.multifieldLength; i++)
     {
      newFact->theProposition.theFields[i].type = oldFact->theProposition.theFields[i].type;
      if (newFact->theProposition.theFields[i].type != MULTIFIELD)
        { newFact->theProposition.theFields[i].value = oldFact->theProposition.theFields[i].value; }
      else
        { newFact->theProposition.theFields[i].value = NULL; }
     }

   /*========================*/
   /* Start replacing slots. */
   /*========================*/

   testPtr = testPtr->nextArg;
   while (testPtr != NULL)
     {
      /*============================================================*/
      /* If the slot identifier is an integer, then the slot was    */
      /* previously identified and its position within the template */
      /* was stored. Otherwise, the position of the slot within the */
      /* deftemplate has to be determined by comparing the name of  */
      /* the slot against the list of slots for the deftemplate.    */
      /*============================================================*/

      if (testPtr->type == INTEGER)
        { position = (int) ValueToLong(testPtr->value); }
      else
        {
         found = FALSE;
         position = 0;
         slotPtr = templatePtr->slotList;
         while (slotPtr != NULL)
           {
            if (slotPtr->slotName == (SYMBOL_HN *) testPtr->value)
              {
               found = TRUE;
               slotPtr = NULL;
              }
            else
              {
               slotPtr = slotPtr->next;
               position++;
              }
           }

         if (! found)
           {
            InvalidDeftemplateSlotMessage(theEnv,ValueToString(testPtr->value),
                                          ValueToString(templatePtr->header.name),TRUE);
            SetEvaluationError(theEnv,TRUE);
            ReturnFact(theEnv,newFact);
            return;
           }
        }

      /*===================================================*/
      /* If a single field slot is being replaced, then... */
      /*===================================================*/

      if (newFact->theProposition.theFields[position].type != MULTIFIELD)
        {
         /*======================================================*/
         /* If the list of values to store in the slot is empty  */
         /* or contains more than one member than an error has   */
         /* occured because a single field slot can only contain */
         /* a single value.                                      */
         /*======================================================*/

         if ((testPtr->argList == NULL) ? TRUE : (testPtr->argList->nextArg != NULL))
           {
            MultiIntoSingleFieldSlotError(theEnv,GetNthSlot(templatePtr,position),templatePtr);
            ReturnFact(theEnv,newFact);
            return;
           }

         /*===================================================*/
         /* Evaluate the expression to be stored in the slot. */
         /*===================================================*/

         EvaluateExpression(theEnv,testPtr->argList,&computeResult);
         SetEvaluationError(theEnv,FALSE);

         /*====================================================*/
         /* If the expression evaluated to a multifield value, */
         /* then an error occured since a multifield value can */
         /* not be stored in a single field slot.              */
         /*====================================================*/

         if (computeResult.type == MULTIFIELD)
           {
            ReturnFact(theEnv,newFact);
            MultiIntoSingleFieldSlotError(theEnv,GetNthSlot(templatePtr,position),templatePtr);
            return;
           }

         /*=============================*/
         /* Store the value in the slot */
         /*=============================*/

         newFact->theProposition.theFields[position].type =
            computeResult.type;
         newFact->theProposition.theFields[position].value =
            computeResult.value;
        }

      /*=================================*/
      /* Else replace a multifield slot. */
      /*=================================*/

      else
        {
         /*======================================*/
         /* Determine the new value of the slot. */
         /*======================================*/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲自拍都市欧美小说| 国产成人午夜视频| 日韩成人免费在线| 一二三区精品福利视频| 亚洲一区二区视频在线| 亚洲综合男人的天堂| 亚洲国产成人高清精品| 午夜精品在线视频一区| 日韩av在线免费观看不卡| 男女男精品视频| 国产自产2019最新不卡| 丰满白嫩尤物一区二区| 97精品电影院| 91福利在线看| 91精品一区二区三区久久久久久| 91超碰这里只有精品国产| 欧美一区二区在线观看| 久久综合999| 国产精品三级av| 一区二区三区不卡视频在线观看| 亚洲第一主播视频| 男女男精品视频| 国产成人综合网| 一本久久a久久精品亚洲| 欧美三级中文字幕在线观看| 欧美成人一区二区| 欧美高清一级片在线观看| 亚洲精品你懂的| 日韩二区在线观看| 国产高清久久久久| 日本道免费精品一区二区三区| 欧美日韩国产一级二级| 久久综合九色综合欧美就去吻| 国产精品三级电影| 亚洲妇熟xx妇色黄| 国产在线播精品第三| 99精品1区2区| 欧美一区二区三级| 国产精品美女久久福利网站| 亚洲成人自拍一区| 国产东北露脸精品视频| 欧美在线影院一区二区| 精品av综合导航| 亚洲精品视频一区二区| 久久精品国产亚洲5555| 99视频一区二区三区| 91精品国产综合久久香蕉的特点 | 99久久国产综合精品女不卡| 欧美三级韩国三级日本三斤| 久久久99久久| 亚洲国产美女搞黄色| 国产成人福利片| 56国语精品自产拍在线观看| 中国色在线观看另类| 免费高清成人在线| 91久久奴性调教| 国产视频一区在线播放| 日韩黄色小视频| 99精品偷自拍| 久久夜色精品国产噜噜av| 亚洲一区电影777| 国产精品18久久久久久久久久久久| 欧美午夜不卡在线观看免费| 久久精品一区二区三区四区| 午夜国产精品一区| 色综合久久88色综合天天免费| 精品久久人人做人人爰| 亚洲国产精品尤物yw在线观看| 国产suv一区二区三区88区| 6080午夜不卡| 亚洲一区二区影院| 99re热这里只有精品视频| 精品美女一区二区| 日本伊人色综合网| 欧美羞羞免费网站| 亚洲欧美在线观看| 国产999精品久久久久久绿帽| 日韩午夜精品视频| 午夜日韩在线观看| 在线视频中文字幕一区二区| 国产精品久久久久久妇女6080| 国产在线不卡一区| 337p粉嫩大胆噜噜噜噜噜91av| 日韩高清电影一区| 欧美四级电影网| 亚洲黄色免费电影| 在线亚洲人成电影网站色www| 亚洲国产精品99久久久久久久久| 九九国产精品视频| 精品黑人一区二区三区久久| 秋霞午夜鲁丝一区二区老狼| 在线成人午夜影院| 天天av天天翘天天综合网| 精品视频免费看| 亚洲电影在线免费观看| 欧美亚洲综合在线| 亚洲成人动漫在线观看| 欧美日韩中文精品| 亚洲国产日韩综合久久精品| 日本精品一区二区三区高清 | 精品亚洲成a人| 日韩精品一区国产麻豆| 免费看日韩a级影片| 欧美一区二区三区免费视频| 日韩国产在线一| 日韩三级在线观看| 久久av资源站| 久久精品网站免费观看| 成人午夜av电影| 国产精品麻豆一区二区| 99re这里都是精品| 亚洲精品成a人| 欧美色视频一区| 日本成人中文字幕| 精品国产乱码久久久久久闺蜜 | 色菇凉天天综合网| 亚洲电影欧美电影有声小说| 欧美精品xxxxbbbb| 九九在线精品视频| 国产欧美一区二区三区沐欲| 丁香婷婷综合五月| 一区二区三区产品免费精品久久75| 欧美午夜精品久久久| 日韩国产欧美在线观看| 精品久久久久久久人人人人传媒 | 91天堂素人约啪| 亚洲国产精品久久艾草纯爱| 日韩一区和二区| 国产精品996| 日韩伦理av电影| 欧美日韩精品免费观看视频| 日韩av中文在线观看| 久久婷婷色综合| 色综合久久久久综合99| 日韩精品福利网| 国产日韩欧美制服另类| 色老汉一区二区三区| 全国精品久久少妇| 国产精品国产自产拍高清av| 欧美三级电影精品| 国产高清精品网站| 亚洲第一福利一区| 久久久精品日韩欧美| 91久久精品国产91性色tv| 久久黄色级2电影| 日韩理论片中文av| 欧美mv日韩mv国产网站app| 99精品欧美一区二区三区小说| 天堂蜜桃一区二区三区| 中文字幕第一区二区| 欧美日韩精品一区视频| 国产福利一区二区三区视频在线| 一区二区三区精品视频在线| 精品国产乱码久久久久久免费 | 亚洲综合在线第一页| 久久综合狠狠综合| 欧美日韩综合在线| 波多野结衣亚洲| 久久99久国产精品黄毛片色诱| 亚洲欧美色综合| 久久久精品免费免费| 欧美天天综合网| 99久久综合色| 国产一二精品视频| 视频在线观看一区| 亚洲免费观看在线视频| 久久人人爽爽爽人久久久| 制服丝袜在线91| 91高清视频免费看| 国产69精品一区二区亚洲孕妇 | 91麻豆精品91久久久久久清纯 | 久久精品免视看| 欧美一区二区成人6969| 91精品福利在线| 成人a级免费电影| 国产真实乱对白精彩久久| 日日夜夜一区二区| 一区二区三区高清| 亚洲日本在线a| 欧美国产视频在线| 久久午夜国产精品| 欧美一区二区视频网站| 欧美日韩激情一区二区| 91猫先生在线| www.激情成人| 成人激情动漫在线观看| 国产精品夜夜爽| 国产一区三区三区| 激情文学综合丁香| 麻豆精品国产91久久久久久| 日韩成人伦理电影在线观看| 亚洲图片欧美综合| 亚洲午夜久久久久久久久电影院 | 一本色道a无线码一区v| 99国产精品久久久久久久久久 | 国产精品国产三级国产| 欧美国产精品中文字幕| 久久精品一区二区三区不卡牛牛| 精品国产免费人成在线观看| 精品国产一区二区亚洲人成毛片|