Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////

        private /* protected virtual */ void Dispose(
            bool disposing
            )
        {
            TraceOps.DebugTrace(String.Format(
                                    "Dispose: disposing = {0}, interpreter = {1}, disposed = {2}",
                                    disposing, FormatOps.InterpreterNoThrow(interpreter), disposed),
                                typeof(InteractiveContext).Name, TracePriority.CleanupDebug);

            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    interpreter = null; /* NOT OWNED: Do not dispose. */
                    threadId    = 0;

                    ///////////////////////////////////////////////////////////

                    interactive              = false;
                    interactiveInput         = null;
                    previousInteractiveInput = null;
                    interactiveMode          = null;
                    activeInteractiveLoops   = 0;
                    totalInteractiveLoops    = 0;

                    interactiveLoopData        = null;
                    interactiveCommandCallback = null;

#if HISTORY
                    historyLoadData = null;
                    historySaveData = null;

                    historyInfoFilter = null;
                    historyLoadFilter = null;
                    historySaveFilter = null;

                    historyFileName = null;
#endif
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////

        #region Command History Support Methods
        public static bool MatchData(
            IClientData clientData,
            IHistoryFilter historyFilter
            )
        {
            HistoryClientData historyClientData = clientData as HistoryClientData;

            if (historyClientData != null)
            {
                if (historyFilter != null)
                {
                    if ((historyFilter.StartLevel != Level.Invalid) &&
                        (historyClientData.Levels < historyFilter.StartLevel))
                    {
                        return(false);
                    }

                    if ((historyFilter.StopLevel != Level.Invalid) &&
                        (historyClientData.Levels > historyFilter.StopLevel))
                    {
                        return(false);
                    }

                    if ((historyFilter.HasFlags != HistoryFlags.None) &&
                        !FlagOps.HasFlags(historyClientData.Flags,
                                          historyFilter.HasFlags, historyFilter.HasAll))
                    {
                        return(false);
                    }

                    if ((historyFilter.NotHasFlags != HistoryFlags.None) &&
                        FlagOps.HasFlags(historyClientData.Flags,
                                         historyFilter.NotHasFlags, historyFilter.NotHasAll))
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////

        #region Dead Code
#if DEAD_CODE
        private static bool MatchData(
            IHistoryData historyData,
            IHistoryFilter historyFilter
            )
        {
            int          levels;
            HistoryFlags flags;

            if (historyData != null)
            {
                levels = historyData.Levels;
                flags  = historyData.Flags;
            }
            else
            {
                levels = Level.Invalid;
                flags  = HistoryFlags.None;
            }

            return(MatchData(levels, flags, historyFilter));
        }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////

        public static bool MatchData(
            int levels,
            HistoryFlags flags,
            IHistoryFilter historyFilter
            )
        {
            if (historyFilter != null)
            {
                if ((historyFilter.StartLevel != Level.Invalid) &&
                    (levels < historyFilter.StartLevel))
                {
                    return(false);
                }

                if ((historyFilter.StopLevel != Level.Invalid) &&
                    (levels > historyFilter.StopLevel))
                {
                    return(false);
                }

                if ((historyFilter.HasFlags != HistoryFlags.None) &&
                    !FlagOps.HasFlags(flags, historyFilter.HasFlags,
                                      historyFilter.HasAll))
                {
                    return(false);
                }

                if ((historyFilter.NotHasFlags != HistoryFlags.None) &&
                    FlagOps.HasFlags(flags, historyFilter.NotHasFlags,
                                     historyFilter.NotHasAll))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        ///////////////////////////////////////////////////////////////////////

        private /* protected virtual */ void Dispose(
            bool disposing
            )
        {
            TraceOps.DebugTrace(String.Format(
                                    "Dispose: disposing = {0}, interpreter = {1}, disposed = {2}",
                                    disposing, FormatOps.InterpreterNoThrow(interpreter), disposed),
                                typeof(EngineContext).Name, TracePriority.CleanupDebug);

            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    interpreter = null; /* NOT OWNED: Do not dispose. */
                    threadId    = 0;

                    ///////////////////////////////////////////////////////////

#if DEBUGGER
                    interactiveLoopCallback = null;
#endif

                    ///////////////////////////////////////////////////////////

#if SHELL
                    argumentCallback            = null;
                    evaluateScriptCallback      = null;
                    evaluateFileCallback        = null;
                    evaluateEncodedFileCallback = null;
#endif

                    ///////////////////////////////////////////////////////////

                    levels        = 0;
                    maximumLevels = 0;

                    scriptLevels        = 0;
                    maximumScriptLevels = 0;

                    parserLevels        = 0;
                    maximumParserLevels = 0;

                    expressionLevels        = 0;
                    maximumExpressionLevels = 0;

                    previousLevels   = 0;
                    catchLevels      = 0;
                    unknownLevels    = 0;
                    traceLevels      = 0;
                    subCommandLevels = 0;

#if ARGUMENT_CACHE
                    cacheArgument = null;
#endif

#if DEBUGGER
                    watchpointLevels = 0;
#endif

#if NOTIFY || NOTIFY_OBJECT
                    notifyLevels = 0;
                    notifyTypes  = NotifyType.None;
                    notifyFlags  = NotifyFlags.None;
#endif

                    policyLevels = 0;
                    testLevels   = 0;

#if DEBUGGER
                    isDebuggerExiting = false;
#endif

                    stackOverflow = false;

#if DEBUGGER
                    if (debugger != null)
                    {
                        IDisposable disposable = debugger as IDisposable;

                        if (disposable != null)
                        {
                            disposable.Dispose();
                            disposable = null;
                        }

                        debugger = null;
                    }
#endif

#if PREVIOUS_RESULT
                    previousResult = null;
#endif

                    engineFlags    = EngineFlags.None;
                    parseState     = null;
                    returnCode     = ReturnCode.Ok;
                    errorLine      = 0;
                    errorCode      = null;
                    errorInfo      = null;
                    errorFrames    = 0;
                    exception      = null;
                    scriptLocation = null;

                    ///////////////////////////////////////////////////////////

                    if (scriptLocations != null)
                    {
                        scriptLocations.Clear();
                        scriptLocations = null;
                    }

                    ///////////////////////////////////////////////////////////

                    previousProcessId = 0;

                    ///////////////////////////////////////////////////////////

                    if (arraySearches != null)
                    {
                        arraySearches.Clear();
                        arraySearches = null;
                    }

                    ///////////////////////////////////////////////////////////

#if HISTORY
                    historyEngineFilter = null;

                    if (history != null)
                    {
                        history.Clear();
                        history = null;
                    }
#endif

                    ///////////////////////////////////////////////////////////

                    complaint = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }