static void ld_idef(int src,t_idef *idef) { int i; blockrx(src,idef->ntypes); blockrx(src,idef->atnr); snew(idef->functype,idef->ntypes); snew(idef->iparams,idef->ntypes); nblockrx(src,idef->ntypes,idef->functype); nblockrx(src,idef->ntypes,idef->iparams); for(i=0; (i<F_NRE); i++) ld_ilist(src,&idef->il[i]); }
static void ld_symtab(int src,t_symtab *symtab) { int i,nr,len; blockrx(src,symtab->nr); nr=symtab->nr; snew(symtab->symbuf,1); symtab->symbuf->bufsize=nr; snew(symtab->symbuf->buf,nr); for (i=0; i<nr; i++) { blockrx(src,len); snew(symtab->symbuf->buf[i],len); nblockrx(src,len,symtab->symbuf->buf[i]); } }
static void ld_ilist(int src,t_ilist *ilist) { blockrx(src,ilist->nr); nblockrx(src,MAXNODES,ilist->multinr); snew(ilist->iatoms,ilist->nr); nblockrx(src,ilist->nr,ilist->iatoms); }
static void ld_vectors(int src,rvec x[],rvec v[]) { int natoms; blockrx(src,natoms); nblockrx(src,natoms,x); nblockrx(src,natoms,v); }
static void ld_cosines(int src,t_cosines *cs) { blockrx(src,cs->n); snew(cs->a,cs->n); snew(cs->phi,cs->n); if (cs->n > 0) { nblockrx(src,cs->n,cs->a); nblockrx(src,cs->n,cs->phi); } }
static void ld_grpopts(int src,t_grpopts *g) { blockrx(src,g->ngtc); blockrx(src,g->ngacc); blockrx(src,g->ngfrz); blockrx(src,g->ngener); snew(g->nrdf,g->ngtc); snew(g->tau_t,g->ngtc); snew(g->ref_t,g->ngtc); snew(g->acc,g->ngacc); snew(g->nFreeze,g->ngfrz); snew(g->eg_excl,g->ngener*g->ngener); nblockrx(src,g->ngtc,g->nrdf); nblockrx(src,g->ngtc,g->tau_t); nblockrx(src,g->ngtc,g->ref_t); nblockrx(src,g->ngacc,g->acc); nblockrx(src,g->ngfrz,g->nFreeze); nblockrx(src,g->ngener*g->ngener,g->eg_excl); }
static void ld_parm(int src,t_parm *parm) { int i; blockrx(src,*parm); ld_grpopts(src,&(parm->ir.opts)); for(i=0; (i<DIM); i++) { ld_cosines(src,&(parm->ir.ex[i])); ld_cosines(src,&(parm->ir.et[i])); } }
static void ld_atoms(int src,t_symtab *symtab,t_atoms *atoms) { int atomnr; blockrx(src,atoms->nr); snew(atoms->atom,atoms->nr); nblockrx(src,atoms->nr,atoms->atom); atomnr=ld_strings(src,symtab,&atoms->atomname); assert(atomnr==atoms->nr); atoms->nres=ld_strings(src,symtab,&atoms->resname); atoms->ngrpname=ld_strings(src,symtab,&atoms->grpname); ld_grps(src,atoms->grps); ld_block(src,&atoms->excl); }
static void ld_grps(int src,t_grps grps[]) { int i; for(i=0; (i<egcNR); i++) { blockrx(src,grps[i].nr); snew(grps[i].nm_ind,grps[i].nr); nblockrx(src,grps[i].nr,grps[i].nm_ind); } for( ; (i<egcNR); i++) { grps[i].nr=0; grps[i].nm_ind=NULL; } }
static int ld_strings(int src,t_symtab *symtab,char ****nm) { int i,nr; int *handle; char ***NM; blockrx(src,nr); snew(handle,nr); nblockrx(src,nr,handle); snew(*nm,nr); NM=*nm; for (i=0; (i<nr); i++) NM[i]=get_symtab_handle(symtab,handle[i]); sfree(handle); return nr; }
static void ld_nsb(int src,t_nsborder *nsb) { blockrx(src,nsb->nnodes); blockrx(src,nsb->shift); blockrx(src,nsb->bshift); blockrx(src,nsb->nstDlb); blockrx(src,nsb->cgtotal); blockrx(src,nsb->natoms); nblockrx(src,MAXNODES,nsb->homenr); nblockrx(src,MAXNODES,nsb->index); nblockrx(src,MAXNODES,nsb->cgload); nblockrx(src,MAXNODES,nsb->workload); }
void QssParser::processStyleSheet(QString &ss) { if (ss.isEmpty()) return; // Remove C-style comments /* */ or // QRegExp commentRx("(//.*(\\n|$)|/\\*.*\\*/)"); commentRx.setMinimal(true); ss.remove(commentRx); // Palette definitions first, so we can apply roles later on QRegExp paletterx("(Palette[^{]*)\\{([^}]+)\\}"); int pos = 0; while ((pos = paletterx.indexIn(ss, pos)) >= 0) { parsePaletteBlock(paletterx.cap(1).trimmed(), paletterx.cap(2).trimmed()); ss.remove(pos, paletterx.matchedLength()); } // Now we can parse the rest of our custom blocks QRegExp blockrx("((?:ChatLine|ChatListItem|NickListItem)[^{]*)\\{([^}]+)\\}"); pos = 0; while ((pos = blockrx.indexIn(ss, pos)) >= 0) { //qDebug() << blockrx.cap(1) << blockrx.cap(2); QString declaration = blockrx.cap(1).trimmed(); QString contents = blockrx.cap(2).trimmed(); if (declaration.startsWith("ChatLine")) parseChatLineBlock(declaration, contents); else if (declaration.startsWith("ChatListItem") || declaration.startsWith("NickListItem")) parseListItemBlock(declaration, contents); //else // TODO: add moar here ss.remove(pos, blockrx.matchedLength()); } }