示例#1
0
static void __print_container (string & result
        , json::value const & value
        , print_spec const & pspec
        , int indent)
{
    if (value.size() == 0) { 
        __print_open_brace(result, value, pspec);
        __print_close_brace(result, value, pspec);
        return;
    }
    
    json::value::const_iterator it_begin = value.cbegin();
    json::value::const_iterator it_end   = value.cend();
    json::value::const_iterator it       = it_begin;
    json::value::const_iterator it_next  = it_begin;
        
    ++it_next;
    
    indent += pspec.base_indent;
    
    __print_open_brace(result, value, pspec);
    result.append(pspec.new_line); // container content always begin after new line
    
    for (; it != it_end; ++it, ++it_next) {
        if (it == it_begin) {
            __print_indent(result, pspec, indent);
            
            if (pspec.comma_position == json::comma_next_line) {
                __print_indent(result, pspec, pspec.first_item_indent);
            }
        }
        
        if (value.is_object()) {
            __print_value(result, it.key(), *it, pspec, indent);
        } else {
            __print_value(result, *it, pspec, indent);
        }
        
        if (it_next != it_end) {
            __print_comma(result, pspec, indent);
        }
    }
    
    indent -= pspec.base_indent;    
    
    result.append(pspec.new_line);
    __print_indent(result, pspec, indent);
    __print_close_brace(result, value, pspec);
}
示例#2
0
static int print_value(struct seq_file *m,struct saved_value *buf)
{
	int len = 0;
	seq_printf(m,"DDR(%x):%x\n",DDR_MC,buf->ddr[0]);
	seq_printf(m,"DDR(%x):%x\n",DDR_RESULT_1,buf->ddr[1]);
	seq_printf(m,"DDR(%x):%x\n",DDR_RESULT_2,buf->ddr[2]);
	seq_printf(m,"DDR(%x):%x\n",DDR_RESULT_3,buf->ddr[3]);
	seq_printf(m,"DDR(%x):%x\n",DDR_RESULT_4,buf->ddr[4]);
#if 1
	__print_value(m,buf->cim,0,AHBM_CIM_IOB,11);
	__print_value(m,buf->ahb0,1,AHBM_AHB0_IOB,11);
	__print_value(m,buf->gpu,2,AHBM_GPU_IOB,16);
	__print_value(m,buf->lcd,3,AHBM_LCD_IOB,16);
	__print_value(m,buf->xxx,4,AHBM_XXX_IOB,16);
	__print_value(m,buf->ahb2,5,AHBM_AHB2_IOB,11);
#endif
	return len;
}