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

        internal void Refresh(
            ArgumentCallback argumentCallback,
            EvaluateScriptCallback evaluateScriptCallback,
            EvaluateFileCallback evaluateFileCallback,
            EvaluateEncodedFileCallback evaluateEncodedFileCallback,
            InteractiveLoopCallback interactiveLoopCallback
            )
        {
            if (!hadArgumentCallback)
            {
                this.argumentCallback = argumentCallback;
            }

            if (!hadEvaluateScriptCallback)
            {
                this.evaluateScriptCallback = evaluateScriptCallback;
            }

            if (!hadEvaluateFileCallback)
            {
                this.evaluateFileCallback = evaluateFileCallback;
            }

            if (!hadEvaluateEncodedFileCallback)
            {
                this.evaluateEncodedFileCallback = evaluateEncodedFileCallback;
            }

            if (!hadInteractiveLoopCallback)
            {
                this.interactiveLoopCallback = interactiveLoopCallback;
            }
        }
Exemplo n.º 2
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;
            }
        }