示例#1
0
/*************************************************************************************
src         [IN] ... buffer containing the data
my_col_def  [IN] ... the definition of the column to be dumped

dumps boolean values (up to 64 bits)
*************************************************************************************/
static rc_t vdt_dump_boolean_element( p_dump_str s, const p_dump_src src,
                                      const p_col_def def )
{
    rc_t rc;
    uint64_t value = vdt_move_to_uint64( src, def->type_desc.intrinsic_bits );
    switch( src->c_boolean )
    {
    case '1' :  if ( value == 0 )
                    rc = vds_append_str( s, "0" );
                else
                    rc = vds_append_str( s, "1" );
                break;
    case 'T' :  if ( value == 0 )
                    rc = vds_append_str( s, "F" );
                else
                    rc = vds_append_str( s, "T" );
                break;

    default  :  if ( value == 0 )
                    rc = vds_append_str( s, "false" );
                else
                    rc = vds_append_str( s, "true" );
                break;
    }
    DISP_RC( rc, "dump_str_append_str() failed" )
    return rc;
}
示例#2
0
/*************************************************************************************
src         [IN] ... buffer containing the data
my_col_def  [IN] ... the definition of the column to be dumped

unsigned int's up to a length of 64 bit are supported
unused bits are masked out
*************************************************************************************/
static rc_t vdt_dump_uint_element( p_dump_str s, const p_dump_src src,
                                   const p_col_def def )
{
    rc_t rc = 0;
    uint64_t value = vdt_move_to_uint64( src, def->type_desc.intrinsic_bits );
    if ( ( src->without_sra_types == false )&&( def->value_trans_fct != NULL ) )
    {
        const char *txt = def->value_trans_fct( (uint32_t)value );
        rc = vds_append_str( s, txt );
        DISP_RC( rc, "dump_str_append_str() failed" )
    }
    else
    {
        if ( src->in_hex )
示例#3
0
    rc = vds_clear( &(r_ctx->s_col) );
    DISP_RC( rc, "dump_str_clear() failed" )
    if ( rc != 0 ) return;

    if ( r_ctx->ctx->print_column_names )
    {
        rc = vds_append_fmt( &(r_ctx->s_col),
                             r_ctx->col_defs->max_colname_chars,
                             "%*s: ",
                             r_ctx->col_defs->max_colname_chars,
                             my_col_def->name );
        DISP_RC( rc, "dump_str_append_fmt() failed" )
    }

    /* append the cell-content */
    rc = vds_append_str( &(r_ctx->s_col), my_col_def->content.buf );
    DISP_RC( rc, "dump_str_append_str() failed" )
    if ( rc == 0 )
    {

        /* indent the cell-line, if requested */
        if ( r_ctx->ctx->indented_line_len > 0 )
        {
            rc = vds_indent( &(r_ctx->s_col),
                             r_ctx->ctx->indented_line_len,
                             r_ctx->col_defs->max_colname_chars + 2 );
            DISP_RC( rc, "dump_str_indent() failed" )
        }

        /* print a truncate-hint at the end of the line if truncated */
        if ( vds_truncated( &(r_ctx->s_col) ) )