Ejemplo 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(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;
            }
        }
Ejemplo n.º 2
0
        public EngineContext(
            Interpreter interpreter,
            int threadId
            )
        {
            this.interpreter = interpreter;
            this.threadId    = threadId;

            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 = Argument.InternalCreate();
#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
            debugger = null;
            interactiveLoopCallback = null;
#endif

#if SHELL
            argumentCallback            = null;
            evaluateScriptCallback      = null;
            evaluateFileCallback        = null;
            evaluateEncodedFileCallback = 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;
            scriptLocations = new ScriptLocationList();

            previousProcessId = 0;

            arraySearches = new ArraySearchDictionary();

#if HISTORY
            historyEngineFilter = null;
            history             = new ClientDataList();
#endif

            complaint = null;
        }