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

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

?? clipsmfc_old.cpp

?? clips專家系統(tǒng)內(nèi)核打包類,很有參考性.
?? CPP
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/*
clipsMFC.cpp : implementation file for a CLIPS Wrapper class using MFC

Notes:			Allows encapsulation of the 'C' interface for CLIPS. Also adds
				enhanced parameter/error checking, and simplifies the
				housekeeping that is needed in the main application as a lot of
				this is handled by class instance variables. It should also be
				relatively easy to expand this class to cover more of the
				CLIPS interface than I initially used.
			**  there are a lot of definitions in the first portion of the 
			    header file, please review these settings and adjust to suit the
				needs of YOUR project.

Author(s):	Mark Tomlinson, Michael Giordano
			

Version:		2.0

Revision	WHO		Date  		WHY
--------------------------------------------------
1.1			mdt		5/4/96		instance & dynaload
1.5         mdt     6/19/97		Added Build()
1.6			mdt	    9/29/97		added createfact
1.7			mjg		1/21/98		added ODBC Query
1.8         mjg     1/29/98		added UserDefined router support
1.9         mdt     1/31/98		minor bug fixes, mods to UserDefined routers   
2.0			mdt/mjg 2/21/98		minor bug in WriteFactSlot, added UserFunctions
2.2			mdt		7/15/98		Major overhaul of route buffers
2.3         sj      5/12/99     AddResetFunction()
3.0			mdt		5/16/99		First major overhaul in many moons
								fixed many little problems and
								cleaned up code (such as using CLIPS
								pointer validation routines), all
								references to external CString* converted
								to CString &  and added the following:
								PeriodicCleanup()

*/
#ifndef _DEBUG
#pragma optimize("",off)
#pragma optimize("q",off)
#endif

#define NON_VERBOSE_LOG 1
#define DEF_CB_PRIORITY 1


//stream i/o
#include <iostream.h> 	//ios
#include <fstream.h> 	//ofstream                  
#include <direct.h>

#ifndef __AFX_H__
	#include <afx.h>
#endif
#ifndef __AFXCOLL_H__
	#include <afxcoll.h>
#endif

#define __defc
//default loop count
int		Defcount;
//running flag
bool	Running;
//error log file
char	ErrorLog[_MAX_PATH] = "";

//macro used to check GPA() return values
#define CHKFNPTR(p,s)	if (p == NULL) { \
	                    char t_buf[100]; \
						sprintf(t_buf,"Unable to locate CLIPS entry point for function: %s",s); \
						::MessageBox(NULL,t_buf,"CLIPSWrap::GetProcAddress",MB_OK); \
						return FALSE; }
//macro to load a given proc address from CLIPS DLL
#define GPA(p,t,n)	p = (t) GetProcAddress(m_hLib,n); \
				    CHKFNPTR(p,n)
/////////////////////////////////////////////////////////////////////////////
// exported functions for DLL suppport/callbacks


//include for all clips defs
extern "C"	{
#include <dynclips.h>
}
//class definition
#include <clipsmfc.h>
#ifdef USE_ODBC
	//Header files for ODBC Query
	#include <afxdb.h>
	#include "rsvarcol.h"	//Class definition for CVarRecordset
#endif

extern "C"	{
/*	some global variables */
//array of pointer to the string buffers for memory routes
//CObjArray
CStringArray*	pRoutes[NUMROUTES];
CString*	    pRteNames[NUMROUTES];
//string arrays to manage lists of file routes
CStringArray*	FileRoutes;
CStringArray*	FileNames;
}

//prototype for generic CB function which can be set to fire periodically
void far       (*CBfunctPtr)(bool);

/*
This function handles out of memory conditions for CLIPS, this is a callback
from CLIPS.
*/ 
extern "C" int DllExport ReportMemoryProblems(unsigned long p)
{
//!!!    (dl_PeriodicCleanup)(TRUE, TRUE);
	return 0;
}

/*
This function captures which routes we will handle, this is a callback
from CLIPS.
*/
extern "C" int DllExport captureQuery(char *router)
{
	/*
	If the router comes from stdout, stdin, wclips, wdisplay, ...,
  then we will accept the output.  Otherwise, pass the buck onto
  someone else. This could be done using a string container class.
	*/
	//return true if we handle this route, and false if not.
	if(IsDefaultRouter(router))	{
		return TRUE;
	}
	return (GetRouteNum(0,router) != -1);
}

/*
This function actually handles what to do with the routed
information. This is a callback from CLIPS.
*/
extern "C" int DllExport capturePrint(char far* router, char far* str)
{
 static CString message;
	CString		hold;
	CString		Route;
	int			rnum = 0, i, n = -1;

    if(strlen(ErrorLog) == 0)	{
		//get Windows directory - this is where we want to put it
		memset(ErrorLog,0,256);
		GetWindowsDirectory(ErrorLog,255);
		strcat(ErrorLog,"\\CLIPSDLL.ERR");
	}

	// Dump all routes to the file CLIPSDLL.ERR
	// if not handled in another way, in this code
	// the "other way" is to copy the string into
	// an array which was initialized elsewhere.
	// since CLIPS does not actually format the route
	// data you could add a routine to collect all the
	// output data on a given route until a CRLF was recieved
	// thus building a single string of output.
	//(ex-) (str-cat ?item1 ?item2 ?item3 ... "some text" ...)
	//      (printout wwhatever ..........)
	bool fHandled = false;

	hold = str;
	// loop in case there is more than 1 buffer/route
	while ((rnum = GetRouteNum(rnum,router)) != -1)	{
		if(pRoutes[rnum] != NULL)	{
			pRoutes[rnum]->Add(str);
			fHandled = true;
		}
		++rnum;
	}
	Route = router;
	if (FileRoutes!=NULL)	{
		for(i = 0; i < FileRoutes->GetSize(); i++)	{
			if(FileRoutes->GetAt(i) == Route)	{
				n = i;
			}
			if(n != -1)	{
				ofstream *ofFile;
				ofFile = new ofstream(FileNames->GetAt(i),ios::out | ios::app | ios::binary);
				long		i = 0;

				(*ofFile) << hold;
#if VERBOSE_LOG
				(*ofFile) << "\r\n";
#endif
				fHandled = true;
				delete ofFile;
		  	}
		}
	}

	if(!fHandled)	{
		// create the error log for unhandled routes
		ofstream *ofError;
				
		ofError = new ofstream(ErrorLog,ios::out | ios::app | ios::binary);

        //is it a EOL situation?
		if((strncmp((LPCSTR)hold,"\r\n",2)!= 0)	&&
		   (strncmp((LPCSTR)hold,"\r",1)!= 0) 	&&
		   (strncmp((LPCSTR)hold,"\n",1)!= 0))	{
            if(message.GetLength() > MBUFSIZE) {  //don't let it get too big
    			(*ofError) << message;
#if VERBOSE_LOG
	    		(*ofError) << "\r\n";
#endif
                message.Empty();
            }
            if(message.GetLength() == 0)   {
    			message += "\r\n";
	    		message += "Msg from ";
    			message += (char *)router;
                message += ": ";
            }
            message += hold;
        }
        else    {
			(*ofError) << message;
#if VERBOSE_LOG
			(*ofError) << "\r\n";
#endif
            message.Empty();
		}
		delete ofError;
	}
	return TRUE;
}	//end of extern 'c' declaration block

//return ordinal number of specified route
int GetRouteNum(int start, const char far* route)
{
	int rnum = -1;

	for(int i = start; i < NUMROUTES; i++)	{
		if(pRteNames[i] != NULL)	{
			if(pRteNames[i]->CompareNoCase(route) == 0)	{
				rnum = i;
				break;
			}
		}
	}
	return rnum;
}

//check to see if router is a system defualt router name
bool IsDefaultRouter(const char * route)
{
	if((_stricmp(route, "stdout")==0)		||
	   (_stricmp(route, "werror")==0)		||
	   (_stricmp(route, "wclips")==0)		||
	   (_stricmp(route, "wdisplay")==0)	||
	   (_stricmp(route, "wdialog")==0)	||
	   (_stricmp(route, "wtrace")==0)		||
	   (_stricmp(route, "wagenda")==0)	||
	   (_stricmp(route, "wwarning")==0))	{
		return true;
	}
	return false;
}

/////////////////////////////////////////////////////////////////////////////
// CCLIPSWrap - all class implementation functions

//constructor
//note: construction does NOT load the DLL
CCLIPSWrap::CCLIPSWrap(int count)
	: factPtr (NULL), rulePtr (NULL), modulePtr (NULL), globalPtr (NULL),
	  instancePtr (NULL), classPtr (NULL), m_hLib (NULL)
{
	int i;

	Defcount = count;
	Running = false;
	m_fClipsInit = false;
	CLEARMBUF
	for(i = 0; i < NUMROUTES; i++)	{
		pRoutes[i]   = NULL;
		pRteNames[i] = NULL;
		}
	FileRoutes	  = NULL;
	FileNames	  = NULL;       
	CBfunctPtr    = NULL;
	factPtr       = NULL;
	modulePtr     = NULL;
	rulePtr       = NULL;
	globalPtr     = NULL;
	instancePtr   = NULL;
	classPtr      = NULL;
	activationPtr = NULL;
	agendaPtr     = NULL;
	templatePtr   = NULL;
	insSlotPtr    = NULL;
	tempSlotPtr   = NULL;
	fastLoad      = NULL;
	fastSave      = NULL;
}

//destructor
//cleanup memory
CCLIPSWrap::~CCLIPSWrap(void)
{
	CBfunctPtr    = NULL;
	factPtr       = NULL;
	modulePtr     = NULL;
	rulePtr       = NULL;
	globalPtr     = NULL;
	instancePtr   = NULL;
	classPtr      = NULL;
	activationPtr = NULL;
	agendaPtr     = NULL;
	templatePtr   = NULL;
	insSlotPtr    = NULL;
	tempSlotPtr   = NULL;
	fastLoad      = NULL;
	fastSave      = NULL;
	if(FileRoutes != NULL)	{
		delete FileRoutes;
		FileRoutes = NULL;
		}
	if(FileNames != NULL)	{
		delete FileNames;
		FileNames = NULL;
		}
//the route buffers in memory will not be deleted
//since we did not allocate them in this class
	for(int i = 0; i < NUMROUTES; i++)	{
		if(pRteNames[i] != NULL)	{
			delete pRteNames[i];
			pRteNames[i] = NULL;
		}
	}
}

/////////////////////////////////////////////////////////////////////////////
// virtual functions

/***************************************************************************
		Function	:	CCLIPSWrap::SetErrorLog(CString& filename)
		Author		:	Mark Tomlinson
		Desc.		:	set filename & path for error route log filename
		Returns		:	none
****************************************************************************/
void CCLIPSWrap::SetErrorLog(CString& filename)
{
	strcpy(ErrorLog,(LPCSTR)(filename));
}

/***************************************************************************
		Function	:	CCLIPSWrap::SetMsgLoopCBfn(void far (*func_ptr)(void))
		Author		:	Mark Tomlinson
		Desc.		:	set callback function which be invoked during msgpump loops
		Returns		:	none
****************************************************************************/
void CCLIPSWrap::SetMsgLoopCBfn(void far (*func_ptr)(bool))
{
	CBfunctPtr = func_ptr;
}

