Пример #1
0
zOPER_EXPORT zLONG OPERATION
Exec_StepForward( zVIEW vSubtask )
{
   zLONG lRC = 0;
   zPVOID hWRKS;

   // initialize work storage manager
   if ( WRKS_Init( &hWRKS ) < 0 )
   {
      // Error in WRKS system
      MessageSend( vSubtask, "VM03002", "VML Interpretor",
                   "Error Initializing Work Storage",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "VML Interpreter Error ","Initializing Work Storage" );

      return( zXC_STEP_EXECUTED );
   }

   if ( setjmp( g_jbWRKS ) != 0 )
   {
      // Error return from longjmp
      WRKS_Close( &hWRKS );
      return( zXC_STEP_EXECUTED );
   }

   lRC = StepOnce( vSubtask, hWRKS, &lRC );

   // close work storage manager
   WRKS_Close( &hWRKS );

   return( lRC );
}
Пример #2
0
ePathFinderStatus cPath::CalculationStep(cChunk & a_Chunk)
{
	m_Chunk = &a_Chunk;
	if (m_Status != ePathFinderStatus::CALCULATING)
	{
		return m_Status;
	}

	if (m_BadChunkFound)
	{
		FinishCalculation(ePathFinderStatus::PATH_NOT_FOUND);
		return m_Status;
	}

	if (m_StepsLeft == 0)
	{
		AttemptToFindAlternative();
	}
	else
	{
		--m_StepsLeft;
		int i;
		for (i = 0; i < CALCULATIONS_PER_STEP; ++i)
		{
			if (StepOnce())  // StepOnce returns true when no more calculation is needed.
			{
				break;  // if we're here, m_Status must have changed either to PATH_FOUND or PATH_NOT_FOUND.
			}
		}

		m_Chunk = nullptr;
	}
	return m_Status;
}
Пример #3
0
zOPER_EXPORT zLONG OPERATION
Exec_StepOnce( zVIEW vSubtask )
{
   zVIEW vZ_View;
   zVIEW vS_View;
   zLONG lStepRC;
   zLONG lRC;
   zCHAR szDebugFlag[ 2 ];

   // Single step actually loops unless one of these conditions occur.
   //   1.  The next statement to execute is within an operation currently in debug mode.
   //   2.  The return code from the last statement executed indicates debugging is to start for that operation.
   //   3.  Execution is terminating.
   //
   // The loop is very close to that in the Go function.
   //

   szDebugFlag[ 0 ] = 'N';
   lStepRC = zXC_STEP_EXECUTED;
   zPVOID hWRKS;

   // initialize work storage manager
   if ( WRKS_Init( &hWRKS ) < 0 )
   {
      // Error in WRKS system
      MessageSend( vSubtask, "VM03002", "VML Interpretor",
                   "Error Initializing Work Storage",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "VML Interpreter Error ","Initializing Work Storage" );

      return( lStepRC );
   }

   if ( setjmp( g_jbWRKS ) != 0 )
   {
      // Error return from longjmp
      WRKS_Close( &hWRKS );
      return( zXC_STEP_EXECUTED );
   }

   while ( (lStepRC == zXC_STEP_EXECUTED       ||
            lStepRC == zXC_OPERATION_STAGED) &&
            szDebugFlag[ 0 ] != 'Y' )
   {
      lStepRC = StepOnce( vSubtask, hWRKS, &lRC );

      // Don't execute the following if the operation is terminating.
      if ( lStepRC )
      {
         GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK );
         GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK );
         GetStringFromAttribute( szDebugFlag, zsizeof( szDebugFlag ), vS_View, "Operation", "CurrentDebugFlag" );
      }
   }

   if ( lStepRC == zXC_SETUP_DEBUGGER )
   {
      SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" );
   }

   // close work storage manager
   WRKS_Close( &hWRKS );

   return( lStepRC );
}