bit_read_TV (Bit_Chain *restrict dat)
{
  unsigned int i;
  unsigned int length;
  unsigned char *chain;

  length = bit_read_BS (dat);
  if (dat->byte + length >= dat->size)
    {
      loglevel = dat->opts & DWG_OPTS_LOGLEVEL;
      LOG_ERROR ("%s buffer overflow at %lu, length %u", __FUNCTION__,
                 dat->byte, length)
      return NULL;
    }
  chain = (unsigned char *)malloc (length + 1);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RC (dat);
#if 0
      /* we support encode and codepages */
      if (!isprint (chain[i]))
        chain[i] = '~';
#endif
    }
  chain[i] = '\0';

  return (char *)chain;
}
bit_read_TV (Bit_Chain *restrict dat)
{
  unsigned int i;
  unsigned int length;
  unsigned char *chain;

  length = bit_read_BS (dat);
  if (dat->byte + length >= dat->size)
    {
      loglevel = dat->opts & DWG_OPTS_LOGLEVEL;
      LOG_ERROR ("%s buffer overflow at %lu, length %u", __FUNCTION__,
                 dat->byte, length)
      return NULL;
    }
  chain = (unsigned char *)malloc (length + 1);
  for (i = 0; i < length; i++)
    {
      chain[i] = bit_read_RC (dat);
#if 0
       
      if (!isprint (chain[i]))
        chain[i] = '~';
#endif
    }
  chain[i] = '\0';

  return (char *)chain;
}