int main() { int a,b,x; generate(&a); b=5; x=printValue(sum(&a,&b)); return printValue(x); }
// // Print out a points-to set. // static void printPointsToSet(raw_ostream &Stream, const PointsToSet &Set) { PointsToSet::iterator PTIt = Set.begin(), PTItEnd = Set.end(); Stream << "printing points to set...\n"; for (; PTIt != PTItEnd; ++PTIt) { PointsToNode *Node = PTIt->first; const Field &F = PTIt->second; Stream << " - "; switch (Node->Kind) { case PointsToNode::TYPE_SAFE: Stream << "("; printValue(Stream, Node->getAllocationSite()); Stream << ", "; F.print(Stream); Stream << ")"; break; case PointsToNode::TYPE_UNSAFE: Stream << "("; printValue(Stream, Node->getAllocationSite()); Stream << ", collapsed)"; case PointsToNode::EXTERNAL: Stream << "("; if (Node->getAllocationSite() == 0) Stream << "external"; else printValue(Stream, Node->getAllocationSite()); Stream << ", collapsed)"; break; } Stream << "\n"; } }
void ArxDbgEdInputContextReactor::printPointIn(const AcGePoint3d* pointIn) const { CString str; if (pointIn != NULL) printValue(_T("POINT IN"), ArxDbgUtils::ptToStr(*pointIn, str)); else printValue(_T("POINT IN"), _T("Null")); }
int main() { Foo my_foo(4.2); double my_double(1.0); printValue(my_foo); printValue(my_double); return 0; }
void ArxDbgEdInputContextReactor::printFirstCorner(const AcGePoint3d* pointIn) const { CString str; if (pointIn != NULL) printValue(_T("FIRST CORNER"), ArxDbgUtils::ptToStr(*pointIn, str)); else printValue(_T("FIRST CORNER"), _T("Null")); }
void ArxDbgEdInputContextReactor::printDefaultReal(const double* def) const { CString str; if (def != NULL) printValue(_T("DEFAULT"), ArxDbgUtils::doubleToStr(*def, str)); else printValue(_T("DEFAULT"), _T("Null")); }
void SensorWidget::paintSystemSensorData() { const SystemSensorData& data = sensorView.systemSensorData; print("System sensor data:", ""); print(" Cpu temperatur", printValue(ValueType::temperatur, data.cpuTemperature)); print(" Battery current", printValue(ValueType::current, data.batteryCurrent)); print(" Battery level", printValue(ValueType::ratio, data.batteryLevel)); print(" Battery temperatur", printValue(ValueType::ratio, data.batteryTemperature)); }
int main() { Foo my_foo(4.2); double my_double(1.0); printValue(my_foo); printValue(my_double); // Error: no implicit conversion return 0; }
void ArxDbgEdInputContextReactor::endDragSequence(Acad::PromptStatus returnStatus, AcGePoint3d& pickPoint, AcGeVector3d& vec) { printReactorMessage(_T("End Drag Sequence")); if (m_showDetails) { CString str; printReturnStatus(returnStatus); printValue(_T("PICK POINT"), ArxDbgUtils::ptToStr(pickPoint, str)); printValue(_T("VECTOR"), ArxDbgUtils::vectorToStr(vec, str)); } }
// // Print out a summary of the points-to sets of the graph. // void PointsToGraph::printGraph(raw_ostream &Stream) { const char *Break = "------------------------------\n"; Stream << "SCALAR MAP\n"; // // Write out the scalar map. // ScalarMapTy::iterator SMIt = ScalarMap.begin(), SMItEnd = ScalarMap.end(); for (; SMIt != SMItEnd; ++SMIt) { const Value *Pointer = SMIt->first; const PointsToSet &PTS = SMIt->second; Stream << Break; Stream << "Pointer: "; printValue(Stream, Pointer); Stream << "\n"; Stream << "Points-to set:\n"; printPointsToSet(Stream, PTS); } Stream << "POINTS-TO GRAPH\n"; // // Write out the nodes in the points-to graph. // NodeMapTy::iterator NMIt = GraphNodes.begin(), NMItEnd = GraphNodes.end(); for (; NMIt != NMItEnd; ++NMIt) { PointsToNode *Node = NMIt->second; Value *AllocSite = Node->getAllocationSite(); Stream << Break; Stream << "Allocation site: "; printValue(Stream, AllocSite); Stream << "\n"; EdgeMap &Edges = Node->getEdges(); EdgeMap::iterator EIt = Edges.begin(), EItEnd = Edges.end(); for (; EIt != EItEnd; ++EIt) { const Field &F = EIt->first; const PointsToSet &PTS = EIt->second; Stream << " At field "; F.print(Stream); Stream << ":\n"; printPointsToSet(Stream, PTS); } } }
void ArxDbgEdInputContextReactor::printPoints(const AcGePoint3dArray& pts) const { int len = pts.length(); if (len == 0) return; printValue(_T("POINTS"), _T("")); CString str; for (int i=0; i<len; i++) { printValue(_T(""), ArxDbgUtils::ptToStr(pts[i], str)); } }
void ArxDbgEdInputContextReactor::printResbufs(LPCTSTR label, const resbuf* rb) const { printValue(label, _T("")); CString dxfCodeStr, valueStr, tmpStr; const resbuf* tmp = rb; while (tmp) { dxfToStr(tmp, dxfCodeStr, valueStr); tmpStr.Format(_T("(%s . %s)"), dxfCodeStr, valueStr); printValue(_T(""), tmpStr); tmp = tmp->rbnext; } }
void SensorWidget::paintFsrSensorData() { const FsrSensorData& data = sensorView.fsrSensorData; print("Fsr sensor data:", ""); print(" Fsr lfl", printValue(ValueType::pressure, data.left[FsrSensorData::fl])); print(" Fsr lfr", printValue(ValueType::pressure, data.left[FsrSensorData::fr])); print(" Fsr lbl", printValue(ValueType::pressure, data.left[FsrSensorData::bl])); print(" Fsr lbr", printValue(ValueType::pressure, data.left[FsrSensorData::br])); print(" Fsr rfl", printValue(ValueType::pressure, data.right[FsrSensorData::fl])); print(" Fsr rfr", printValue(ValueType::pressure, data.right[FsrSensorData::fr])); print(" Fsr rbl", printValue(ValueType::pressure, data.right[FsrSensorData::bl])); print(" Fsr rbr", printValue(ValueType::pressure, data.right[FsrSensorData::br])); print(" Fsr total left", printValue(ValueType::pressure, data.leftTotal)); print(" Fsr total right", printValue(ValueType::pressure, data.rightTotal)); }
void ToolsAdiosParallel::convertToText() { if(m_options.data.size() == 0) throw std::runtime_error("No datasets requested"); for (size_t i = 0; i < m_options.data.size(); ++i) { ADIOS_VARINFO *pVarInfo; //get name of dataset to print std::string nodeName = m_options.data[i]; uint8_t *P; int varElement = 1; int varTypeSize = 0; adios_read_init_method(ADIOS_READ_METHOD_BP, comm, nodeName.c_str()); pVarInfo = adios_inq_var(pFile, nodeName.c_str()); varTypeSize = adios_type_size(pVarInfo->type, NULL); // get number of elements combined in a dataset for(int j = 0; j < pVarInfo->ndim; j++) { varElement = varElement * pVarInfo->dims[j]; } // allocate memory P = (uint8_t*) malloc (sizeof(uint8_t) * varTypeSize * varElement); adios_schedule_read(pFile, NULL, nodeName.c_str(), 0, 1, P); adios_perform_reads(pFile, 1); if(pVarInfo->ndim > 0) { for(int k = 0; k < varElement; k++) { printValue(pVarInfo->type, &P[k*varTypeSize]); } } else { printValue(pVarInfo->type, pVarInfo->value); } adios_free_varinfo(pVarInfo); } }
void ArxDbgEdInputContextReactor::endEntsel(Acad::PromptStatus returnStatus, AcDbObjectId& entPicked, AcGePoint3d& pickPoint, const char* pKeyword) { printReactorMessage(_T("End Entsel")); if (printDetails()) { CString str; printReturnStatus(returnStatus); printValue(_T("ENTITY PICKED"), ArxDbgUtils::objToClassAndHandleStr(entPicked, str)); printValue(_T("PICK POINT"), ArxDbgUtils::ptToStr(pickPoint, str)); printKeywordPicked(pKeyword); } }
void PhantomJSHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) { CEF_REQUIRE_UI_THREAD(); qCDebug(handler) << browser->GetIdentifier(); auto& browserInfo = m_browsers[browser->GetIdentifier()]; browserInfo.browser = browser; if (!m_popupToParentMapping.isEmpty()) { auto parentBrowser = m_popupToParentMapping.dequeue(); // we don't open about:blank for popups browserInfo.firstLoadFinished = true; emitSignal(m_browsers.value(parentBrowser).browser, QStringLiteral("onPopupCreated"), {browser->GetIdentifier()}, true); } #if CHROME_VERSION_BUILD >= 2526 if (PRINT_SETTINGS) { auto prefs = browser->GetHost()->GetRequestContext()->GetAllPreferences(true); CefDictionaryValue::KeyList keys; prefs->GetKeys(keys); for (const auto& key : keys) { printValue(key, prefs->GetValue(key)); } } #endif }
wxCustomSpinCtrl::wxCustomSpinCtrl( wxWindow* parent, wxWindowID id, float min, float max, float initial, float increment, int digits ) : wxPanel ( parent ), m_Parent ( parent ), m_ID ( id ), m_Value ( initial ), m_MaxValue ( max ), m_MinValue ( min ), m_Increment( increment ), m_Digits ( digits ) { m_TextControl = new wxTextCtrl( this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_SpinButton = new wxSpinButton( this, wxID_ANY ); m_SpinButton->SetRange( -100000, +100000 ); m_SpinButton->SetValue( 0 ); wxBoxSizer* topSizer = new wxBoxSizer( wxHORIZONTAL ); topSizer->Add( m_TextControl, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL ); topSizer->Add( m_SpinButton, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL ); SetSizerAndFit( topSizer ); printValue( m_Value ); }
static int printAttribute(D4printer* out, NCD4node* attr, int depth) { int ret = NC_NOERR; int i = 0; char* fqn = NULL; INDENT(depth); CAT("<Attribute"); printXMLAttributeName(out,"name",attr->name); if(attr->basetype->subsort <= NC_MAX_ATOMIC_TYPE) printXMLAttributeName(out,"type",attr->basetype->name); else { printXMLAttributeName(out,"type",(fqn = NCD4_makeFQN(attr->basetype))); } CAT(">\n"); depth++; for(i=0;i<nclistlength(attr->attr.values);i++) { printValue(out,(const char*)nclistget(attr->attr.values,i),depth); CAT("\n"); } depth--; INDENT(depth); CAT("</Attribute>"); nullfree(fqn); return THROW(ret); }
/* prints the elements in the same value */ void recursivePrintValue(FILE *f, NodeT *node, int level) { if (level < node->level) { return; } if (level == node->level) { printValue(f, node); fprintf(f, " "); if (node == printNull) { return; } } if (node->left->value == -1) { node->left->level = node->level+1; } recursivePrintValue(f, node->left, level); if (node->value == -1) { node->level--; } if (node->right->value == -1) { node->right->level = node->level+1; } recursivePrintValue(f, node->right, level); }
void PrintStatement::evaluate(SymTab &symTab, std::unique_ptr<FuncTab> &funcTab) { for (auto &l: _rhsList ) { printValue( l->evaluate(symTab, funcTab).get() ); std::cout << ' '; } std::cout << std::endl; }
SpinBoxDecimale::SpinBoxDecimale(int value, QWidget *parent): QAbstractSpinBox(parent) { setReadOnly(true); setAlignment(Qt::AlignRight); setValue(value); printValue(); }
void setRegistryValue(bool registryNum[8], bool value[8]) { try{ bool* output = new bool[8]; bool tmpCheck = 0; bool* low = new bool[8]; bool* high = new bool[8]; if ( Eightto1bit(tmpCheck, lessthan(output, registryNum, low))) throw 10; if ( Eightto1bit(tmpCheck, greaterthan(output, registryNum, high))) throw 10; value[0] = registry[to_int8(registryNum)][0]; value[1] = registry[to_int8(registryNum)][1]; value[2] = registry[to_int8(registryNum)][2]; value[3] = registry[to_int8(registryNum)][3]; value[4] = registry[to_int8(registryNum)][4]; value[5] = registry[to_int8(registryNum)][5]; value[6] = registry[to_int8(registryNum)][6]; value[7] = registry[to_int8(registryNum)][7]; } catch (int e) { std::cout<<"Reg("; printValueInDecimal(registryNum); std::cout<<") = "; printValue(registryNum); std::cout<<'\n'; } }
// Prints the tree to the screen in a readable fashion. It should look just like // Racket code; use parentheses to indicate subtrees. void printTree(Value *tree){ if (tree->type == NULL_TYPE) { return; } //if the current head of tree is a cons type, then go to its car else if (tree->type == CONS_TYPE) { //if the car is a cons type as well, enclose it in parentheses and recurse if (car(tree)->type == CONS_TYPE) { printf("("); printTree(car(tree)); printf(")"); //adds a space after the end of a subtree (for formatting reasons) if (cdr(tree)->type != NULL_TYPE){ printf(" "); } //recurse on the rest of the tree printTree(cdr(tree)); } //if the car is not a cons type, print the car and recurse on the rest of the tree else{ printTree(car(tree)); if (cdr(tree)->type != NULL_TYPE){ printf(" "); } printTree(cdr(tree)); } } //if the current head is not a cons type, print it else { printValue(tree); return; } }
void printTypeAndValue(llvm::raw_ostream &out, EValuePtr ev) { printName(out, ev->type.ptr()); out << "("; printValue(out, ev); out << ")"; }
SEXP getTable(const std::shared_ptr<cpptoml::table>& t, bool verbose=false) { Rcpp::StretchyList sl; for (auto & p : *t) { if (p.second->is_table()) { auto ga = std::dynamic_pointer_cast<cpptoml::table>(p.second); if (verbose) Rcpp::Rcout << "Table: " << p.first << std::endl; sl.push_front(Rcpp::Named(p.first) = getTable(ga, verbose)); } else if (p.second->is_array()) { auto ga = std::dynamic_pointer_cast<cpptoml::array>(p.second); if (verbose) { Rcpp::Rcout << "Array: " << p.first << std::endl; printArray(Rcpp::Rcout, *ga); } sl.push_front(Rcpp::Named(p.first) = getArray(*ga)); } else if (p.second->is_value()) { if (verbose) { Rcpp::Rcout << "Value: " << p.first << "\n :"; printValue(Rcpp::Rcout, p.second); Rcpp::Rcout << std::endl; } sl.push_front(Rcpp::Named(p.first) = getValue(p.second)); } else { Rcpp::Rcout << "Other: " << p.first << std::endl; sl.push_front(p.first); } } return Rcpp::as<Rcpp::List>(sl); }
// Render an array to text int aJsonClass::printArray(aJsonObject *item, FILE* stream) { if (item == NULL) { //nothing to do return 0; } aJsonObject *child = item->child; if (fputc('[', stream) == EOF) { return EOF; } while (child) { if (printValue(child, stream) == EOF) { return EOF; } child = child->next; if (child) { if (fputc(',', stream) == EOF) { return EOF; } } } if (fputc(']', stream) == EOF) { return EOF; } return 0; }
void createRandomTile(struct tile ** board, int size, int pos_rel, int multi) { time_t t; srand((unsigned) time(&t)); //randomize the col and row position int row = rand() % size; int col = rand() % size; int value = board[row][col].value; //check if the board is filled up bool filled = fillUpTile(board, size); //that position is blank if (value == 0) { board[row][col].value = random_2_4(); printTile(board[row][col], row, col, pos_rel); printValue(board, size, pos_rel); } else { //the random tile is not empty and the board has not been filled up while (value != 0 && filled == false) { row = rand() % size; col = rand() % size; //the random tile is not empty if (board[row][col].value != 0) { value = board[row][col].value; filled = fillUpTile(board, size); } else { //random between value 2 and 4 board[row][col].value = random_2_4(); printTile(board[row][col], row, col, pos_rel); printValue(board, size, pos_rel); filled = fillUpTile(board, size); break; } } } //check the board has possible moves bool move = canMove(board, size); //the board is filled up and there is no move left for 1 player only if (multi == 0) { if (filled == true && move == false) { //delete win mvprintw(25, 2, " "); //print game over mvprintw(15, 2, "Game over!!"); } } }
//Test LodePNG encoding and decoding the encoded result, using the C interface void doCodecTest(Image& image) { unsigned char* encoded = 0; size_t encoded_size = 0; unsigned char* decoded = 0; unsigned decoded_w; unsigned decoded_h; double t_enc0 = getTime(); unsigned error_enc = lodepng_encode_memory(&encoded, &encoded_size, &image.data[0], image.width, image.height, image.colorType, image.bitDepth); double t_enc1 = getTime(); assertEquals(0, error_enc, "encoder error C"); double t_dec0 = getTime(); for(int i = 0; i < NUM_DECODE; i++) { unsigned error_dec = lodepng_decode_memory(&decoded, &decoded_w, &decoded_h, encoded, encoded_size, image.colorType, image.bitDepth); assertEquals(0, error_dec, "decoder error C"); } double t_dec1 = getTime(); assertEquals(image.width, decoded_w); assertEquals(image.height, decoded_h); printValue("encoding time", t_enc1 - t_enc0, "s"); std::cout << "compression: " << ((double)(encoded_size) / (double)(image.data.size())) * 100 << "%" << " ratio: " << ((double)(image.data.size()) / (double)(encoded_size)) << " size: " << encoded_size << std::endl; total_enc_size += encoded_size; total_enc_time += (t_enc1 - t_enc0); if(NUM_DECODE> 0) printValue("decoding time", t_dec1 - t_dec0, "/", NUM_DECODE, " s"); total_dec_time += (t_dec1 - t_dec0); std::cout << std::endl; //LodePNG_saveFile(encoded, encoded_size, "test.png"); free(encoded); free(decoded); }
std::string OSArgument::print() const { std::stringstream ss; // name ss << name(); if (!displayName().empty()) { ss << " (" << displayName() << ")"; } ss << std::endl; // type and required ss << type().valueName() << ", "; if (required()) { ss << "Required"; } else { ss << "Optional"; } ss << std::endl; // value ss << "Value: "; if (hasValue()) { ss << printValue(false) << " "; } if (hasDefaultValue()) { ss << "(" << printDefaultValue() << ")"; } ss << std::endl; if (m_type.value() == OSArgumentType::Choice) { ss << "Choices:" << std::endl; int dnn = m_choiceDisplayNames.size(); for (int i = 0, n = m_choices.size(); i < n; ++i) { ss << " " << m_choices[i]; if ((i < dnn) && (!m_choiceDisplayNames[i].empty())) { ss << " (" << m_choiceDisplayNames[i] << ")"; } ss << std::endl; } } if (hasDomain()) { ss << m_domainType.valueName() << " Domain: "; if (m_domainType == OSDomainType::Interval) { OS_ASSERT(m_domain.size() == 2u); ss << "[" << printQVariant(m_domain[0]) << ", " << printQVariant(m_domain[1]) << "]" << std::endl; } else { ss << std::endl; for (const QVariant& value : m_domain) { ss << " " << printQVariant(value) << std::endl; } } } return ss.str(); }
int loadFromFile(FILE *file, Environment *env) { List *tokens, *parseTree, *leftoverTokens = NULL; leftoverTokens = initializeList(); int depth = 0; char *expression = (char *)malloc(256 * sizeof(char)); Value* temp; while (fgets(expression, 256, file)) { tokens = append(leftoverTokens, tokenize(expression)); if (!tokens) { leftoverTokens->head = NULL; continue; } parseTree = parse(tokens,&depth); if (depth < 0) { printf("syntax error. Too many close parentheses.\n"); // Too many close parentheses. cleanup(tokens->head); //free(parseTree); free(leftoverTokens); free(tokens); return SYNTAX_ERROR_TOO_MANY_CLOSE_PARENS; } else if (depth > 0) { // There are more open parens than close parens, so these tokens are saved as leftovers. We partially generate a parse tree now. leftoverTokens->head = tokens->head; } else { if (parseTree && parseTree->head){ //printf("going to print parse tree: "); //printValue(parseTree->head); //printf("\n"); //printf("going to print parse tree again: "); //printValue(deepCopyList(parseTree->head)); //printf("\n"); temp = eval(parseTree->head,env); if (temp){ printValue(temp); printf("\n"); } //leftoverTokens->head = tokens->head; free(parseTree); // cleanup(leftoverTokens->head); } } } if (leftoverTokens->head) { printf("syntax error. Too few close parentheses\n"); // Too few close parens at end of input. destroy(leftoverTokens); free(tokens); return SYNTAX_ERROR_UNTERMINATED_INPUT; } // clean up memory destroy(leftoverTokens); free(tokens); free(expression); }