Example #1
0
        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        public Debugger(
            bool isolated,
            string culture,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            AppDomain appDomain,
            IHost host,
            string libraryPath,
            StringList autoPathList
            )
        {
            interpreter = isolated ? DebuggerOps.CreateInterpreter(
                culture, createFlags, initializeFlags, scriptFlags,
                interpreterFlags, appDomain, host, libraryPath,
                autoPathList) : null;

            ReturnCode code;
            Result     error = null;

            code = Initialize(ref error);

            if (code != ReturnCode.Ok)
            {
                DebugOps.Complain(interpreter, code, error);
            }
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        public static Interpreter CreateInterpreter(
            string culture,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            AppDomain appDomain,
            IHost host,
            string libraryPath,
            StringList autoPathList,
            ref Result result
            )
        {
            //
            // NOTE: First, mask off flags that we know to be invalid for all
            //       debugger interpreters.  Next, add flags to force a cloned
            //       interpreter host to be created and used.  Finally, create
            //       an isolated debugging interpreter with the right set of
            //       options.
            //
            createFlags &= ~CreateFlags.NonDebuggerUse;
            createFlags |= CreateFlags.CloneHost;

            return(Interpreter.Create(
                       culture, createFlags, initializeFlags, scriptFlags,
                       interpreterFlags, appDomain, host, libraryPath,
                       autoPathList, ref result));
        }
Example #3
0
        ///////////////////////////////////////////////////////////////////////

        #region Debugger Interpreter Support Methods
#if DEBUGGER
        public static Interpreter CreateInterpreter(
            string culture,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            AppDomain appDomain,
            IHost host,
            string libraryPath,
            StringList autoPathList
            )
        {
            Result result = null;

            Interpreter interpreter = CreateInterpreter(
                culture, createFlags, initializeFlags, scriptFlags,
                interpreterFlags, appDomain, host, libraryPath,
                autoPathList, ref result);

            if (interpreter == null)
            {
                DebugOps.Complain(interpreter, ReturnCode.Error, result);
            }

            return(interpreter);
        }
Example #4
0
        ///////////////////////////////////////////////////////////////////////

        /* NOTE: For use by [test2] and CreateSlaveInterpreter ONLY. */
        internal static InterpreterHelper Create(
            AppDomain appDomain,
            IEnumerable <string> args,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            string text,
            string libraryPath,
            StringList autoPathList,
            ref Result result
            )
        {
            if (appDomain == null)
            {
                result = "invalid application domain";
                return(null);
            }

            if (assemblyName == null)
            {
                result = "invalid assembly name";
                return(null);
            }

            if (typeName == null)
            {
                result = "invalid type name";
                return(null);
            }

            try
            {
                object[] ctorArgs =
                {
                    args,             createFlags, initializeFlags, scriptFlags,
                    interpreterFlags, text,        libraryPath,     autoPathList,
                    result
                };

                InterpreterHelper interpreterHelper =
                    (InterpreterHelper)appDomain.CreateInstanceAndUnwrap(
                        assemblyName.ToString(), typeName, false,
                        MarshalOps.PrivateCreateInstanceBindingFlags,
                        null, ctorArgs, null, null, null);

                //
                // NOTE: Grab the result as it may have been modified.
                //
                result = ctorArgs[ctorArgs.Length - 1] as Result;

                return(interpreterHelper);
            }
            catch (Exception e)
            {
                result = e;
            }

            return(null);
        }
Example #5
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            InitializeFlags flags,
            InitializeFlags hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != InitializeFlags.None);
            }
        }
Example #6
0
        ///////////////////////////////////////////////////////////////////////

        public static IDebugger Create(
            bool isolated,
            string culture,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            AppDomain appDomain,
            IHost host,
            string libraryPath,
            StringList autoPathList
            )
        {
            return(new Debugger(
                       isolated, culture, createFlags, initializeFlags, scriptFlags,
                       interpreterFlags, appDomain, host, libraryPath, autoPathList));
        }
Example #7
0
        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: For use by the associated InterpreterHelper.Create method
        //       overload ONLY.
        //
        private InterpreterHelper(
            IEnumerable <string> args,
            CreateFlags createFlags,
            InitializeFlags initializeFlags,
            ScriptFlags scriptFlags,
            InterpreterFlags interpreterFlags,
            string text,
            string libraryPath,
            StringList autoPathList,
            ref Result result
            )
        {
            interpreter = Interpreter.Create(
                args, createFlags, initializeFlags, scriptFlags,
                interpreterFlags, text, libraryPath, autoPathList,
                ref result);
        }
Example #8
0
 internal static extern ulong HttpTerminate(InitializeFlags flags, IntPtr mustBeZero);
Example #9
0
 internal static extern ulong HttpInitialize(
     ApiVersion version,
     InitializeFlags flags,
     IntPtr reserved
     );
Example #10
0
 internal static extern Result HttpTerminate(InitializeFlags flags, IntPtr mustBeZero);
Example #11
0
 internal static extern Result HttpInitialize(
     ApiVersion version,
     InitializeFlags flags,
     IntPtr reserved
     );