/* numbering driver1 */ void do_numbering (int pred) { warning ("numbering..."); init_numbering (); if (!pred) number_alt (-1, start_alt); number_rules (rule_root); number_meta_rules (meta_root); allocate_rule_storage (); if (!pred) put_alt_in_row (start_alt); put_rules_in_row (rule_root); put_meta_rules_in_row (meta_root); hint ("found %d syntax rules, %d alternatives, %d members", nr_of_rules, nr_of_alts, nr_of_members); hint ("found %d meta rules, %d meta alternatives", nr_of_meta_rules, nr_of_meta_alts); };
static void detect_empty_producing_rules () { int nr_passes; int ix; hint ("detecting empty producing rules..."); nr_passes = 0; do { change = 0; for (ix = 0; ix < nr_of_rules; ix++) detect_if_rule_produces_empty (all_rules [ix]); nr_passes++; } while (change); hint ("needed %d pass%s for empty detection", nr_passes, (nr_passes == 1)?"":"es"); };
void emitStaticLocInit(HTS& env, int32_t locId, const StringData* name) { if (curFunc(env)->isPseudoMain()) PUNT(StaticLocInit); auto const ldPMExit = makePseudoMainExit(env); auto const value = popC(env); // Closures and generators from closures don't satisfy the "one static per // source location" rule that the inline fastpath requires auto const box = [&]{ if (curFunc(env)->isClosureBody()) { return gen(env, ClosureStaticLocInit, cns(env, name), fp(env), value); } auto const cachedBox = gen(env, LdStaticLocCached, StaticLocName { curFunc(env), name }); ifThen( env, [&] (Block* taken) { gen(env, CheckStaticLocInit, taken, cachedBox); }, [&] { hint(env, Block::Hint::Unlikely); gen(env, StaticLocInitCached, cachedBox, value); } ); return cachedBox; }(); gen(env, IncRef, box); auto const oldValue = ldLoc(env, locId, ldPMExit, DataTypeSpecific); stLocRaw(env, locId, fp(env), box); gen(env, DecRef, oldValue); // We don't need to decref value---it's a bytecode invariant that // our Cell was not ref-counted. }
/*! * \brief Set value of a string item. */ bool CNutConfDoc::SetValue(CConfigItem & item, const wxString & strValue) { if (item.m_option) { char *newval = strdup(strValue.mb_str()); /* Check if edited value changed. */ if (item.m_option->nco_value == NULL || strcmp(item.m_option->nco_value, newval)) { /* Remove any previously edited value. */ if (item.m_option->nco_value) { free(item.m_option->nco_value); item.m_option->nco_value = NULL; } /* Check if new value differs from configured value. */ char *cfgval = GetConfigValue(m_repository, item.m_option->nco_name); if ((cfgval == NULL && *newval) || (cfgval && strcmp(cfgval, newval))) { item.m_option->nco_value = newval; item.m_option->nco_active = 1; Modify(true); } else { free(newval); } if (cfgval) { free(cfgval); } CNutConfHint hint(&item, nutValueChanged); UpdateAllViews(NULL, &hint); } else { free(newval); } } return true; }
/* * Clone the `unit's CFG starting at `startBlock', and rename SSATmps * according to `tmpRenames' map along the way. The new block * corresponding to `startBlock' is returned. All blocks reachable * from `startBlock' are also cloned, so that there is no path from * the cloned blocks to the original blocks in the `unit'. Note that, * as instructions are cloned into the new blocks, the dest SSATmps of * these instructions also need to be renamed, so they're added to * `tmpRenames' along the way. */ Block* cloneCFG(IRUnit& unit, Block* startBlock, jit::flat_map<SSATmp*, SSATmp*> tmpRenames) { jit::queue<Block*> toClone; boost::dynamic_bitset<> toCloneSet(unit.numBlocks()); jit::hash_map<Block*, Block*> blockRenames; FTRACE(5, "cloneCFG: starting at B{}\n", startBlock->id()); auto push = [&](Block* b) { if (!b || toCloneSet[b->id()]) return; toClone.push(b); toCloneSet[b->id()] = true; }; // Clone each of the blocks. push(startBlock); while (!toClone.empty()) { auto origBlock = toClone.front(); toClone.pop(); auto copyBlock = unit.defBlock(origBlock->profCount(), origBlock->hint()); blockRenames[origBlock] = copyBlock; FTRACE(5, "cloneCFG: copying B{} to B{}\n", origBlock->id(), copyBlock->id()); // Clone each of the instructions in the block. for (auto& origInst : *origBlock) { auto copyInst = unit.clone(&origInst); // Remember the new SSATmps (the dests) which will need to be renamed. for (size_t d = 0; d < origInst.numDsts(); d++) { tmpRenames[origInst.dst(d)] = copyInst->dst(d); } // Rename all the source SSATmps that need renaming. for (size_t s = 0; s < origInst.numSrcs(); s++) { auto it = tmpRenames.find(copyInst->src(s)); if (it != tmpRenames.end()) { auto newSrc = it->second; copyInst->setSrc(s, newSrc); } } copyBlock->push_back(copyInst); } push(origBlock->next()); push(origBlock->taken()); } // Now go through all new blocks and reset their next/taken blocks // to their corresponding new blocks. for (auto& blockRename : blockRenames) { auto newBlock = blockRename.second; auto& lastInst = newBlock->back(); if (lastInst.next()) lastInst.setNext (blockRenames[lastInst.next()]); if (lastInst.taken()) lastInst.setTaken(blockRenames[lastInst.taken()]); } return blockRenames[startBlock]; }
QSize KisAbstractSliderSpinBox::sizeHint() const { const Q_D(KisAbstractSliderSpinBox); QStyleOptionSpinBox spinOpts = spinBoxOptions(); QFontMetrics fm(font()); //We need at least 50 pixels or things start to look bad int w = qMax(fm.width(QString::number(d->maximum)), 50); QSize hint(w, d->edit->sizeHint().height() + 3); //Getting the size of the buttons is a pain as the calcs require a rect //that is "big enough". We run the calc twice to get the "smallest" buttons //This code was inspired by QAbstractSpinBox QSize extra(35, 6); spinOpts.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &spinOpts, QStyle::SC_SpinBoxEditField, this).size(); spinOpts.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &spinOpts, QStyle::SC_SpinBoxEditField, this).size(); hint += extra; spinOpts.rect = rect(); return style()->sizeFromContents(QStyle::CT_SpinBox, &spinOpts, hint, 0) .expandedTo(QApplication::globalStrut()); }
QSize K3b::MsfEdit::sizeHint() const { if (d->cachedSizeHint.isEmpty()) { ensurePolished(); const QFontMetrics fm(fontMetrics()); int h = lineEdit()->sizeHint().height(); int w = fm.width( lineEdit()->inputMask() ); w += 2; // cursor blinking space QStyleOptionSpinBox opt; initStyleOption(&opt); QSize hint(w, h); QSize extra(35, 6); opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); // get closer to final result by repeating the calculation opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); hint += extra; opt.rect = rect(); d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) .expandedTo(QApplication::globalStrut()); } return d->cachedSizeHint; }
QSize MapView::sizeHint() const { QSize hint(galaxy->MaxX() - galaxy->MinX(), galaxy->MaxY() - galaxy->MinY()); hint *= 5; return hint; }
int goto_jn() { object me = this_player(); if (me->query_temp("marks/quest_jianqi_stage") == "to_jn") { message_vision("\n羽尘眼皮也不抬,懒洋洋地念道:“急急如律令……”\n", me); message_vision("你顿时感到一阵眩晕。再睁眼时……”\n\n", me); hint(me->query_temp("marks/hint"), "下一步:knock gate\n"); me->move("d/hangzhou/gushan1"); return 1; } else { message_vision("\n羽尘不耐烦地挥手道:“我现在要去睡个回笼觉,别来烦我!”\n", me); hint(me->query_temp("marks/hint"), "当任务剧情进行到需要去江南时,本功能才会开放。\n"); return 1; } }
QSize minimumSizeHint() const { if (cachedMinimumSizeHint.isEmpty()) { ensurePolished(); const QFontMetrics fm(fontMetrics()); int h = lineEdit()->minimumSizeHint().height(); int w = fm.width(BitcoinUnits::format(BitcoinUnits::FROST, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways)); w += 2; // cursor blinking space QStyleOptionSpinBox opt; initStyleOption(&opt); QSize hint(w, h); QSize extra(35, 6); opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); // get closer to final result by repeating the calculation opt.rect.setSize(hint + extra); extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, QStyle::SC_SpinBoxEditField, this).size(); hint += extra; hint.setHeight(h); opt.rect = rect(); cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this).expandedTo(QApplication::globalStrut()); } return cachedMinimumSizeHint; }
// ------------------------------------------------------------- void TRasterMapsDialog::mouseSelectPointEvent( const QMouseEvent* Event_, const QPoint Point_, const QPointF PointF_) { Q_UNUSED(Event_) QPointF NewPoint; TCoordinatesDialog Dialog(&NewPoint); if(Dialog.exec() == QDialog::Accepted) { m_MapAnchors.push_back(TRasterMapsMembers::TMapAnchor(Point_, PointF_, NewPoint)); w_ButtonOK->setEnabled(m_MapAnchors.size() > 1); viewLinkingPoints(); } // QMutexLocker Locker(&m_KeyControlMutex); if(m_Mode == Consts::LinkingMode && m_KeyControlPressed) { m_KeyControlPressed = false; w_MapWidget->restoreMouseMode(); popHint(); } // if(m_MapAnchors.size() == 3) { hint(QNetMapTranslator::tr("Confirm selected coordinates" /* Ru: Подтвердите введенные координаты */)); } }
size_t AdaptiveFreeList<Chunk>::get_better_size() { // A candidate chunk has been found. If it is already under // populated and there is a hinT, REturn the hint(). Else // return the size of this chunk. if (surplus() <= 0) { if (hint() != 0) { return hint(); } else { return size(); } } else { // This list has a surplus so use it. return size(); } }
enum ext_lang_rc gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang, struct type *type, LONGEST embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options, const struct language_defn *language) { struct gdbarch *gdbarch = get_type_arch (type); struct value *value; enum string_repr_result print_result; if (value_lazy (val)) value_fetch_lazy (val); /* No pretty-printer support for unavailable values. */ if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type))) return EXT_LANG_RC_NOP; if (!gdb_python_initialized) return EXT_LANG_RC_NOP; gdbpy_enter enter_py (gdbarch, language); /* Instantiate the printer. */ value = value_from_component (val, type, embedded_offset); gdbpy_ref<> val_obj (value_to_value_object (value)); if (val_obj == NULL) { print_stack_unless_memory_error (stream); return EXT_LANG_RC_ERROR; } /* Find the constructor. */ gdbpy_ref<> printer (find_pretty_printer (val_obj.get ())); if (printer == NULL) { print_stack_unless_memory_error (stream); return EXT_LANG_RC_ERROR; } if (printer == Py_None) return EXT_LANG_RC_NOP; /* If we are printing a map, we want some special formatting. */ gdb::unique_xmalloc_ptr<char> hint (gdbpy_get_display_hint (printer.get ())); /* Print the section */ print_result = print_string_repr (printer.get (), hint.get (), stream, recurse, options, language, gdbarch); if (print_result != string_repr_error) print_children (printer.get (), hint.get (), stream, recurse, options, language, print_result == string_repr_none); if (PyErr_Occurred ()) print_stack_unless_memory_error (stream); return EXT_LANG_RC_OK; }
void content () { glClear (GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); if (raycast) { DoRayTrace (); DisplayImage (); } else { draw3Dscene(); glPushAttrib(GL_ENABLE_BIT); drawLight(); if( track ) drawTrace(); hint(); glPopAttrib(); } // // FPS calculation and output /////////////////////////////////////////////////////////// FPScomputation += 1; glutSwapBuffers(); }
void do_element_numbering () { warning ("numbering elements..."); number_elements (element_root); allocate_element_storage (); put_elements_in_row (element_root); hint ("found %d elements", nr_of_elements); };
// Main routine. int main(void) { std::string title("GLXgears demo"); Framework::WindowHint hint(800,600,title); Application application; GearScene scene; application.start(hint, &scene); return 0; }
static void detect_empty_producing_meta_rules () { int nr_passes; int ix; hint ("detecting empty producing meta rules..."); nr_passes = 0; do { change = 0; for (ix = 0; ix < nr_of_meta_rules; ix++) detect_meta_rule_nullability (all_meta_rules[ix]); nr_passes++; } while (change); hint ("needed %d pass%s for empty detection of meta rules", nr_passes, (nr_passes == 1)?"":"es"); for (ix = 0; ix < nr_of_meta_rules; ix++) finish_meta_rule_nullability (all_meta_rules[ix]); };
void SkinnedHints::AddHint( Widget *hint_owner, int skin_no, int font_no, const Text &t) { Hint hint( skin_no, font_no, Rect::HALIGNCENTER|Rect::VALIGNCENTER, t); AddHint( hint_owner, hint); }
void parser_t::netdev_hint() { pstring dev(get_identifier()); require_token(m_tok_comma); pstring hint(get_identifier()); m_setup.register_param(dev + ".HINT_" + hint, 1); require_token(m_tok_param_right); }
void ScanController::hintAtModificationOfItem(qlonglong id) { ItemChangeHint hint(QList<qlonglong>() << id, ItemChangeHint::ItemModified); QMutexLocker lock(&d->mutex); d->garbageCollectHints(true); d->itemChangeHints << hint; }
void ScanController::hintAtModificationOfItems(const QList<qlonglong> ids) { ItemChangeHint hint(ids, ItemChangeHint::ItemModified); QMutexLocker lock(&d->mutex); d->garbageCollectHints(true); d->itemChangeHints << hint; }
void ScanController::hintAtMoveOrCopyOfItem(qlonglong id, const PAlbum* dstAlbum, QString itemName) { ItemCopyMoveHint hint(QList<qlonglong>() << id, dstAlbum->albumRootId(), dstAlbum->id(), QStringList() << itemName); QMutexLocker lock(&d->mutex); d->garbageCollectHints(true); d->itemHints << hint; }
void ScanController::hintAtMoveOrCopyOfItems(const QList<qlonglong> ids, const PAlbum* dstAlbum, QStringList itemNames) { ItemCopyMoveHint hint(ids, dstAlbum->albumRootId(), dstAlbum->id(), itemNames); QMutexLocker lock(&d->mutex); d->garbageCollectHints(true); d->itemHints << hint; }
void ctConfigTreeCtrl::OnSelChanged(wxTreeEvent& WXUNUSED(event)) { ctConfigToolDoc* doc = wxGetApp().GetMainFrame()->GetDocument(); if (doc) { ctConfigToolHint hint(NULL, ctSelChanged); doc->UpdateAllViews(NULL, & hint); } }
static void determine_user_predicates () { int nr_passes; int ix; for (ix = 0; ix < nr_of_rules; ix++) mark_if_rule_never_produces_empty (all_rules [ix]); hint ("detecting user defined predicates..."); nr_passes = 0; do { change = 0; for (ix = 0; ix < nr_of_rules; ix++) detect_if_rule_always_produces_empty (all_rules [ix]); nr_passes++; } while (change); hint ("needed %d pass%s for predicate detection", nr_passes, (nr_passes == 1)?"":"es"); for (ix = 0; ix < nr_of_rules; ix++) mark_if_rule_always_produces_empty (all_rules [ix]); };
void ecConfigTreeCtrl::OnSelChanged(wxTreeEvent& event) { ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc(); if (doc) { ecConfigToolHint hint(NULL, ecSelChanged); doc->UpdateAllViews(NULL, & hint); } }
template<> char stringToValue<char>(QString s_, QObject *concerning) { QString s = s_.trimmed(); if (s == missingValue<QString>()) return missingValue<char>(); if (s.size() != 1) { QString msg = "Cannot convert '" + s + "' to char" + hint(s); throw Exception(msg, concerning); } return s[0].toLatin1(); }
/** * Simple example. */ int main(void) { std::string title("A simple example"); Framework::WindowHint hint(800, 600, title); Application application; MyScene myScene; application.start(hint, &myScene); return 0; }
void TStatusLine::drawSelect( TStatusItem *selected ) { TDrawBuffer b; ushort color; char hintBuf[256]; ushort cNormal = getColor(0x0301); ushort cSelect = getColor(0x0604); ushort cNormDisabled = getColor(0x0202); ushort cSelDisabled = getColor(0x0505); b.moveChar( 0, ' ', cNormal, size.x ); TStatusItem *T = items; ushort i = 0; while( T != 0 ) { if( T->text != 0 ) { ushort l = cstrlen( T->text ); if( i + l < size.x ) { if( commandEnabled( T->command) ) if( T == selected ) color = cSelect; else color = cNormal; else if( T == selected ) color = cSelDisabled; else color = cNormDisabled; b.moveChar( i, ' ', color, 1 ); b.moveCStr( i+1, T->text, color ); b.moveChar( i+l+1, ' ', color, 1 ); } i += l+2; } T = T->next; } if( i < size.x - 2 ) { strcpy( hintBuf, hint( helpCtx ) ); if( *hintBuf != EOS ) { b.moveStr( i, hintSeparator, cNormal ); i += 2; if( strlen(hintBuf) + i > size.x ) hintBuf[size.x-i] = EOS; b.moveStr( i, hintBuf, cNormal ); i += strlen(hintBuf); } } writeLine( 0, 0, size.x, 1, b ); }
LRESULT C_SpinButton::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { C_STLException::install(); try { static String sValue(_T("The value of ")); static String sInc(_T("Decrements the value of ")); static String sDec(_T("Increments the value of ")); static String _plus(_T("+")); static String _minus(_T("-")); C_HotButton *buttons[] = { &m_btnDown, &m_btnUp }; for (int n = 0; n < 2; n++) { RECT r = { 0, 0, 26, 16 }; buttons[n]->Create( m_hWnd, r, _T(""), WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_NOTIFY, 0, IDC_BTN_INC ); } m_btnUp.Decorate(&m_mnuUp); m_btnDown.Decorate(&m_mnuDown); HWND wnd = GetDlgItem(IDC_EDIT); m_ed.SubclassWindow(wnd); //C_HotTTWindow::ChainSetToolTip(m_ed, sValue + m_sCaption); long l = m_ed.GetWindowLong(GWL_STYLE); m_ed.SetWindowLong(GWL_STYLE, l | WS_TABSTOP); m_ed.EnableWindow(TRUE); String hint(_T(" (Hint - right-click the up-and down-arrows for a menu of shortcuts.)")); C_HotTTWindow::ChainSetToolTip(m_btnDown, sInc + m_sCaption + hint); C_HotTTWindow::ChainSetToolTip(m_btnUp, sDec + m_sCaption + hint); m_bIsLoaded = TRUE; } catch (C_STLNonStackException const &exception) { exception.Log(_T("Exception in C_SpinButton::")); } return S_OK; }