/****************************************************************************
		Function	: 	CCLIPSWrap::CLIPSInit(void)
		Author		: 	Mark Tomlinson
		Desc.		: 	Accessor function to CLIPS InitilizeCLIPS(), also will
						load the DLL into memory, get procedure entry points &
						initialize the default capture router.
		Returns 	: 	true on success, false if it fails.
****************************************************************************/
bool CCLIPSWrap::CLIPSInit(void)
{
	if(m_fClipsInit)
		return true;
//now decide which DLL to load...
	if(m_hLib == NULL)	{
#ifdef WIN32
		m_hLib = LoadLibrary ("clips.dll");
#else
		m_hLib = LoadLibrary ("clipsdll.dll");
#endif
	}
	if(m_hLib == NULL)
		return false;

	if(LoadDllReferences() == false)	{
		//unload the library
		FreeLibrary(m_hLib);
		m_hLib = NULL;
		return false;
	}

	//call init clips
	(dl_InitializeCLIPS)();

	//set message pump callback function to prevent a hang
	//of the system when CLIPS is doing lengthy processing
	//not exactly needed in WIN32 - essential in WIN16
#ifndef WIN32
	(dl_AddPeriodicFunction)("msgpump",MsgLoopProc,1);
#endif
	//set out of memory handler function
	(dl_SetOutOfMemoryFunction)((unsigned long)ReportMemoryProblems);

	//tell CLIPS to be quiet while loading files
	(dl_SetPrintWhileLoading)(false);

	// add router to handle output from DLL functions, (if any), although
	// you are best to assume some output so as not to overwrite the
	// windows desktop with TTY output from the DLL. Then return.
	if((dl_AddRouter)("capture", 20, (int (*)(char *))captureQuery, (int (*)(char *,char *))capturePrint, NULL, NULL, NULL))	{
		m_fClipsInit = true;
		return true;
		}
	//failed
	return false;
}

