Пример #1
0
        /// <summary>
        /// Stores the context info.
        /// </summary>
        /// <returns>The context info.</returns>
        /// <param name="contextInfoNode">Context info node.</param>
        /// <param name="location">Location.</param>
        public int StoreContextInfo(ContextInfoNode contextInfoNode, ContextInfoLocation location)
        {
            ContextNode contextNode;

            switch (location)
            {
            case ContextInfoLocation.Bottom:
                contextNode = _stack.Tail;
                break;

            case ContextInfoLocation.Top:
                contextNode = _stack.Head;
                break;

            case ContextInfoLocation.Prop:
                if ((contextNode = FindPropContext()) != null)
                {
                    break;
                }
                return((int)ParserStatus.NoScope);

            default:
                return((int)ParserStatus.BadLocation);
            }

            AttachContextInfo(contextNode, contextInfoNode);

            return(0);
        }
Пример #2
0
        /// <summary>
        /// Install a handler node into the current context
        /// </summary>
        /// <returns></returns>
        private int InstallHandler(uint type, uint id, uint identifier, ContextInfoLocation position, IFFCallBack callbackHandler, object data)
        {
            int err;

            var ci = new ContextInfoNode(id, type, identifier, 0, null);

            if (ci != null)
            {
                var ch = new ChunkHandler {
                    ChunkHandlerCallBack = callbackHandler,
                    UserData             = data
                };
                ci.ChunkHandler = ch;
                err             = StoreContextInfo(ci, position);
                if (err < 0)
                {
                    ci.Dispose();
                }
                return(err);
            }
            return(0);
        }
Пример #3
0
 /// <summary>
 /// Installs the exit handler.
 /// </summary>
 /// <returns>The exit handler.</returns>
 /// <param name="type">Type.</param>
 /// <param name="id">Identifier.</param>
 /// <param name="position">Position.</param>
 /// <param name="cb">Callback</param>
 /// <param name="data">Data.</param>
 public int InstallExitHandler(uint type, uint id, ContextInfoLocation position, IFFCallBack cb, object data)
 {
     return(InstallHandler(type, id, GenericChunkIds.CI_EXITHANDLER, position, cb, data));
 }