int main() { std::vector<std::string> samplesFileList = getSamplesFileList(); for (unsigned i = 0; i < samplesFileList.size(); ++i) { std::cout << "========"; std::cout << "File: " << samplesFileList[i] << std::endl; FileReader fileReader( samplesFileList[i]); bitmap::BitmapSource* pResult = NULL; pResult = bitmap::BitmapFactory::loadBitmap( fileReader); std::cout << "Can read: " << (pResult != NULL) << std::endl; if (pResult) { dumpValues(*pResult, samplesFileList[i] + ".dump"); } } }
void RegionDumper::dump() { cout << "=== Header ===" << endl; cout << "Count: " << m_header.m_count << endl; cout << "Size: " << m_header.m_size << endl; cout << "Start: " << m_header.m_startTime << endl; cout << "End: " << m_header.m_endTime << endl; cout << endl; cout << "=== Records ===" << endl; for (size_t i=0; i < m_records.size(); i++) { cout << "#" << i << endl; cout << "Metric: " << m_metrics[i] << endl; cout << "Type: " << m_records[i].m_type << endl; cout << "Start: " << m_records[i].m_startTime << endl; cout << "End: " << m_records[i].m_endTime << endl; cout << "Time: " << m_records[i].m_timeline << endl; cout << "Data: " << m_records[i].m_values << endl; cout << endl; } cout << endl; size_t i = 0; map< size_t, size_t >::iterator iter = m_timelines.begin(); for ( ; iter != m_timelines.end(); ++iter, ++i) { cout << "Timeline " << i << ": " << endl; size_t offset = ftell(m_file); if (offset != iter->first) THROW("Invalid timeline offset"); dumpTimeline(m_records[iter->second].m_count); } i = 0; for (iter = m_values.begin(); iter != m_values.end(); ++iter, ++i) { cout << "Values " << i << ": " << endl; size_t offset = ftell(m_file); if (offset != iter->first) THROW("Invalid values offset"); dumpValues(m_records[iter->second].m_count, m_records[iter->second].m_type); } }
static ssize_t NUVOTONdev_read(struct file *filp, char __user *buff, size_t len, loff_t *off) { int minor, vLoop; dprintk(100, "%s > (len %d, offs %d)\n", __func__, len, (int) *off); if (len == 0) return len; minor = -1; for (vLoop = 0; vLoop < LASTMINOR; vLoop++) { if (FrontPanelOpen[vLoop].fp == filp) { minor = vLoop; } } if (minor == -1) { printk("Error Bad Minor\n"); return -EUSERS; } dprintk(100, "minor = %d\n", minor); if (minor == FRONTPANEL_MINOR_RC) { int size = 0; unsigned char data[20]; memset(data, 0, 20); getRCData(data, &size); if (size > 0) { if (down_interruptible(&FrontPanelOpen[minor].sem)) return -ERESTARTSYS; copy_to_user(buff, data, size); up(&FrontPanelOpen[minor].sem); dprintk(100, "%s < %d\n", __func__, size); return size; } dumpValues(); return 0; } /* copy the current display string to the user */ if (down_interruptible(&FrontPanelOpen[minor].sem)) { printk("%s return erestartsys<\n", __func__); return -ERESTARTSYS; } if (FrontPanelOpen[minor].read == lastdata.length) { FrontPanelOpen[minor].read = 0; up (&FrontPanelOpen[minor].sem); printk("%s return 0<\n", __func__); return 0; } if (len > lastdata.length) len = lastdata.length; /* fixme: needs revision because of utf8! */ if (len > 16) len = 16; FrontPanelOpen[minor].read = len; copy_to_user(buff, lastdata.data, len); up (&FrontPanelOpen[minor].sem); dprintk(100, "%s < (len %d)\n", __func__, len); return len; }
void SkDisplayable::dumpAttrs(SkAnimateMaker* maker) { SkDisplayTypes type = getType(); if (type == SkType_Unknown) { //SkDebugf("/>\n"); return; } SkDisplayable* blankCopy = SkDisplayType::CreateInstance(maker, type); int index = -1; int propIndex = 0; const SkMemberInfo* info; const SkMemberInfo* blankInfo; SkScriptValue value; SkScriptValue blankValue; SkOperand values[2]; SkOperand blankValues[2]; do { info = this->getMember(++index); if (NULL == info) { //SkDebugf("\n"); break; } if (SkType_MemberProperty == info->fType) { if (getProperty(propIndex, &value)) { blankCopy->getProperty(propIndex, &blankValue); //last two are dummies dumpValues(info, value.fType, value.fOperand, blankValue.fOperand, value.fOperand, blankValue.fOperand); } propIndex++; continue; } if (SkDisplayType::IsDisplayable(maker, info->fType)) { continue; } if (info->fType == SkType_MemberFunction) continue; if (info->fType == SkType_Array) { SkTDOperandArray* array = (SkTDOperandArray*) info->memberData(this); int arrayCount; if (array == NULL || (arrayCount = array->count()) == 0) continue; SkDisplayTypes elementType; if (type == SkType_Array) { SkDisplayArray* dispArray = (SkDisplayArray*) this; elementType = dispArray->values.getType(); } else elementType = info->arrayType(); bool firstElem = true; SkDebugf("%s=\"[", info->fName); for (SkOperand* op = array->begin(); op < array->end(); op++) { if (!firstElem) SkDebugf(","); switch (elementType) { case SkType_Displayable: SkDebugf("%s", op->fDisplayable->id); break; case SkType_Int: SkDebugf("%d", op->fS32); break; case SkType_Float: #ifdef SK_CAN_USE_FLOAT SkDebugf("%g", SkScalarToFloat(op->fScalar)); #else SkDebugf("%x", op->fScalar); #endif break; case SkType_String: case SkType_DynamicString: SkDebugf("%s", op->fString->c_str()); break; default: break; } firstElem = false; } SkDebugf("]\" "); continue; } if (info->fType == SkType_String || info->fType == SkType_DynamicString) { SkString* string; info->getString(this, &string); if (string->isEmpty() == false) SkDebugf("%s=\"%s\"\t", info->fName, string->c_str()); continue; } blankInfo = blankCopy->getMember(index); int i = info->fCount; info->getValue(this, values, i); blankInfo->getValue(blankCopy, blankValues, i); dumpValues(info, info->fType, values[0], blankValues[0], values[1], blankValues[1]); } while (true); delete blankCopy; }
static void cliDump(char *cmdline) { unsigned int i; char buf[17]; float thr, roll, pitch, yaw; uint32_t mask; uint8_t dumpMask = DUMP_ALL; if (strcasecmp(cmdline, "master") == 0) { dumpMask = DUMP_MASTER; // only } if (strcasecmp(cmdline, "profile") == 0) { dumpMask = DUMP_PROFILE; // only } if (dumpMask & DUMP_MASTER) { printf("\r\n# dump master\r\n"); printf("\r\n# mixer\r\n"); printf("mixer %s\r\n", mixerNames[masterConfig.mixerConfiguration - 1]); if (masterConfig.customMixer[0].throttle != 0.0f) { for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) { if (masterConfig.customMixer[i].throttle == 0.0f) break; thr = masterConfig.customMixer[i].throttle; roll = masterConfig.customMixer[i].roll; pitch = masterConfig.customMixer[i].pitch; yaw = masterConfig.customMixer[i].yaw; printf("cmix %d", i + 1); if (thr < 0) printf(" "); printf("%s", ftoa(thr, buf)); if (roll < 0) printf(" "); printf("%s", ftoa(roll, buf)); if (pitch < 0) printf(" "); printf("%s", ftoa(pitch, buf)); if (yaw < 0) printf(" "); printf("%s\r\n", ftoa(yaw, buf)); } printf("cmix %d 0 0 0 0\r\n", i + 1); } printf("\r\n\r\n# feature\r\n"); mask = featureMask(); for (i = 0; ; i++) { // disable all feature first if (featureNames[i] == NULL) break; printf("feature -%s\r\n", featureNames[i]); } for (i = 0; ; i++) { // reenable what we want. if (featureNames[i] == NULL) break; if (mask & (1 << i)) printf("feature %s\r\n", featureNames[i]); } printf("\r\n\r\n# map\r\n"); for (i = 0; i < rxRuntimeConfig.channelCount; i++) buf[i] = '-'; buf[i] = '\0'; for (i = 0; i < 12; i++) if (masterConfig.rxConfig.rcmap[i] != -1) buf[masterConfig.rxConfig.rcmap[i]] = rcChannelLetters[i]; printf("map %s\r\n", buf); printSectionBreak(); dumpValues(MASTER_VALUE); } if (dumpMask & DUMP_PROFILE) { printf("\r\n# dump profile\r\n"); printf("\r\n# aux\r\n"); cliAux(""); printSectionBreak(); dumpValues(PROFILE_VALUE); } }