Ejemplo n.º 1
0
globle int LoadCommand(
  void *theEnv)
  {
#if (! BLOAD_ONLY) && (! RUN_TIME)
   char *theFileName;
   int rv;

   if (EnvArgCountCheck(theEnv,"load",EXACTLY,1) == -1) return(FALSE);
   if ((theFileName = GetFileName(theEnv,"load",1)) == NULL) return(FALSE);

   SetPrintWhileLoading(theEnv,TRUE);

   if ((rv = EnvLoad(theEnv,theFileName)) == FALSE)
     {
      SetPrintWhileLoading(theEnv,FALSE);
      OpenErrorMessage(theEnv,"load",theFileName);
      return(FALSE);
     }

   SetPrintWhileLoading(theEnv,FALSE);
   if (rv == -1) return(FALSE);
   return(TRUE);
#else
   EnvPrintRouter(theEnv,WDIALOG,"Load is not available in this environment\n");
   return(FALSE);
#endif
  }
Ejemplo n.º 2
0
bool ClipsRuleMgr::initialize(void *env, string sessionID)
{
		cout<<"ClipsRuleMgr::initialize 0"<<endl;
		getUserTemplateFiles();
		cout<<"ClipsRuleMgr::initialize 1"<<endl;
		m_theEnv = env;
		m_sessionID = sessionID;

		//rule files should use defmodule to group  T.B.D
				
		m_ruleFilesItor = m_ruleFiles.begin();
		while(m_ruleFilesItor!=m_ruleFiles.end())
		{
			EnvLoad(m_theEnv,string("./clp/" + *m_ruleFilesItor).c_str());
			cout<<"Rule Engine Initialize::load clp file:" <<*m_ruleFilesItor<<endl;
			m_ruleFilesItor++;
		}
		
		EnvReset(m_theEnv);
		
		getAllTemplatesFromClips();
		
		getTemplateFields();
		
		return true;
		
}
Ejemplo n.º 3
0
void RerouteStdin(
  void *theEnv,
  int argc,
  char *argv[])
  {
   int i;
   int theSwitch = NO_SWITCH;

   /*======================================*/
   /* If there aren't enough arguments for */
   /* the -f argument, then return.        */
   /*======================================*/

   if (argc < 3)
     { return; }

   /*=====================================*/
   /* If argv was not passed then return. */
   /*=====================================*/

   if (argv == NULL) return;

   /*=============================================*/
   /* Process each of the command line arguments. */
   /*=============================================*/

   for (i = 1 ; i < argc ; i++)
     {
      if (strcmp(argv[i],"-f") == 0) theSwitch = BATCH_SWITCH;
#if ! RUN_TIME
      else if (strcmp(argv[i],"-f2") == 0) theSwitch = BATCH_STAR_SWITCH;
      else if (strcmp(argv[i],"-l") == 0) theSwitch = LOAD_SWITCH;
#endif
      else if (theSwitch == NO_SWITCH)
        {
         PrintErrorID(theEnv,"SYSDEP",2,false);
         EnvPrintRouter(theEnv,WERROR,"Invalid option\n");
        }

      if (i > (argc-1))
        {
         PrintErrorID(theEnv,"SYSDEP",1,false);
         EnvPrintRouter(theEnv,WERROR,"No file found for ");

         switch(theSwitch)
           {
            case BATCH_SWITCH:
               EnvPrintRouter(theEnv,WERROR,"-f");
               break;

            case BATCH_STAR_SWITCH:
               EnvPrintRouter(theEnv,WERROR,"-f2");
               break;

            case LOAD_SWITCH:
               EnvPrintRouter(theEnv,WERROR,"-l");
           }

         EnvPrintRouter(theEnv,WERROR," option\n");
         return;
        }

      switch(theSwitch)
        {
         case BATCH_SWITCH:
            OpenBatch(theEnv,argv[++i],true);
            break;

#if (! RUN_TIME) && (! BLOAD_ONLY)
         case BATCH_STAR_SWITCH:
            EnvBatchStar(theEnv,argv[++i]);
            break;

         case LOAD_SWITCH:
            EnvLoad(theEnv,argv[++i]);
            break;
#endif
        }
     }
  }
Ejemplo n.º 4
0
int __declspec(dllexport) CALL_CONV __EnvLoad(
  void *theEnv,
  char *theFile)
  {
   return EnvLoad(theEnv,theFile);
  }
Ejemplo n.º 5
0
globle int Load(
  char *fileName)
  {
   return EnvLoad(GetCurrentEnvironment(),fileName);
  }