netmsgs/libnetmsgs/nmLibInternal.c
void nmTraceField(const NMFieldDef_T *pFieldDef,
                  byte_t              buf[],
                  size_t              uCount,
                  uint_t              uDepth,
                  const char          *sFmt,
                  ...)
{
  va_list ap;
  char    bufRepr[256];
  uint_t  uIndent;
  int     n;

  va_start(ap, sFmt);
  vsnprintf(bufRepr, sizeof(bufRepr), sFmt, ap);
  va_end(ap);
  bufRepr[sizeof(bufRepr)-1] = 0;

  uIndent = uDepth * 2;

  if( pFieldDef != NULL )
  {
    // "normal"
    if( pFieldDef->m_eFId != NMFID_NONE )
    {
      n = fprintf(stderr, "%*s%c:%s(%u) = %s: ",
          uIndent, "", pFieldDef->m_eFType, pFieldDef->m_sFName,
          pFieldDef->m_eFId, bufRepr);
    }
    // vector items have no field ids
    else
    {
      n = fprintf(stderr, "%*s[%c]: = %s: ",
          uIndent, "", pFieldDef->m_eFType, bufRepr);
    }
  }
  else
  {
    n = fprintf(stderr, "%*s%s: ", uDepth*2, "", bufRepr);
  }

  if( uCount > 0 )
  {
    if( n > 36 )
    {
      fprintf(stderr, "\n");
      n = 0;
    }

    fprintf(stderr, "%*s", 38-n, "");
    nmPrintBuf(stderr, NULL, buf, uCount, 8, 38);
  }
  fprintf(stderr, "\n");
}
/*!
 * \brief Trace packing/unpacking of a message field.
 *
 * \param pFieldDef   Pointer to field definition.
 * \param buf         Packed/unpacked buffer.
 * \param uCount      Number of bytes in buffer to trace.
 * \param uDepth      Depth of field in recursive definition.
 * \param sFmt        Field representation format string.
 * \param ...         Field representation variable arguments.
 */
\brief Trace packing/unpacking of a message field.
\param pFieldDef   Pointer to field definition.
\param buf         Packed/unpacked buffer.
\param uCount      Number of bytes in buffer to trace.
\param uDepth      Depth of field in recursive definition.
\param sFmt        Field representation format string.
\ brief Trace packing / unpacking of a message field . \ param pFieldDef Pointer to field definition . \ param buf Packed / unpacked buffer . \ param uCount Number of bytes in buffer to trace . \ param uDepth Depth of field in recursive definition . \ param sFmt Field representation format string .
void nmTraceField(const NMFieldDef_T *pFieldDef,
                  byte_t              buf[],
                  size_t              uCount,
                  uint_t              uDepth,
                  const char          *sFmt,
                  ...)
{
  va_list ap;
  char    bufRepr[256];
  uint_t  uIndent;
  int     n;
  va_start(ap, sFmt);
  vsnprintf(bufRepr, sizeof(bufRepr), sFmt, ap);
  va_end(ap);
  bufRepr[sizeof(bufRepr)-1] = 0;
  uIndent = uDepth * 2;
  if( pFieldDef != NULL )
  {
    if( pFieldDef->m_eFId != NMFID_NONE )
    {
      n = fprintf(stderr, "%*s%c:%s(%u) = %s: ",
          uIndent, "", pFieldDef->m_eFType, pFieldDef->m_sFName,
          pFieldDef->m_eFId, bufRepr);
    }
    else
    {
      n = fprintf(stderr, "%*s[%c]: = %s: ",
          uIndent, "", pFieldDef->m_eFType, bufRepr);
    }
  }
  else
  {
    n = fprintf(stderr, "%*s%s: ", uDepth*2, "", bufRepr);
  }
  if( uCount > 0 )
  {
    if( n > 36 )
    {
      fprintf(stderr, "\n");
      n = 0;
    }
    fprintf(stderr, "%*s", 38-n, "");
    nmPrintBuf(stderr, NULL, buf, uCount, 8, 38);
  }
  fprintf(stderr, "\n");
}
void nmTraceField ( const NMFieldDef_T * pFieldDef , byte_t buf [ ] , size_t uCount , uint_t uDepth , const char * sFmt , ... ) { va_list ap ; char bufRepr [ 256 ] ; uint_t uIndent ; int n ; va_start ( ap , sFmt ) ; vsnprintf ( bufRepr , sizeof ( bufRepr ) , sFmt , ap ) ; va_end ( ap ) ; bufRepr [ sizeof ( bufRepr ) - 1 ] = 0 ; uIndent = uDepth * 2 ; if ( pFieldDef != NULL ) { if ( pFieldDef -> m_eFId != NMFID_NONE ) { n = fprintf ( stderr , " " , uIndent , " " , pFieldDef -> m_eFType , pFieldDef -> m_sFName , pFieldDef -> m_eFId , bufRepr ) ; } else { n = fprintf ( stderr , " " , uIndent , " " , pFieldDef -> m_eFType , bufRepr ) ; } } else { n = fprintf ( stderr , " " , uDepth * 2 , " " , bufRepr ) ; } if ( uCount > 0 ) { if ( n > 36 ) { fprintf ( stderr , " \n " ) ; n = 0 ; } fprintf ( stderr , " " , 38 - n , " " ) ; nmPrintBuf ( stderr , NULL , buf , uCount , 8 , 38 ) ; } fprintf ( stderr , " \n " ) ; }
\brief Trace packing/unpacking of a message field.
\ brief Trace packing / unpacking of a message field .
// "normal" // vector items have no field ids