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

Entry:
  plyfile - PLY file descriptor
  words   - list of words describing the property
  nwords  - number of words in the list
******************************************************************************/
Add a property to a PLY file descriptor.
Entry:
plyfile - PLY file descriptor
words   - list of words describing the property
nwords  - number of words in the list
Add a property to a PLY file descriptor . Entry : plyfile - PLY file descriptor words - list of words describing the property nwords - number of words in the list
void add_property (PlyFile *plyfile, char **words)
{
  PlyProperty *prop;
  PlyElement *elem;
  prop = (PlyProperty *) myalloc (sizeof (PlyProperty));
  if (equal_strings (words[1], "list")) {       
    prop->count_external = get_prop_type (words[2]);
    prop->external_type = get_prop_type (words[3]);
    prop->name = _strdup (words[4]);
    prop->is_list = 1;
  }
  else {                                        
    prop->external_type = get_prop_type (words[1]);
    prop->name = _strdup (words[2]);
    prop->is_list = 0;
  }
  elem = plyfile->elems[plyfile->nelems - 1];
  if (elem->nprops == 0)
    elem->props = (PlyProperty **) myalloc (sizeof (PlyProperty *));
  else
    elem->props = (PlyProperty **) realloc (elem->props,
                  sizeof (PlyProperty *) * (elem->nprops + 1));
  elem->props[elem->nprops] = prop;
  elem->nprops++;
}
void add_property ( PlyFile * plyfile , char * * words ) { PlyProperty * prop ; PlyElement * elem ; prop = ( PlyProperty * ) myalloc ( sizeof ( PlyProperty ) ) ; if ( equal_strings ( words [ 1 ] , " " ) ) { prop -> count_external = get_prop_type ( words [ 2 ] ) ; prop -> external_type = get_prop_type ( words [ 3 ] ) ; prop -> name = _strdup ( words [ 4 ] ) ; prop -> is_list = 1 ; } else { prop -> external_type = get_prop_type ( words [ 1 ] ) ; prop -> name = _strdup ( words [ 2 ] ) ; prop -> is_list = 0 ; } elem = plyfile -> elems [ plyfile -> nelems - 1 ] ; if ( elem -> nprops == 0 ) elem -> props = ( PlyProperty * * ) myalloc ( sizeof ( PlyProperty * ) ) ; else elem -> props = ( PlyProperty * * ) realloc ( elem -> props , sizeof ( PlyProperty * ) * ( elem -> nprops + 1 ) ) ; elem -> props [ elem -> nprops ] = prop ; elem -> nprops ++ ; }
Add a property to a PLY file descriptor.
Add a property to a PLY file descriptor .
/* create the new property */ /* is a list */ /* not a list */ /* add this property to the list of properties of the current element */