/***************************************************************************
		Function	:	CCLIPSWrap::CLIPSReset(void)
		Author		:	Mark Tomlinson
		Desc.		:	Accessor function for CLIPS Reset
		Returns		:	true on success, false on error
****************************************************************************/
bool CCLIPSWrap::CLIPSReset(void)
{
	INITCHK(false)
	(dl_Reset)();
	return true;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产三级国产aⅴ入口| 国内欧美视频一区二区| 国产精品国模大尺度视频| 久久婷婷国产综合精品青草| 日韩午夜在线播放| 日韩一区国产二区欧美三区| 欧美一级xxx| 日韩欧美国产三级电影视频| 日韩精品一区二| 日韩欧美国产不卡| 亚洲精品一线二线三线无人区| 精品国产欧美一区二区| 久久久美女毛片| 中文字幕高清一区| 亚洲色图欧美偷拍| 亚洲午夜精品在线| 日韩二区在线观看| 精品一区免费av| 国产成人精品影视| jlzzjlzz亚洲女人18| 91福利在线播放| 欧美精品在线观看一区二区| 日韩精品影音先锋| 国产亚洲精品资源在线26u| 成人欧美一区二区三区视频网页| 亚洲色图欧美在线| 人禽交欧美网站| 国产精品一区二区你懂的| 99精品视频在线免费观看| 日本道免费精品一区二区三区| 欧美三区在线观看| 亚洲精品一区在线观看| 亚洲视频在线观看一区| 亚洲国产中文字幕| 激情综合色综合久久综合| 国产91清纯白嫩初高中在线观看| www.99精品| 51精品秘密在线观看| 久久久久久一级片| 亚洲一区二区在线免费看| 日本最新不卡在线| av毛片久久久久**hd| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲成人在线观看视频| 精品影视av免费| 色婷婷香蕉在线一区二区| 日韩欧美一级片| 亚洲三级电影全部在线观看高清| 午夜私人影院久久久久| 国产成人亚洲综合a∨婷婷| 在线视频一区二区三| 日韩欧美国产成人一区二区| 亚洲欧美一区二区三区孕妇| 蜜桃视频免费观看一区| 91香蕉视频在线| 欧美不卡一区二区三区四区| 亚洲同性gay激情无套| 蜜臀91精品一区二区三区| 99久久精品国产一区二区三区| 欧美一三区三区四区免费在线看| 中文字幕中文在线不卡住| 日韩和欧美一区二区| av福利精品导航| 精品久久久久久久久久久久久久久久久| 国产欧美日韩不卡| 蜜乳av一区二区| 欧美亚洲综合另类| 欧美国产精品中文字幕| 免费在线观看一区| 欧美性感一区二区三区| 国产精品日韩精品欧美在线| 黄页视频在线91| 欧美精品在线视频| 尤物视频一区二区| 成人av免费在线播放| 久久久亚洲精品石原莉奈 | 丁香五精品蜜臀久久久久99网站 | 久久久久久久综合| 日韩国产在线观看一区| 91视频免费看| 国产精品视频麻豆| 国产精品系列在线观看| 欧美一区二区三区婷婷月色| 亚洲精品v日韩精品| 成人动漫av在线| 中文字幕精品一区 | 久久久国产综合精品女国产盗摄| 视频在线观看一区二区三区| 在线免费观看成人短视频| 国产精品超碰97尤物18| 国产成人av电影| 久久婷婷国产综合国色天香 | 日韩欧美专区在线| 日韩av一二三| 91精品国产色综合久久久蜜香臀| 亚洲最色的网站| 色先锋aa成人| 亚洲黄色性网站| 在线观看日韩av先锋影音电影院| 国产精品成人午夜| 91在线国产福利| 亚洲免费成人av| 91极品视觉盛宴| 一区二区三区精品视频| 在线观看成人免费视频| 一区二区三区欧美久久| 在线看国产一区二区| 一区二区三区免费在线观看| 在线欧美一区二区| 亚洲bt欧美bt精品777| 91麻豆精品国产91久久久久久久久 | 91精品国产色综合久久不卡电影| 视频一区欧美日韩| 欧美一级高清片| 国产在线精品不卡| 国产午夜亚洲精品午夜鲁丝片| 国产成人亚洲综合a∨婷婷图片| 国产精品视频观看| 日本精品一级二级| 日韩二区三区在线观看| 欧美sm美女调教| 懂色av一区二区三区蜜臀| 亚洲激情成人在线| 欧美一区二区三区的| 国产精品夜夜嗨| 亚洲视频你懂的| 欧美丰满一区二区免费视频 | 欧日韩精品视频| 日韩va亚洲va欧美va久久| 日韩欧美在线观看一区二区三区| 免费av网站大全久久| 国产午夜精品福利| 一本一本久久a久久精品综合麻豆| 亚洲国产va精品久久久不卡综合| 日韩欧美成人午夜| 99久久国产综合精品色伊| 亚洲国产日韩一级| 久久久美女艺术照精彩视频福利播放| www.亚洲色图.com| 日韩中文字幕av电影| 国产网站一区二区| 欧美色视频一区| 国产精品一区免费在线观看| 亚洲欧美视频一区| 欧美变态tickle挠乳网站| www.在线欧美| 久久精品久久综合| 亚洲精品国产无天堂网2021| 日韩美女在线视频 | 久久精品一区八戒影视| 色菇凉天天综合网| 激情综合色综合久久综合| 亚洲黄一区二区三区| 久久午夜免费电影| 欧美日韩国产一级片| 国产凹凸在线观看一区二区| 亚洲va在线va天堂| 国产精品日韩成人| 欧美大片在线观看一区二区| 在线免费观看日本一区| 国产成人免费视频网站高清观看视频 | 91精品国产欧美一区二区18| 成人天堂资源www在线| 日本亚洲欧美天堂免费| 1024国产精品| 久久久另类综合| 91精品国产综合久久久蜜臀粉嫩| 99久久夜色精品国产网站| 久久国产精品第一页| 亚洲国产美国国产综合一区二区| 久久久久久久免费视频了| 51精品视频一区二区三区| 色综合天天综合在线视频| 国产成人亚洲精品狼色在线| 视频一区视频二区中文字幕| 亚洲免费观看在线观看| 中文字幕av不卡| 精品日韩欧美在线| 欧美日韩一区二区三区四区 | 国产亚洲一区二区在线观看| 欧美日韩视频在线第一区| 91丨porny丨在线| 成人一级片网址| 国产一区二区三区最好精华液| 男女男精品网站| 午夜成人免费视频| 亚洲在线中文字幕| 亚洲精品少妇30p| 亚洲欧洲另类国产综合| 久久久久久亚洲综合影院红桃| 日韩片之四级片| 91精品国产色综合久久| 欧美精品久久一区| 欧美午夜精品久久久| 91久久精品一区二区三| 91视视频在线观看入口直接观看www| 国产成人亚洲综合a∨婷婷图片| 国产在线精品不卡| 精品一区二区三区日韩| 久久精品免费观看|