BRL-CAD
#include "common.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "bu/cv.h"
#include "bu/endian.h"
#include "bu/malloc.h"
#include "bu/str.h"
Include dependency graph for convert.c:

Go to the source code of this file.

Functions

int bu_cv_cookie (const char *in)
 
HIDDEN void bu_cv_fmt_cookie (char *buf, size_t buflen, int cookie)
 
void bu_cv_pr_cookie (char *title, int cookie)
 
size_t bu_cv (void *out, char *outfmt, size_t size, void *in, char *infmt, size_t count)
 
int bu_cv_optimize (register int cookie)
 
size_t bu_cv_itemlen (register int cookie)
 
size_t bu_cv_ntohss (register short int *out, size_t size, register void *in, size_t count)
 
size_t bu_cv_ntohus (register short unsigned int *out, size_t size, register void *in, size_t count)
 
size_t bu_cv_ntohsl (register long int *out, size_t size, register void *in, size_t count)
 
size_t bu_cv_ntohul (register long unsigned int *out, size_t size, register void *in, size_t count)
 
size_t bu_cv_htonss (void *out, size_t size, register short int *in, size_t count)
 
size_t bu_cv_htonus (void *out, size_t size, register short unsigned int *in, size_t count)
 
size_t bu_cv_htonsl (void *out, size_t size, register long int *in, size_t count)
 
size_t bu_cv_htonul (void *out, size_t size, register long unsigned int *in, size_t count)
 
size_t bu_cv_w_cookie (void *out, int outcookie, size_t size, void *in, int incookie, size_t count)
 

Detailed Description

Routines to translate data formats. The data formats are:

  • Host/Network is the data in host format or local format
  • signed/unsigned Is the data signed?
  • char/short/int/long/double Is the data 8bits, 16bits, 32bits, 64bits or a double?

The method of conversion is to convert up to double then back down the the expected output format.

Definition in file convert.c.

Function Documentation

HIDDEN void bu_cv_fmt_cookie ( char *  buf,
size_t  buflen,
int  cookie 
)
void bu_cv_pr_cookie ( char *  title,
int  cookie 
)

Definition at line 240 of file convert.c.

References bu_cv_fmt_cookie().

Here is the call graph for this function:

int bu_cv_optimize ( register int  cookie)

Definition at line 260 of file convert.c.

References BU_BIG_ENDIAN, bu_byteorder(), CV_16, CV_32, CV_64, CV_8, CV_D, CV_HOST_MASK, and CV_TYPE_MASK.

Referenced by bu_cv_w_cookie().

Here is the call graph for this function:

size_t bu_cv_itemlen ( register int  cookie)

Definition at line 289 of file convert.c.

References CV_HOST_MASK, CV_TYPE_MASK, and CV_TYPE_SHIFT.

Referenced by bu_cv_w_cookie().

size_t bu_cv_ntohss ( register short int *  out,
size_t  size,
register void *  in,
size_t  count 
)

Definition at line 304 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_ntohus ( register short unsigned int *  out,
size_t  size,
register void *  in,
size_t  count 
)

Definition at line 327 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_ntohsl ( register long int *  out,
size_t  size,
register void *  in,
size_t  count 
)

Definition at line 346 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_ntohul ( register long unsigned int *  out,
size_t  size,
register void *  in,
size_t  count 
)

Definition at line 369 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_htonss ( void *  out,
size_t  size,
register short int *  in,
size_t  count 
)

Definition at line 391 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_htonus ( void *  out,
size_t  size,
register short unsigned int *  in,
size_t  count 
)

Definition at line 410 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_htonsl ( void *  out,
size_t  size,
register long int *  in,
size_t  count 
)

Definition at line 430 of file convert.c.

Referenced by bu_cv_w_cookie().

size_t bu_cv_htonul ( void *  out,
size_t  size,
register long unsigned int *  in,
size_t  count 
)

Definition at line 452 of file convert.c.

Referenced by bu_cv_w_cookie().