void OBJWriterNodeVisitor::processGeometry(osg::Geometry* geo, osg::Matrix& m) { _fout << std::endl; _fout << "o " << getUniqueName( geo->getName().empty() ? geo->className() : geo->getName() ) << std::endl; if (geo->containsDeprecatedData()) geo->fixDeprecatedData(); processStateSet(_currentStateSet.get()); processArray("v", geo->getVertexArray(), m, false); processArray("vn", geo->getNormalArray(), m, true); processArray("vt", geo->getTexCoordArray(0)); // we support only tex-unit 0 unsigned int normalIndex = 0; for(unsigned int i = 0; i < geo->getNumPrimitiveSets(); ++i) { osg::PrimitiveSet* ps = geo->getPrimitiveSet(i); ObjPrimitiveIndexWriter pif(_fout, geo, normalIndex, _lastVertexIndex, _lastNormalIndex, _lastTexIndex); ps->accept(pif); if(geo->getNormalArray() && geo->getNormalArray()->getBinding() == osg::Array::BIND_PER_PRIMITIVE_SET) ++normalIndex; } if (geo->getVertexArray()) _lastVertexIndex += geo->getVertexArray()->getNumElements(); if (geo->getNormalArray()) _lastNormalIndex += geo->getNormalArray()->getNumElements(); if(geo->getTexCoordArray(0)) _lastTexIndex += geo->getTexCoordArray(0)->getNumElements(); }
void MemoryMapBuilderCS::processInstance(const Instance &inst, MemoryMapNode *node, VariableTypeContainerList *path) { // Ignore user-land objects if (inst.address() < _map->_vmem->memSpecs().pageOffset) return; // Ignore instances which we cannot access if (!inst.isValid() || !inst.isAccessible()) return; try { if (MemoryMapHeuristics::isFunctionPointer(inst)) processFunctionPointer(inst, node, path); else if (inst.type()->type() & rtPointer) processPointer(inst, node); else if (inst.type()->type() & rtArray) processArray(inst, node, path); else if (inst.type()->type() & StructOrUnion) processStructured(inst, node, path); } catch (GenericException&) { // Do nothing } }
void CLI::run() { bool worktime = true; while (worktime) { m_qout << "----------------" << endl << "1 - Enter array" << endl << "2 - Enter string" << endl << "3 - Quit" << endl << "Enter command: " << flush; switch (m_qin.readLine().toInt()) { case 1: processArray(); break; case 2: processString(); break; case 3: worktime = false; printMsg("See you later..." ); break; default: printMsg("Undefined command"); } m_qout << endl << flush; } }
void processAllData() { if (mQuantileNormalisation) { while (fread(mBuf, sizeof(double), nGenes, mData) == nGenes) { processArray(true); } fseek(mData, 0, SEEK_SET); for (uint32_t i = 0; i < nGenes; i++) mRankAvgs[i] /= mRankCounts[i]; } while (fread(mBuf, sizeof(double), nGenes, mData) == nGenes) { processArray(); } }
ModuleInfo parseModuleInfo(const utils::Buffer& buf) { utils::StructReader sr(reinterpret_cast<const char*>(buf.getPtr())); try { std::string name = sr.getStringValue("gui_name"); std::string identifier = sr.getStringValue("identifier"); std::string group = sr.getStringValue("group"); std::string inputs = sr.getStringValue("inputs"); std::string outputs = sr.getStringValue("outputs"); std::string moduleType = sr.getStringValue("type"); try { std::vector<PlugInfo> ins = processArray(inputs); std::vector<PlugInfo> outs = processArray(outputs); if (moduleType == "xpm") { const char* ptr = reinterpret_cast<const char*>(buf.getPtr()); const char* offset = ptr + strlen(ptr) + 1; int newLen = buf.getLen() - strlen(ptr) - 1; utils::AutoPtr<Xpm> xpm(new Xpm(offset,newLen)); return ModuleInfo(identifier,name,group,ins,outs,xpm); } else { throw std::runtime_error("MUIltkj"); } } catch (std::logic_error&) { std::cerr << "Buffer = <" << buf.getPtr() << ">" << std::endl; } } catch (std::runtime_error& e) { std::string msg = "Fehler beim Parsen der ModulInfo: "; msg += e.what(); throw std::runtime_error(msg.c_str()); } }
int main(int argc, char **argv) { if (argc < 2) { helpStandard(argv[0]); exit(1); } for (int z=0; z<256; z++) translate[z] = (char)z; processArray(argc, argv); delete fasta; }
int main() { int *ptr=NULL,i; /* if(allocate(&ptr, 10)!=1) for(i=0; i<10; i++){ ptr[i]=i; printf("%d\n",ptr[i]); }*/ processArray(ar); printf("%d %d\n",ar[0][0],ar[1][1]); return 0; }
void processFile(char *filename) { FILE *F = NULL; if (strcmp(filename, "-") == 0) { F = stdin; } else { errno = 0; F = fopen(filename, "r"); if (errno) fprintf(stderr, "Couldn't open '%s': %s\n", filename, strerror(errno)), exit(1); } uint64 max = 16 * 1024 * 1024; uint64 pos = 0; size_t len = 0; char *data = new char [max]; // Suck the file into 'data' while (!feof(F)) { errno = 0; len = fread(data+pos, 1, max - pos, F); if (errno) fprintf(stderr, "Couldn't read "F_U64" bytes from '%s': %s\n", (uint64)(max-pos), filename, strerror(errno)), exit(1); pos += len; if (pos >= max) { max += 16 * 1024 * 1024; char *tmpd = new char [max]; memcpy(tmpd, data, pos); delete [] data; data = tmpd; } } if (strcmp(filename, "-") != 0) fclose(F); len = pos; // (over)count the number of words; we start at two, since the // first arg is the name of the program, and if there is only one // word and no whitespace in the file, the below loop fails to // count the second word. int argc = 2; char **argv = 0L; for (uint32 i=0; i<len; i++) { if (isspace(data[i])) { argc++; data[i] = 0; } } // Allocate space for word pointers, then set them. First arg in // argv[] is the name of the program -- we'll substitute the name // of the file instead. argv = new char * [argc]; argv[0] = filename; argc = 1; // Three steps: Skip leading whitespace; save the arg if it's a // real arg (and not the end of the file; then skip the word. for (uint32 pos=0; pos<len; pos++) { while ((data[pos] == 0) && (pos < len)) pos++; if (pos < len) argv[argc++] = data+pos; while ((data[pos] != 0) && (pos < len)) pos++; } processArray(argc, argv); delete [] argv; delete [] data; }