Ejemplo n.º 1
0
static int select_chainnames(t_atoms *atoms, int n_names, char **names,
                             atom_id *nr, atom_id *index)
{
    char    name[2];
    int     j;
    atom_id i;

    name[1] = 0;
    *nr     = 0;
    for (i = 0; i < atoms->nr; i++)
    {
        name[0] = atoms->resinfo[atoms->atom[i].resind].chainid;
        j       = 0;
        while (j < n_names && !comp_name(name, names[j]))
        {
            j++;
        }
        if (j < n_names)
        {
            index[*nr] = i;
            (*nr)++;
        }
    }
    printf("Found %d atom%s with chain identifier%s",
           *nr, (*nr == 1) ? "" : "s", (n_names == 1) ? "" : "s");
    for (j = 0; (j < n_names); j++)
    {
        printf(" %s", names[j]);
    }
    printf("\n");

    return *nr;
}
Ejemplo n.º 2
0
static int select_residuenames(t_atoms *atoms, int n_names, char **names,
                               atom_id *nr, atom_id *index)
{
    char   *name;
    int     j;
    atom_id i;

    *nr = 0;
    for (i = 0; i < atoms->nr; i++)
    {
        name = *(atoms->resinfo[atoms->atom[i].resind].name);
        j    = 0;
        while (j < n_names && !comp_name(name, names[j]))
        {
            j++;
        }
        if (j < n_names)
        {
            index[*nr] = i;
            (*nr)++;
        }
    }
    printf("Found %d atoms with residue name%s", *nr, (n_names == 1) ? "" : "s");
    for (j = 0; (j < n_names); j++)
    {
        printf(" %s", names[j]);
    }
    printf("\n");

    return *nr;
}
Ejemplo n.º 3
0
LDPUBLIC32 const char * LDPUBLIC16 dsk_compname(DSK_DRIVER *self)
{
        if (!self) return "(null)";
	if (!self->dr_compress) return NULL;
	
	return comp_name(self->dr_compress);	
}
Ejemplo n.º 4
0
static int select_atomnames(t_atoms *atoms,int n_names,char **names,
			    atom_id *nr,atom_id *index,bool bType)
{
  char *name;
  int j;
  atom_id i;
  
  *nr=0;
  for(i=0; i<atoms->nr; i++) {
    if (bType)
      name=*(atoms->atomtype[i]);
    else
      name=*(atoms->atomname[i]);
    j=0; 
    while (j<n_names && comp_name(name,names[j])) 
      j++;
    if (j<n_names) {
      index[*nr]=i;
      (*nr)++;
    }
  }
  printf("Found %u atoms with %s%s",
	 *nr,bType ? "type" : "name",(n_names==1)?"":"s");
  for(j=0; (j<n_names); j++)
    printf(" %s",names[j]);
  printf("\n");

  return *nr;
}
Ejemplo n.º 5
0
Record_List * list_find_nameelem(void * list,char  * name)
{
	Record_List * head = list;
	Record_List * curr = (Record_List *)head->list.next;
	UUID_HEAD * record_head;
	
	while(curr!=head)
	{
		record_head=(UUID_HEAD *)curr->record;
		if(comp_name(record_head->name,name)==0)
			return curr;
		curr= (Record_List *)curr->list.next;
	}
	return NULL;
}
Ejemplo n.º 6
0
CosNaming::NamingContext_ptr
TAO_Hash_Naming_Context::get_context (const CosNaming::Name &name)
{
  CosNaming::NamingContext_var result =
    CosNaming::NamingContext::_nil ();

  // Create compound name to be resolved, i.e.,
  // (<name> - last component).  To avoid copying, we can just reuse
  // <name>'s buffer, since we will not be modifying it.
  CORBA::ULong name_len = name.length ();
  CosNaming::Name comp_name (name.maximum (),
                             name_len - 1,
                             const_cast<CosNaming::NameComponent*> (name.get_buffer ()));
  try
    {
      CORBA::Object_var context = this->resolve (comp_name);

      // Try narrowing object reference to the NamingContext type.
      result = CosNaming::NamingContext::_narrow (context.in ());
    }
  catch (CosNaming::NamingContext::NotFound& ex)
    {
      // Add the last component of the name, which was stripped before
      // the call to resolve.
      CORBA::ULong const rest_len = ex.rest_of_name.length () + 1;
      ex.rest_of_name.length (rest_len);
      ex.rest_of_name[rest_len - 1] = name[name_len - 1];

      throw;
    }

  if (CORBA::is_nil (result.in ()))
    {
      CosNaming::Name rest;
      rest.length (2);
      rest[0] = name[name_len - 2];
      rest[1] = name[name_len - 1];
      throw CosNaming::NamingContext::NotFound(
        CosNaming::NamingContext::not_context,
        rest);
    }
  // Finally, if everything went smoothly, just return the resolved
  // context.
  return result._retn ();
}
Ejemplo n.º 7
0
static int select_atomnames(const t_atoms *atoms, int n_names, char **names,
                            int *nr, int *index, gmx_bool bType)
{
    char   *name;
    int     j;
    int     i;

    *nr = 0;
    for (i = 0; i < atoms->nr; i++)
    {
        if (bType)
        {
            name = *(atoms->atomtype[i]);
        }
        else
        {
            name = *(atoms->atomname[i]);
        }
        j = 0;
        while (j < n_names && !comp_name(name, names[j]))
        {
            j++;
        }
        if (j < n_names)
        {
            index[*nr] = i;
            (*nr)++;
        }
    }
    printf("Found %d atoms with %s%s",
           *nr, bType ? "type" : "name", (n_names == 1) ? "" : "s");
    for (j = 0; (j < n_names); j++)
    {
        printf(" %s", names[j]);
    }
    printf("\n");

    return *nr;
}