Builder/Builder/Common/plyfile.c
/******************************************************************************
Add an element to a PLY file descriptor.

Entry:
  plyfile - PLY file descriptor
  words   - list of words describing the element
  nwords  - number of words in the list
******************************************************************************/
Add an element to a PLY file descriptor.
Entry:
plyfile - PLY file descriptor
words   - list of words describing the element
nwords  - number of words in the list
Add an element to a PLY file descriptor . Entry : plyfile - PLY file descriptor words - list of words describing the element nwords - number of words in the list
void add_element (PlyFile *plyfile, char **words)
{
  PlyElement *elem;
  elem = (PlyElement *) myalloc (sizeof (PlyElement));
  elem->name = _strdup (words[1]);
  elem->num = atoi (words[2]);
  elem->nprops = 0;
  if (plyfile->nelems == 0)
    plyfile->elems = (PlyElement **) myalloc (sizeof (PlyElement *));
  else
    plyfile->elems = (PlyElement **) realloc (plyfile->elems,
                     sizeof (PlyElement *) * (plyfile->nelems + 1));
  plyfile->elems[plyfile->nelems] = elem;
  plyfile->nelems++;
}
void add_element ( PlyFile * plyfile , char * * words ) { PlyElement * elem ; elem = ( PlyElement * ) myalloc ( sizeof ( PlyElement ) ) ; elem -> name = _strdup ( words [ 1 ] ) ; elem -> num = atoi ( words [ 2 ] ) ; elem -> nprops = 0 ; if ( plyfile -> nelems == 0 ) plyfile -> elems = ( PlyElement * * ) myalloc ( sizeof ( PlyElement * ) ) ; else plyfile -> elems = ( PlyElement * * ) realloc ( plyfile -> elems , sizeof ( PlyElement * ) * ( plyfile -> nelems + 1 ) ) ; plyfile -> elems [ plyfile -> nelems ] = elem ; plyfile -> nelems ++ ; }
Add an element to a PLY file descriptor.
Add an element to a PLY file descriptor .
/* create the new element */ /* make room for new element in the object's list of elements */ /* add the new element to the object's list */