hmmer-3.3/easel/esl_huffman.c
/* Function:  esl_huffman_Dump()
 * Synopsis:  Dump info on a huffman code structure.
 * Incept:    SRE, Sat Jun  4 07:38:15 2016
 *
 * Purpose:   Dump the internals of object <hc> to output stream <fp>.
 */
esl_huffman_Dump()
Synopsis:  Dump info on a huffman code structure.

Dump the internals of object  to output stream .
esl_huffman_Dump () Synopsis : Dump info on a huffman code structure . Dump the internals of object to output stream .
int
esl_huffman_Dump(FILE *fp, ESL_HUFFMAN *hc)
{
  int r,x;
  int d,L;
  fprintf(fp, "Encoding table:\n");
  for (r = 0; r < hc->Ku; r++)
    {
      x = hc->sorted_at[r];
      fprintf(fp, "%3d %2d ", x, hc->len[x]);
      dump_uint32(fp, hc->code[x], hc->len[x]);
      fprintf(fp, "\n");
    }
  fputc('\n', fp);
  if (hc->dt_len)
    {
      fprintf(fp, "Decoding table:\n");
      for (d = 0; d < hc->D; d++)
        {
          L = hc->dt_len[d];
          fprintf(fp, "L=%2d  r=%3d (%3d) ", L, hc->dt_rank[d], hc->sorted_at[hc->dt_rank[d]]);
          dump_uint32(fp, hc->dt_lcode[d], eslHUFFMAN_MAXCODE);
          fputc('\n', fp);
        }
    }
  return eslOK;
}
int esl_huffman_Dump ( FILE * fp , ESL_HUFFMAN * hc ) { int r , x ; int d , L ; fprintf ( fp , " \n " ) ; for ( r = 0 ; r < hc -> Ku ; r ++ ) { x = hc -> sorted_at [ r ] ; fprintf ( fp , " " , x , hc -> len [ x ] ) ; dump_uint32 ( fp , hc -> code [ x ] , hc -> len [ x ] ) ; fprintf ( fp , " \n " ) ; } fputc ( ' \n ' , fp ) ; if ( hc -> dt_len ) { fprintf ( fp , " \n " ) ; for ( d = 0 ; d < hc -> D ; d ++ ) { L = hc -> dt_len [ d ] ; fprintf ( fp , " " , L , hc -> dt_rank [ d ] , hc -> sorted_at [ hc -> dt_rank [ d ] ] ) ; dump_uint32 ( fp , hc -> dt_lcode [ d ] , eslHUFFMAN_MAXCODE ) ; fputc ( ' \n ' , fp ) ; } } return eslOK ; }
Function:  esl_huffman_Dump()
 Synopsis:  Dump info on a huffman code structure.
Function : esl_huffman_Dump () Synopsis : Dump info on a huffman code structure .
/* Encoding table: <letter index> <code length> <binary encoding> */ /* Decoding table (if set) */