int var_BLINES(TBUFF **rp, const char *vp) { bsizes(curbp); return (valid_buffer(curbp) ? any_ro_INT(rp, vp, curbp->b_linecount) : FALSE); }
int var_BCHARS(TBUFF **rp, const char *vp) { bsizes(curbp); return (valid_buffer(curbp) ? any_ro_ULONG(rp, vp, curbp->b_bytecount) : FALSE); }
static int hyperspray(int (*f) (char *)) { L_NUM dlno; int doff; AREGION *p; int count = 0; (void) bsizes(curbp); /* attach line numbers to each line */ dlno = DOT.l->l_number; doff = DOT.o; for (p = curbp->b_attribs; p != 0; p = p->ar_next) { if (p->ar_hypercmd) { int slno, elno, soff, eoff; slno = p->ar_region.r_orig.l->l_number; elno = p->ar_region.r_end.l->l_number; soff = p->ar_region.r_orig.o; eoff = p->ar_region.r_end.o; if (((slno == dlno && doff >= soff) || dlno > slno) && ((elno == dlno && doff < eoff) || dlno < elno)) { f(p->ar_hypercmd); count++; /* As originally written, there was no break below. This means that we'd loop over all of the attributes in case there were multiple overlapping attributes with attached hypertext commands. As cool as this may sound, it is actually of very dubious utility, and an action which removes some or all of the attributes very quickly gets this loop into trouble. So, if this functionality is really desired, we'll have to either make a copy of the attributes or somehow otherwise determine that they were modified or deleted. */ break; } } } return count; }
bool ESHDFIonsParser::put(xmlNodePtr cur) { //add basic attributes of the speciesset SpeciesSet& tspecies(ref_.getSpeciesSet()); int icharge= tspecies.addAttribute("charge");//charge_tag); int iatnumber= tspecies.addAttribute(atomic_number_tag); int membersize= tspecies.addAttribute("membersize"); int massind= tspecies.addAttribute(mass_tag); if(myComm->rank()==0 && hfile_id>=-1) readESHDF(); if(myComm->size()==1) return true; int nspecies=tspecies.getTotalNum(); int natoms=ref_.getTotalNum(); ostringstream o; if(myComm->rank()==0) { int i=0; for(; i<nspecies-1; ++i) o<<tspecies.speciesName[i]<<","; o<<tspecies.speciesName[i]; } TinyVector<int,3> bsizes(nspecies,natoms,o.str().size()+1); myComm->bcast(bsizes); //send the names: UGLY!!!! nspecies=bsizes[0]; char *species_names=new char[bsizes[2]]; if(myComm->rank()==0) snprintf(species_names, bsizes[2], "%s",o.str().c_str()); myComm->bcast(species_names,bsizes[2]); if(myComm->rank()) { vector<string> vlist; parsewords(species_names,vlist); for(int i=0; i<vlist.size(); ++i) tspecies.addSpecies(vlist[i]); //create natoms particles ref_.create(bsizes[1]); } delete [] species_names; ParticleSet::Tensor_t lat(ref_.Lattice.R); ParticleSet::Buffer_t pbuffer; for(int i=0; i<tspecies.numAttributes(); ++i) pbuffer.add(tspecies.d_attrib[i]->begin(),tspecies.d_attrib[i]->end()); pbuffer.add(lat.begin(),lat.end()); pbuffer.add(get_first_address(ref_.R),get_last_address(ref_.R)); pbuffer.add(ref_.GroupID.begin(),ref_.GroupID.end()); myComm->bcast(pbuffer); ref_.R.InUnit=PosUnit::CartesianUnit; if(myComm->rank()) { pbuffer.rewind(); for(int i=0; i<tspecies.numAttributes(); ++i) pbuffer.get(tspecies.d_attrib[i]->begin(),tspecies.d_attrib[i]->end()); pbuffer.get(lat.begin(),lat.end()); pbuffer.get(get_first_address(ref_.R),get_last_address(ref_.R)); pbuffer.get(ref_.GroupID.begin(),ref_.GroupID.end()); ref_.Lattice.set(lat); } return true; }