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

        internal CallFrame(
            long frameId,
            long frameLevel,
            string name,
            ObjectDictionary tags,
            int index,
            int level,
            CallFrameFlags flags,
            IClientData auxiliaryData,
            IClientData resolveData,
            IClientData extraData,
            ICallFrame other,
            ICallFrame previous,
            ICallFrame next
            )
            : this(frameId, frameLevel, name, tags, index, level, flags,
                   null, auxiliaryData, resolveData, null, null, null,
                   null, false, false)
        {
            //
            // NOTE: Share the variables of this call frame with the original
            //       one.
            //
            this.other    = other;
            this.previous = previous;
            this.next     = next;
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        public bool SetMark(
            bool mark,
            CallFrameFlags flags,
            string name,
            object value
            )
        {
            CheckDisposed();

            if ((name == null) || SetMark(mark, name, value))
            {
                if (mark)
                {
                    this.flags |= flags;
                }
                else
                {
                    this.flags &= ~flags;
                }

                //
                // NOTE: Yes, we set or unset the mark.
                //
                return(true);
            }

            //
            // NOTE: For whatever reason, we did not set the mark.
            //
            return(false);
        }
Example #3
0
        ///////////////////////////////////////////////////////////////////////

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

        public CallFrameFlags SetFlags(
            CallFrameFlags flags,
            bool set
            )
        {
            CheckDisposed();

            if (set)
            {
                return(this.flags |= flags);
            }
            else
            {
                return(this.flags &= ~flags);
            }
        }
Example #5
0
        ///////////////////////////////////////////////////////////////////////

        public bool HasFlags(
            CallFrameFlags hasFlags,
            bool all
            )
        {
            CheckDisposed();

            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != CallFrameFlags.None);
            }
        }
Example #6
0
        ///////////////////////////////////////////////////////////////////////

        private CallFrame(
            long frameId,
            long frameLevel,
            string name,
            ObjectDictionary tags,
            int index,
            int level,
            CallFrameFlags flags,
            IClientData auxiliaryData,
            IClientData resolveData,
            IClientData extraData,
            VariableDictionary variables
            )
            : this(frameId, frameLevel, name, tags, index, level, flags,
                   null, auxiliaryData, resolveData, null, variables, null,
                   null, false, false)
        {
            // do nothing.
        }
Example #7
0
        ///////////////////////////////////////////////////////////////////////

        internal CallFrame(
            long frameId,
            long frameLevel,
            string name,
            ObjectDictionary tags,
            int index,
            int level,
            CallFrameFlags flags,
            IClientData auxiliaryData,
            IClientData resolveData,
            IClientData extraData,
            VariableDictionary variables,
            ArgumentList arguments,
            bool ownArguments
            )
            : this(frameId, frameLevel, name, tags, index, level, flags,
                   null, auxiliaryData, resolveData, null, variables, null,
                   arguments, ownArguments, false)
        {
            // do nothing.
        }
Example #8
0
        ///////////////////////////////////////////////////////////////////////

        public void Free(
            bool global
            )
        {
            //
            // HACK: *SPECIAL CASE* We cannot dispose the global call frame
            //       unless we are [also] disposing of the interpreter itself.
            //
            if (global ||
                !FlagOps.HasFlags(flags, CallFrameFlags.NoFree, true))
            {
                kind        = IdentifierKind.None;
                id          = Guid.Empty;
                name        = null;
                group       = null;
                description = null;
                clientData  = null;
                frameId     = 0;
                frameLevel  = 0;
                flags       = CallFrameFlags.None;

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

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

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

                index = 0;
                level = 0;

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

                if (arguments != null)
                {
                    //
                    // BUGFIX: We can only mutate argument lists that we own.
                    //
                    if (ownArguments)
                    {
                        arguments.Clear();
                    }

                    arguments = null;
                }

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

                ownArguments = false;

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

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

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

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

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

                other    = null; /* NOTE: Not owned, do not dispose. */
                previous = null; /* NOTE: Not owned, do not dispose. */
                next     = null; /* NOTE: Not owned, do not dispose. */

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

                engineData    = null; /* NOTE: Not owned, do not dispose. */
                auxiliaryData = null; /* NOTE: Not owned, do not dispose. */
                resolveData   = null; /* NOTE: Not owned, do not dispose. */
                extraData     = null; /* NOTE: Not owned, do not dispose. */
            }
        }
Example #9
0
        internal CallFrame(
            long frameId,
            long frameLevel,
            string name,
            ObjectDictionary tags,
            long index,
            long level,
            CallFrameFlags flags,
            IClientData engineData,
            IClientData auxiliaryData,
            IClientData resolveData,
            IClientData extraData,
            VariableDictionary variables,
            IExecute execute,
            ArgumentList arguments,
            bool ownArguments,
            bool newVariables
            )
        {
            this.kind               = IdentifierKind.CallFrame;
            this.id                 = Guid.Empty;
            this.frameId            = frameId;
            this.frameLevel         = frameLevel;
            this.name               = name;
            this.index              = index;
            this.level              = level;
            this.flags              = flags;
            this.other              = null;
            this.previous           = null;
            this.next               = null;
            this.execute            = execute;
            this.arguments          = arguments;
            this.ownArguments       = ownArguments;
            this.procedureArguments = null;
            this.engineData         = engineData;
            this.auxiliaryData      = auxiliaryData;
            this.resolveData        = resolveData;
            this.extraData          = extraData;

            //
            // NOTE: For now, we always require a valid tags list to be present
            //       (i.e. we always create one if the caller did not supply a
            //       valid one).
            //
            if (this.tags != null)
            {
                this.tags = tags;
            }
            else
            {
                this.tags = new ObjectDictionary();
            }

            //
            // NOTE: If they requested variables for this call frame, allocate
            //       a new collection for them now; otherwise, use the provided
            //       variable collection, if any.
            //
            if (newVariables)
            {
                this.variables = (variables != null) ?
                                 new VariableDictionary(variables) :
                                 new VariableDictionary();
            }
            else
            {
                this.variables = variables;
            }
        }