void UnbentRMSDAlign(MultipleAlignment *ma) { WeightedResiduePositions *residuesTemp = (WeightedResiduePositions *)malloc(ma->numChains * sizeof(WeightedResiduePositions)); int* indices = (int*) malloc(sizeof(int) * ma->numChains); Matrix *matrices = (Matrix*) malloc(sizeof(Matrix) * ma->numChains); int i, j; for (i=0; i<ma->numChains; i++) { for (j=0; j<ma->numResidues; j++) { ma->residues[i].res[j] = ma->chains[i]->res[ma->residues[i].res[j].index]; } } AlignOrder(ma, ma->order->root, &i, residuesTemp, indices, matrices); for (i=0; i<ma->numChains; i++) { RotateChain(ma->chains[i]->pdb, &matrices[i]); } for (i=0; i<ma->numChains; i++) { for (j=0; j<ma->chains[i]->length; j++) { Atom *a = GetAtom(ma->chains[i]->pdb, j, " CA "); if (a) ma->chains[i]->res[j].coords = a->pos; } } for (i=0; i<ma->numChains; i++) { for (j=0; j<ma->numResidues; j++) { ma->residues[i].res[j] = ma->chains[i]->res[ma->residues[i].res[j].index]; } free(residuesTemp[i].res); } free(indices); free(residuesTemp); free(matrices); }
static SilikoSyntaxTreeNode *GetExprRoll(SilikoLexer *lexer) { SilikoSyntaxTreeNode *leftValue = NULL; SilikoSyntaxTreeNode *rest = NULL; SilikoSyntaxTreeNode *rVal; if (!(leftValue = GetAtom(lexer))) goto memerr; if (!(rest = GetExprRollLeftFactor(lexer))) goto memerr; if (rest->Type == SILIKO_AST_NOTHING) { SilikoSyntaxTreeDelete(rest); return leftValue; } if (!(rVal = SilikoSyntaxTreeNewBranch("dice"))) goto memerr; SilikoSyntaxTreePushRight(rVal, leftValue); SilikoSyntaxTreePushRight(rVal, rest); return rVal; memerr: SilikoSyntaxTreeDelete(leftValue); SilikoSyntaxTreeDelete(rest); return NULL; }
ResiduePositions *Distill(PDBChain *c, int id) { ResiduePositions *out = (ResiduePositions*) malloc(sizeof(ResiduePositions)); int i; out->res = (ResiduePosition*) malloc(sizeof(ResiduePosition)*c->length); out->id = id; out->pdb = c; out->length = c->length; for (i=0; i<c->length; i++) { Atom *a = GetAtom(c, i, " CA "); if (a) { out->res[i].coords = a->pos; out->res[i].hasCoords = 1; } else { out->res[i].hasCoords = 0; out->res[i].coords.x = 0; out->res[i].coords.y = 0; out->res[i].coords.z = 0; } out->res[i].residue = ShortNames[c->seq->seq[i]]; out->res[i].index = i; } return out; }
void STSDAtom::ReadDecoderConfig(uint8 **pDecoderConfig, size_t *pDecoderConfigSize, AudioDescription *pAudioDescription, VideoDescription *pVideoDescription) { // Check for a Decoder Config and if it exists copy it back to the caller // MPEG-4 video/audio use the various decoder config structures to pass // additional decoder information to the decoder. The extractor sometimes // needs to decode the data to work out how to properly construct the // decoder // First make sure we have a something if (GetBytesRemaining() > 0) { // Well something is there so read it as an atom AtomBase *aAtomBase = GetAtom(theStream); aAtomBase->ProcessMetaData(); printf("%s [%Ld]\n",aAtomBase->GetAtomName(),aAtomBase->GetAtomSize()); if (dynamic_cast<DecoderConfigAtom *>(aAtomBase)) { // DecoderConfig atom good DecoderConfigAtom *aDecoderConfigAtom = dynamic_cast<DecoderConfigAtom *>(aAtomBase); aDecoderConfigAtom->OverrideAudioDescription(pAudioDescription); aDecoderConfigAtom->OverrideVideoDescription(pVideoDescription); delete aAtomBase; } else { // Unknown atom bad printf("Unknown atom %s\n",aAtomBase->GetAtomName()); delete aAtomBase; } } }
HWND Window::Create(DWORD xStyle, const TCHAR *pName, DWORD style, int x, int y, int cx, int cy, HWND parent, HMENU hmenu) { if(!GetAtom()) { SetAtom(Register(m_hinst)); } return CreateWindowEx(xStyle, ClassName(), pName, style, x, y, cx, cy, parent, hmenu, m_hinst, this); }
nsresult GetAtomForGConfKey(const char *aGConfKey, PRUint32 *aAtom) \ {return GetAtom(aGConfKey, 1, aAtom);}
nsresult GetAtomForMozKey(const char *aMozKey, PRUint32 *aAtom) { return GetAtom(aMozKey, 0, aAtom); }
void CMOVAtom::OnProcessMetaData() { BMallocIO *theUncompressedData; uint8 *outBuffer; CMVDAtom *aCMVDAtom = NULL; uint32 compressionID = 0; uint64 descBytesLeft; uint32 Size; descBytesLeft = GetAtomSize(); // Check for Compression Type while (descBytesLeft > 0) { AtomBase *aAtomBase = GetAtom(theStream); aAtomBase->OnProcessMetaData(); if (aAtomBase->GetAtomSize() > 0) { descBytesLeft = descBytesLeft - aAtomBase->GetAtomSize(); } else { printf("Invalid Atom found when reading Compressed Headers\n"); descBytesLeft = 0; } if (dynamic_cast<DCOMAtom *>(aAtomBase)) { // DCOM atom compressionID = dynamic_cast<DCOMAtom *>(aAtomBase)->GetCompressionID(); delete aAtomBase; } else { if (dynamic_cast<CMVDAtom *>(aAtomBase)) { // CMVD atom aCMVDAtom = dynamic_cast<CMVDAtom *>(aAtomBase); descBytesLeft = 0; } } } // Decompress data if (compressionID == 'zlib') { Size = aCMVDAtom->GetUncompressedSize(); outBuffer = (uint8 *)(malloc(Size)); printf("Decompressing %ld bytes to %ld bytes\n",aCMVDAtom->GetBufferSize(),Size); int result = uncompress(outBuffer, &Size, aCMVDAtom->GetCompressedData(), aCMVDAtom->GetBufferSize()); if (result != Z_OK) { printf("Failed to decompress headers uncompress returned "); switch (result) { case Z_MEM_ERROR: DEBUGGER("Lack of Memory Error\n"); break; case Z_BUF_ERROR: DEBUGGER("Lack of Output buffer space Error\n"); break; case Z_DATA_ERROR: DEBUGGER("Input Data is corrupt or not a compressed set Error\n"); break; } } // Copy uncompressed data into BMAllocIO theUncompressedData = new BMallocIO(); theUncompressedData->SetSize(Size); theUncompressedData->WriteAt(0L,outBuffer,Size); free(outBuffer); delete aCMVDAtom; // reset position on BMAllocIO theUncompressedData->Seek(SEEK_SET,0L); // Assign to Stream theUncompressedStream = theUncompressedData; // All subsequent reads should use theUncompressedStream } }