[PATCH v1 1/1] implement mp_stack class

Kirill Shcherbatov kshcherbatov at tarantool.org
Thu Jan 17 10:26:39 MSK 2019


Sorry, I've really forgot write a better comments to this structure because it is really trivial.
Updated:

/** Message pack MP_MAP or MP_ARRAY container descriptor. */                    
struct mp_frame {                                                               
        /** MP frame type calculated with mp_typeof(). */                       
        enum mp_type type;                                                      
        /**                                                                     
         * Total items in MP_MAP or MP_ARRAY container                          
         * calculated with mp_decode_map() or mp_decode_array().                
         */                                                                     
        uint32_t size;                                                          
        /**                                                                     
         * Count of items already processed. Must be less or                    
         * equal to mp_frame::size member.                                      
         */                                                                     
        uint32_t curr;                                                          
};                                                                              
                                                                                
/**                                                                             
 * Stack of service contexts mp_frame to do complex msgpack parse.              
 * The structure is needed in order to facilitate the decoding                  
 * nested MP_ARRAY and MP_MAP msgpack containers without                        
 * recursion. This allows you to determine that the parsing of                  
 * the current container is complete.                                           
*/                                                                              
struct mp_stack {                                                               
        /** The maximum stack depth. */                                         
        uint32_t size;                                                          
        /**                                                                     
         * Count of used stack frames. Corresponds to the index                 
         * in the array to perform the push operation. Must be                  
         * less or equal to mp_stack::size member.                              
         */                                                                     
        uint32_t used;                                                          
        /**                                                                     
         * Array of mp_frames descriptors having at least                       
         * mp_stack::size items.                                                
         */                                                                     
        struct mp_frame *frames;                                                
};



More information about the Tarantool-patches mailing list