⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysdep.c

📁 NASA 开发使用的一个专家系统
💻 C
📖 第 1 页 / 共 3 页
字号:
   /*******************************************************/   /*      "C" Language Integrated Production System      */   /*                                                     */   /*             CLIPS Version 6.05  04/09/97            */   /*                                                     */   /*               SYSTEM DEPENDENT MODULE               */   /*******************************************************//*************************************************************//* Purpose: Isolation of system dependent routines.          *//*                                                           *//* Principal Programmer(s):                                  *//*      Gary D. Riley                                        *//*                                                           *//* Contributing Programmer(s):                               *//*      Brian L. Donnell                                     *//*                                                           *//* Revision History:                                         *//*                                                           *//*************************************************************/#define _SYSDEP_SOURCE_#include "setup.h"#include <stdio.h>#define _CLIPS_STDIO_#include <string.h>#if ANSI_COMPILER || IBM#include <stdlib.h>#endif#if   VAX_VMS#include timeb#include <descrip.h>#include <ssdef.h>#include <stsdef.h>#include signalextern int LIB$SPAWN();#endif#if MAC#include <Events.h> #include <Menus.h>#include <Devices.h> /* #include <Desk.h> */#include <Types.h> #include <Files.h> #include <Timer.h>#define kTwoPower32 (4294967296.0)      /* 2^32 */#if MAC_MPW || MAC_MCW#include <strings.h>#else#include <pascal.h>#endif#endif#if IBM_ICB#include <i32.h>#include <stk.h>#include <sys\types.h>#include <sys\timeb.h>#include <io.h>#include <fcntl.h>#include <limits.h>#include <process.h>#endif#if   IBM_MSC#include <sys\types.h>#include <sys\timeb.h>#include <io.h>#include <fcntl.h>#include <limits.h>#include <process.h>#endif#if   IBM_TBC#include <bios.h>#include <io.h>#include <fcntl.h>#include <limits.h>#if WINDOW_INTERFACE#undef VOID#undef BOOLEAN#include <windows.h>#undef VOID#define VOID void #undef BOOLEAN#define BOOLEAN int#undef CopyMemory#endif#endif#if   IBM_ZTC || IBM_SC#include <time.h>#include <controlc.h>#include <io.h>#include <fcntl.h>#include <limits.h>#include <process.h>#endif#if   UNIX_7 || IBM_GCC#include <sys/types.h>#include <sys/timeb.h>#include <signal.h>#endif#if   UNIX_V#include <sys/types.h>#include <sys/times.h>#include <signal.h>#endif#include "sysdep.h"#include "constrct.h"#include "filecom.h"#include "clipsmem.h"#include "argacces.h"#include "utility.h"#include "prccode.h"#include "prcdrfun.h"#include "miscfun.h"#include "iofun.h"#include "prdctfun.h"#include "watch.h"#include "multifun.h"#include "bmathfun.h"#include "emathfun.h"#include "strngfun.h"#include "router.h"#include "conscomp.h"#include "cstrcpsr.h"#include "textpro.h"#if DEFFACTS_CONSTRUCT#include "dffctdef.h"#endif#if DEFRULE_CONSTRUCT#include "ruledef.h"#endif#if DEFGENERIC_CONSTRUCT#include "genrccom.h"#endif#if DEFFUNCTION_CONSTRUCT#include "dffnxfun.h"#endif#if DEFGLOBAL_CONSTRUCT#include "globldef.h"#endif#if DEFTEMPLATE_CONSTRUCT#include "tmpltdef.h"#endif#if OBJECT_SYSTEM#include "extobj.h"#endif#include "moduldef.h"#if DEVELOPER#include "developr.h"#endif/***************//* DEFINITIONS *//***************/#define NO_SWITCH         0#define BATCH_SWITCH      1#define BATCH_STAR_SWITCH 2#define LOAD_SWITCH       3/****************************************//* GLOBAL EXTERNAL FUNCTION DEFINITIONS *//****************************************/#if ANSI_COMPILER    extern int                     UserFunctions(void); #else   extern int                     UserFunctions();#endif/***************************************//* LOCAL INTERNAL FUNCTION DEFINITIONS *//***************************************/#if ANSI_COMPILER#if ! RUN_TIME   static VOID                    SystemFunctionDefinitions(void);#endif   static void                    InitializeKeywords(void);   static VOID                    InitializeNonportableFeatures(void);#if   (VAX_VMS || UNIX_V || UNIX_7 || IBM_GCC) && (! WINDOW_INTERFACE)   static VOID                    CatchCtrlC(int);#endif#if   (IBM_TBC || IBM_MSC) && (! WINDOW_INTERFACE)   static VOID interrupt          CatchCtrlC(void);   static VOID                    RestoreInterruptVectors(void);#endif#if   IBM_ICB && (! WINDOW_INTERFACE)#pragma interrupt (CatchCtrlC)   static VOID                    CatchCtrlC(void);   static VOID                    RestoreInterruptVectors(void);#endif#if   (IBM_ZTC || IBM_SC) && (! WINDOW_INTERFACE)   static void _cdecl             CatchCtrlC(void);#endif#if MAC   static VOID                    CallSystemTask(void);#endif#else#if ! RUN_TIME   static VOID                    SystemFunctionDefinitions();#endif   static void                    InitializeKeywords();    static VOID                    InitializeNonportableFeatures();#if   (VAX_VMS || UNIX_V || UNIX_7 || IBM_GCC) && (! WINDOW_INTERFACE)   static VOID                    CatchCtrlC();#endif#if   (IBM_TBC || IBM_MSC) && (! WINDOW_INTERFACE)   static VOID interrupt          CatchCtrlC();   static VOID                    RestoreInterruptVectors();#endif#if   IBM_ICB && (! WINDOW_INTERFACE)#pragma interrupt (CatchCtrlC)   static VOID                    CatchCtrlC();   static VOID                    RestoreInterruptVectors();#endif#if   (IBM_ZTC || IBM_SC) && (! WINDOW_INTERFACE)   static void _cdecl             CatchCtrlC();#endif#if MAC   static VOID                    CallSystemTask();#endif#endif/***************************************//* LOCAL INTERNAL VARIABLE DEFINITIONS *//***************************************/#if ANSI_COMPILER#if ! WINDOW_INTERFACE#if IBM_TBC   static VOID interrupt  (*OldCtrlC)(void);   static VOID interrupt  (*OldBreak)(void);#endif#if IBM_MSC   static VOID  (interrupt *OldCtrlC)(void);   static VOID  (interrupt *OldBreak)(void);#endif#if   IBM_ICB#pragma interrupt (OldCtrlC,OldBreak)   VOID         (*OldCtrlC)(void);   VOID         (*OldBreak)(void);#endif#endif#else#if ! WINDOW_INTERFACE#if IBM_TBC   static VOID interrupt  (*OldCtrlC)();   static VOID interrupt  (*OldBreak)();#endif#if IBM_MSC    static VOID  (interrupt *OldCtrlC)();   static VOID  (interrupt *OldBreak)();#if   IBM_ICB#pragma interrupt (OldCtrlC,OldBreak)   VOID         (*OldCtrlC)(void);   VOID         (*OldBreak)(void);#endif#endif#endif#endif#if  MAC   static short int        BinaryRefNum;#endif#if IBM_TBC || IBM_MSC || IBM_ICB /* || IBM_ZTC */   static int              BinaryFileHandle;#endif#if (! MAC) && (! IBM_TBC) && (! IBM_MSC) && (! IBM_ICB) /* && (! IBM_ZTC) */   static FILE            *BinaryFP;#endif/****************************************//* GLOBAL INTERNAL VARIABLE DEFINITIONS *//****************************************/#if ANSI_COMPILER   globle VOID             (*RedrawScreenFunction)(void) = NULL;   globle VOID             (*PauseEnvFunction)(void) = NULL;   globle VOID             (*ContinueEnvFunction)(int) = NULL;#else   globle VOID             (*RedrawScreenFunction)() = NULL;   globle VOID             (*PauseEnvFunction)() = NULL;   globle VOID             (*ContinueEnvFunction)() = NULL;#endif/******************************************************//* InitializeCLIPS: Performs initialization of CLIPS. *//******************************************************/globle VOID InitializeCLIPS()  {   static BOOLEAN alreadyInitialized = CLIPS_FALSE;   /*================================================*/   /* Don't allow the initialization to occur twice. */   /*================================================*/      if (alreadyInitialized) return;      /*================================*/   /* Initialize the memory manager. */   /*================================*/      InitializeMemory();      /*===============================================*/   /* Initialize the hash tables for atomic values. */   /*===============================================*/   #if ! RUN_TIME   InitializeAtomTables();            #endif   /*=========================================*/   /* Initialize file and string I/O routers. */   /*=========================================*/      InitializeDefaultRouters();         /*=========================================================*/   /* Initialize some system dependent features such as time. */   /*=========================================================*/           InitializeNonportableFeatures();   /*=============================================*/   /* Register system and user defined functions. */   /*=============================================*/   #if ! RUN_TIME   SystemFunctionDefinitions();          UserFunctions();#endif   /*====================================*/   /* Initialize the constraint manager. */   /*====================================*/      InitializeConstraints();              /*==========================================*/   /* Initialize the expression hash table and */   /* pointers to specific functions.          */   /*==========================================*/   #if ! RUN_TIME   InitExpressionData();            #endif   /*===================================*/   /* Initialize the construct manager. */   /*===================================*/   #if ! RUN_TIME   InitializeConstructs();#endif   /*===================================*/   /* Initialize the defrule construct. */   /*===================================*/   #if DEFRULE_CONSTRUCT   InitializeDefrules();#endif   /*====================================*/   /* Initialize the deffacts construct. */   /*====================================*/   #if DEFFACTS_CONSTRUCT   InitializeDeffacts();#endif   /*=====================================================*/   /* Initialize the defgeneric and defmethod constructs. */   /*=====================================================*/   #if DEFGENERIC_CONSTRUCT   SetupGenericFunctions();#endif   /*=======================================*/   /* Initialize the deffunction construct. */   /*=======================================*/   #if DEFFUNCTION_CONSTRUCT   SetupDeffunctions();#endif   /*=====================================*/   /* Initialize the defglobal construct. */   /*=====================================*/   #if DEFGLOBAL_CONSTRUCT   InitializeDefglobals();#endif   /*=======================================*/   /* Initialize the deftemplate construct. */   /*=======================================*/   #if DEFTEMPLATE_CONSTRUCT   InitializeDeftemplates();#endif   /*=============================*/   /* Initialize COOL constructs. */   /*=============================*/   #if OBJECT_SYSTEM   SetupObjectSystem();#endif   /*=====================================*/   /* Initialize the defmodule construct. */   /*=====================================*/      InitializeDefmodules();   /*======================================================*/   /* Register commands and functions for development use. */   /*======================================================*/   #if DEVELOPER   DeveloperCommands();#endif      /*=========================================*/   /* Install the special function primitives */   /* used by procedural code in constructs.  */   /*=========================================*/      InstallProcedurePrimitives();      /*====================================================*/   /* Install CLIPS keywords in the symbol table so that */   /* they are available for command completion.         */   /*====================================================*/      InitializeKeywords();   /*========================*/   /* Issue a clear command. */   /*========================*/      Clear();   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -