Builder/Builder/Common/plyfile.c
/******************************************************************************
Store a value into a place being pointed to, guided by a data type.

Entry:
  item       - place to store value
  type       - data type
  int_val    - integer version of value
  uint_val   - unsigned integer version of value
  double_val - double version of value

Exit:
  item - pointer to stored value
******************************************************************************/
Store a value into a place being pointed to, guided by a data type.

pointer to stored value
Store a value into a place being pointed to guided by a data type . pointer to stored value
void store_item (
  char *item,
  int type,
  int int_val,
  unsigned int uint_val,
  double double_val
)
{
  unsigned char *puchar;
  short int *pshort;
  unsigned short int *pushort;
  int *pint;
  unsigned int *puint;
  float *pfloat;
  double *pdouble;
  switch (type) {
    case PLY_CHAR:
      *item = int_val;
      break;
    case PLY_UCHAR:
      puchar = (unsigned char *) item;
      *puchar = uint_val;
      break;
    case PLY_SHORT:
      pshort = (short *) item;
      *pshort = int_val;
      break;
    case PLY_USHORT:
      pushort = (unsigned short *) item;
      *pushort = uint_val;
      break;
    case PLY_INT:
      pint = (int *) item;
      *pint = int_val;
      break;
    case PLY_UINT:
      puint = (unsigned int *) item;
      *puint = uint_val;
      break;
    case PLY_FLOAT:
      pfloat = (float *) item;
      *pfloat = double_val;
      break;
    case PLY_DOUBLE:
      pdouble = (double *) item;
      *pdouble = double_val;
      break;
    default:
      fprintf (stderr, "store_item: bad type = %d\n", type);
      exit (-1);
  }
}
void store_item ( char * item , int type , int int_val , unsigned int uint_val , double double_val ) { unsigned char * puchar ; short int * pshort ; unsigned short int * pushort ; int * pint ; unsigned int * puint ; float * pfloat ; double * pdouble ; switch ( type ) { case PLY_CHAR : * item = int_val ; break ; case PLY_UCHAR : puchar = ( unsigned char * ) item ; * puchar = uint_val ; break ; case PLY_SHORT : pshort = ( short * ) item ; * pshort = int_val ; break ; case PLY_USHORT : pushort = ( unsigned short * ) item ; * pushort = uint_val ; break ; case PLY_INT : pint = ( int * ) item ; * pint = int_val ; break ; case PLY_UINT : puint = ( unsigned int * ) item ; * puint = uint_val ; break ; case PLY_FLOAT : pfloat = ( float * ) item ; * pfloat = double_val ; break ; case PLY_DOUBLE : pdouble = ( double * ) item ; * pdouble = double_val ; break ; default : fprintf ( stderr , " \n " , type ) ; exit ( -1 ) ; } }
Store a value into a place being pointed to, guided by a data type.
Store a value into a place being pointed to guided by a data type .
//case PLY_FLOAT32: