void Context::postInit() { assert(!m_Limits); // Must only be called once! glewExperimental = GL_TRUE; //GL_FALSE; GLenum e = glewInit(); if(e != GLEW_OK) { LogWarning("GLEW Error: %s", glewGetErrorString(e)); } m_Limits = new Limits(this); Log( "Using OpenGL %s\n" "Vendor: %s\n" "Renderer: %s\n" "GLSL: %s\n" "GLEW: %s\n", glGetString(GL_VERSION), glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_SHADING_LANGUAGE_VERSION), glewGetString(GLEW_VERSION) ); enableDebug(true); m_Textures = new StrongRef<Texture>[limits().maxCombinedTextureUnits]; m_Samplers = new StrongRef<Sampler>[limits().maxCombinedTextureUnits]; m_Attributes = new VertexAttribute[limits().maxVertexAttributes]; selectTextureUnit(0); // Cause -1 is illogical and introduces errors with some functions }
void SkJointEuler::type ( Type t ) { if ( _type == (char)t ) return; _type = (char)t; if ( _type==(char)TypeZY ) { value ( X, 0 ); limits ( X, true ); limits ( X, 0, 0 ); // will freeze X axis } SkJointQuat::ask_new(); }
/*! \reimp */ void QModemPhoneBook::requestLimits( const QString& store ) { QModemPhoneBookCache *cache; // Find the cache entry associated with this store. cache = findCache( store ); // If the cache is fully loaded, then emit the result now. // If there is a password, then force a re-get of the phone book // because the new password may not be the same as the original. if ( cache->fullyLoaded && cache->passwd.isEmpty() ) { emit limits( store, cache->limits ); return; } // We need to requery the extents if the phone book was previously loaded. if ( cache->fullyLoaded ) { cache->fullyLoaded = false; cache->entries.clear(); cache->limits = QPhoneBookLimits(); sendQuery( cache ); } // We'll need a signal to be emitted once it is fully loaded. cache->needLimitEmit = true; }
MgShape* MgCmdErase::hitTest(const MgMotion* sender) { Box2d limits(sender->startPointM, mgDisplayMmToModel(6, sender), 0); Point2d nearpt; return sender->view->shapes()->hitTest(limits, nearpt); }
float MgComposite::_hitTest(const Point2d& pt, float tol, MgHitResult& res) const { void* it; MgHitResult tmpRes; Box2d limits(pt, 2 * tol, 0); res.segment = 0; res.dist = _FLT_MAX; for (MgShape* sp = _shapes->getFirstShape(it); sp; sp = _shapes->getNextShape(it)) { if (limits.isIntersect(sp->shapec()->getExtent())) { float d = sp->shapec()->hitTest(pt, tol, tmpRes); if (res.dist > d - _MGZERO) { res = tmpRes; res.dist = d; res.segment = sp->getID(); } } } _shapes->freeIterator(it); return res.segment != 0; }
void TextArea::display( const Rectangle& extents ) { Rectangle limits( extents.geta() + border.geta(), extents.geta() + border.getb() ); limits.setintersect( extents ); gui->set_format_limits( limits ); Point cursor = limits.geta(); String next_line = text; do { gui->set_current_cursor_location( cursor ); next_line = gui->writef( next_line, color ); cursor.increase_y(); } while (next_line.formatlen() && limits.contains(cursor) ) ; gui->reset_format_limits(); }
void Context::bindTexture( int unit, const StrongRef<Texture>& texture ) { assert(InsideArray(unit, limits().maxCombinedTextureUnits)); if(m_Textures[unit] == texture) return; selectTextureUnit(unit); if(!texture) { glBindTexture(ConvertToGL(m_Textures[unit]->type()), 0); glDisable(ConvertToGL(m_Textures[unit]->type())); m_Textures[unit] = NULL; } else { if(!m_Textures[unit] || (m_Textures[unit]->type() != texture->type())) { if(m_Textures[unit]) { glDisable(ConvertToGL(m_Textures[unit]->type())); } glEnable(ConvertToGL(texture->type())); } glBindTexture(ConvertToGL(texture->type()), texture->handle()); m_Textures[unit] = texture; } }
/* Up_Down_Arrow() * ==================================================================== * Handle the up and down arrow presses in the outline font dialog * for the cache settings. */ void Up_Down_Arrow( int obj, int UpButton, char *text, long *num, int NBase ) { MRETS mk; long min_cache; XSelect( tree, obj ); *num = atol( text ); min_cache = (( UpButton == BUP ) ? ( 0L ) : ( MIN_CACHE_SIZE ) ); if( UpButton == CUP ) min_cache = MIN_CHAR_CACHE_SIZE; *num = limits( *num, min_cache, MAX_CACHE_SIZE ); do { Evnt_timer( 50L ); if( obj == UpButton ) *num = (((*num + 1) > MAX_CACHE_SIZE ) ? ( MAX_CACHE_SIZE ) : ( *num + 1 ) ); else *num = (((*num - 1) < min_cache ) ? ( min_cache ) : ( *num - 1 ) ); sprintf( text, "%5ld", *num ); Objc_draw( tree, NBase, MAX_DEPTH, NULL ); Graf_mkstate( &mk ); } while( mk.buttons ); XDeselect( tree, obj ); }
int main(int argc, char* argv[]) { int gridRes = 5; int increment = 1; if (argc != 3) { printf("Usage: ./CNmoonmarsCountPoints gridRes increment\n"); return EXIT_FAILURE; } gridRes = atoi(argv[1]); increment = atoi(argv[2]); printf("===============================================================\n"); std::string inputFile = "data/input-observedhotspots.txt"; printf("Point count is based on observed hotspots in file:\n"); printf("%s\n\n", inputFile.c_str()); ObservedHotspots observedHotspots(inputFile); //observedHotspots.Iterate(PrintCoord, NULL); //printf("\n"); AbcdSpaceLimits limits(observedHotspots); limits.PrintToFile(stdout); printf("\n"); long int count = AbcdSpaceProbabilityDistribution::CalculateNumberOfAbcdPoints(limits, gridRes, increment); printf("Point count with gridRes = %d, increment = %d: %ld\n", gridRes, increment, count); return EXIT_SUCCESS; }
float MgComposite::_hitTest(const Point2d& pt, float tol, Point2d& nearpt, int& segment, bool& inside) const { void* it; float mindist = 1e10f; Point2d tmpNear; int tmpseg; bool tmpIn; Box2d limits(pt, 2 * tol, 0); segment = 0; for (MgShape* sp = _shapes->getFirstShape(it); sp; sp = _shapes->getNextShape(it)) { if (limits.isIntersect(sp->shapec()->getExtent())) { float d = sp->shapec()->hitTest(pt, tol, tmpNear, tmpseg, tmpIn); if (mindist > d - _MGZERO) { mindist = d; nearpt = tmpNear; segment = sp->getID(); inside = tmpIn; } } } _shapes->freeIterator(it); return mindist; }
void PstnPhoneBook::requestLimits( const QString& store ) { QPhoneBookLimits l; l.setNumberLength( 20 ); l.setTextLength( 18 ); l.setFirstIndex( 1 ); l.setLastIndex( 150 ); emit limits( store, l ); }
int main() { scanf("%d",&n); int i,j; for(i=0;i<n;i++) scanf("%d",&a[i]); scanf("%d %d",&p,&q); ans = p; limits(p); limits(q); for(i=0;i<n;++i) { for(j=i+1;j<n;++j) limits( (a[i]+a[j])/2 ); } printf("%d\n",ans); return 0; }
void OFonoPhoneBook::emitLimits(const QString & store) { QPhoneBookLimits l; l.setUsed(numUsed); l.setFirstIndex(1); l.setLastIndex(numUsed); l.setNumberLength(1); l.setTextLength(1); emit limits(store, l); }
void operator()(iterator_t begin, iterator_t end, point_t& obb_center, matrix_type& obb_orientation, point_t& obb_low, point_t& obb_high) { obb_center = mean(begin, end); obb_orientation = orientation(begin, end, obb_center); limits(begin, end, obb_center, obb_orientation, obb_low, obb_high); }
void HatchingBrush::hatch(KisPaintDeviceSP dev, qreal x, qreal y, double width, double height, double givenangle, const KoColor &color) { m_painter.begin(dev); m_painter.setFillStyle(KisPainter::FillStyleForegroundColor); m_painter.setPaintColor(color); m_painter.setBackgroundColor(color); angle = givenangle; double tempthickness = m_settings->thickness * m_settings->thicknesssensorvalue; if (tempthickness >= 1) thickness = qRound(tempthickness); else thickness = 1; if (m_settings->enabledcurveseparation) separation = separationAsFunctionOfParameter(m_settings->separationsensorvalue, m_settings->separation, m_settings->separationintervals); height_ = height; width_ = width; m_painter.setMaskImageSize(width_, height_); QRect limits(QPoint(0,0), QPoint(width_, height_)); m_painter.setBounds(limits); /* dx and dy are the separation between lines in the x and y axis dx = separation / sin(angle*M_PI/180); csc = 1/sin(angle) */ dy = fabs(separation / cos(angle*M_PI/180)); // sec = 1/cos(angle) // I took the absolute value to avoid confusions with negative numbers if (!m_settings->subpixelprecision) modf(dy, &dy); // Exception for vertical lines, for which a tangent does not exist if ((angle == 90) || (angle == -90)) { verticalHotX = fmod((origin_x - x), separation); iterateVerticalLines (true, 1, false); // Forward iterateVerticalLines (true, 0, true); // In Between both iterateVerticalLines (false, 1, false); // Backward } else { // Turn Angle + Point into Slope + Intercept slope = tan(angle*M_PI/180); // Angle into slope baseLineIntercept = origin_y - slope*origin_x; // Slope and Point of the Base Line into Intercept cursorLineIntercept = y - slope*x; hotIntercept = fmod((baseLineIntercept - cursorLineIntercept), dy); // This hotIntercept belongs to a line that intersects with the hatching area iterateLines (true, 1, false); // Forward iterateLines (true, 0, true); // In Between both iterateLines (false, 1, false); // Backward // I tried to make this cleaner but there's too many possibilities to be // worth the micromanagement to optimize } }
bool MgCommandDraw::_click(const MgMotion* sender) { Box2d limits(sender->pointM, mgDisplayMmToModel(10, sender), 0); Point2d nearpt; MgShape* shape = sender->view->shapes()->hitTest(limits, nearpt); if (shape) { g_newShapeID = shape->getID(); mgGetCommandManager()->setCommand(sender, "select"); } return shape || longPress(sender); }
/* DoValuesCheck() * ==================================================================== */ void DoValuesCheck( void ) { long half; int extra; /* Speedo Character Stuff */ ccache = atol( CharSizeText ); if( !ccache ) ccache = old_ccache; ccache = limits( ccache, MIN_CHAR_CACHE_SIZE, MAX_CACHE_SIZE ); /* Speedo Miscellaneous Stuff */ mcache = atol( MiscSizeText ); if( !mcache ) mcache = old_mcache; mcache = limits( mcache, MIN_CACHE_SIZE, MAX_CACHE_SIZE ); /* Get Speedo Cache Size */ Current.SpeedoCacheSize = ccache + mcache; /* Get Percent Value */ Current.speedo_percent = 0; half = Current.SpeedoCacheSize / 2L; extra = ((( ccache * 10L ) % Current.SpeedoCacheSize) > half ); CurPercent = (int)(( ccache * 10L ) / Current.SpeedoCacheSize); Current.speedo_percent = CurPercent + extra; Current.speedo_percent = (int)limits( (int)Current.speedo_percent, 1L, 9L ); /* Get BitMap Cache Size */ Current.BitMapCacheSize = atol( BitSizeText ); Current.BitMapCacheSize = limits( Current.BitMapCacheSize, 0L, MAX_CACHE_SIZE ); /* A Real Change has occurred, so set change flag */ if( ( Current.SpeedoCacheSize != OldSpeedoCache ) || ( Current.speedo_percent != OldPercent ) || ( Current.BitMapCacheSize != OldBitMapSize ) ) SetChangeFlag(); }
/*! Constructs a new QContactSimSyncer as a child of the given \a parent for SIM storage of the given \a type. */ QContactSimSyncer::QContactSimSyncer(const QString &type, QObject *parent) : QObject(parent), readState(Idle), mError(NoError), mSimType(type), SIMLabelLimit(20), SIMNumberLimit(60), SIMListStart(1), SIMListEnd(200), addNameQuery("INSERT INTO contacts (recid, firstname, context) VALUES (:i, :fn, :c)"), addNumberQuery("INSERT INTO contactphonenumbers (recid, phone_type, phone_number) VALUES (:i, 1, :pn)"), updateNameQuery("UPDATE contacts SET firstname = :fn WHERE recid = :i"), updateNumberQuery("UPDATE contactphonenumbers SET phone_number = :pn WHERE recid = :i AND phone_type = 1"), removeNameQuery("DELETE FROM contacts WHERE recid = :i"), removeNumberQuery("DELETE FROM contactphonenumbers WHERE recid = :i"), selectNameQuery("SELECT firstname FROM contacts WHERE recid = :i"), selectNumberQuery("SELECT phone_number from contactphonenumbers where recid=:id and phone_type=1"), mPhoneBook(0), mSimInfo(0), simValueSpace(0), mReadyTimer(0) { static QUuid u("b63abe6f-36bd-4bb8-9c27-ece5436a5130"); // construct source for contact data. mSource.context = u; if (type == "SM") mSource.identity = "sim"; else mSource.identity = type; mAccess = new ContactSqlIO(this); mPhoneBook = new QPhoneBook( QString(), this ); mSimInfo = new QSimInfo( QString(), this ); connect(mPhoneBook, SIGNAL(entries(QString,QList<QPhoneBookEntry>)), this, SLOT(updatePhoneBook(QString,QList<QPhoneBookEntry>))); connect(mPhoneBook, SIGNAL(limits(QString,QPhoneBookLimits)), this, SLOT(updatePhoneBookLimits(QString,QPhoneBookLimits))); connect(mSimInfo, SIGNAL(inserted()), this, SLOT(updateSimIdentity())); connect(mSimInfo, SIGNAL(removed()), this, SLOT(updateSimIdentity())); readState = ReadingId | ReadingLimits | ReadingEntries; resetSqlState(); if (mPhoneBook->storages().contains(mSimType)) sync(); else { qLog(SimPhoneBook) << mSimType << "start timeout timer and connect to phonebook ready"; connect(mPhoneBook, SIGNAL(ready()), this, SLOT(sync())); mReadyTimer = new QTimer(this); mReadyTimer->setSingleShot(true); mReadyTimer->setInterval(30000); // 30 seconds connect(mReadyTimer, SIGNAL(timeout()), this, SLOT(simInfoTimeout())); mReadyTimer->start(); } }
matrix_type orientation(iterator_t point_begin, iterator_t point_end, point_t& center) const { matrix<value_type, N, N> orientation; value_type tightest_volume = boost::numeric::bounds<value_type>::highest(); for (int k = 0; k != _iterations; ++k) { matrix<value_type, N, N> random; point_t dir1 = generate_random_point(); point_t dir2 = generate_random_point(); point_t dir3 = generate_random_point(); // use ortho-normal system dir1 /= dir1.length(); dir2 /= dir2.length(); dir3 /= dir3.length(); // normalize dir3 = cross(dir1, dir2); dir2 = cross(dir1, dir3); random[0][0] = dir1[0]; random[1][0] = dir1[1]; random[2][0] = dir1[2]; random[0][1] = dir2[0]; random[1][1] = dir2[1]; random[2][1] = dir2[2]; random[0][2] = dir3[0]; random[1][2] = dir3[1]; random[2][2] = dir3[2]; // compute volume according to temporary orientation point_t low, high; limits(point_begin, point_end, center, random, low, high); oriented_boundingbox<point_t> obb(random, center, low, high); value_type volume = obb.volume(); // if tighter, apply if (volume < tightest_volume) { orientation = random; tightest_volume = volume; } } return orientation; }
bool MgCommandDraw::_click(const MgMotion* sender) { Box2d limits(sender->pointM, sender->displayMmToModel(10.f), 0); MgHitResult res; MgShape* shape = sender->view->shapes()->hitTest(limits, res); if (shape) { sender->view->setNewShapeID(shape->getID()); sender->toSelectCommand(); LOGD("Command (%s) cancelled after the shape #%d clicked.", getName(), shape->getID()); } return shape || (sender->view->useFinger() && longPress(sender)); }
const char* ocr_semantic_match(filtro_gestos_in_imagen_t* dibujo, pack_init_t* packInit) { char *devolver = 0; int size,i; char buffer[128]; char* text; size=0; if(dibujo && packInit){ fields_t* fields= limits(dibujo); constellation_t* constelacion= makeConstellation(fields,dibujo); for(i=0; i<constelacion->m_top; i++){ buffer[size]= match_constallation(packInit->dataBase,constelacion->m_list[i]); if(i<constelacion->m_top-1 && fields->espacios[i]){size++; buffer[size]=' ';} size++; } buffer[size]='\0'; freeFields(fields); text= /*strdup(*/buffer/*)*/; if(strcmp(text,"")){ char total[128]=""; int cont,k,a,i; char word[128]=""; cont=k=a=0; for(i=0; i<=size; i++){ if(text[i]==' '){ word[cont]='\0'; strcat(total,strcat(MatchDicc(word,cont,k,packInit,constelacion)," ")); word[0]='\0'; k=a; cont=0;} else if(i==size){ word[cont]='\0'; strcat(total,strcat(MatchDicc(word,cont,k,packInit,constelacion)," ")); } else {word[cont]=text[i]; a++; cont++;} } //free(dibujo->m_imagen); //free(dibujo); //freeConstellation(constelacion); //return strdup(total); devolver = strdup(total); } /*free(dibujo->m_imagen); free(dibujo);*/ freeConstellation(constelacion); } /* free(dibujo->m_imagen); free(dibujo); freeConstellation(constelacion);*/ return devolver; }
void tGauge::ChangeDataType( const tDataId& dataId ) { m_SaveLimits = false; if( dataId == DATA_TYPE_INVALID ) { return; } //clear existing indicators m_Indicators.clear(); m_Indicators << tIndicator( dataId ); //set captions and limits tDigitalData pData( dataId ); AbsoluteLimits = pData.AbsoluteLimitsConverted(); tFloatLimits limits( pData.MinConverted(), pData.MaxConverted() ); tFloatLimits warnings( pData.WarningLowConverted(), pData.WarningHighConverted() ); m_UnitsType = pData.Units(); m_UnitsValue = tUnitsSettings::Instance()->Units( m_UnitsType ); //set update timer and update immediately UpdateValues(); //autoconfigure if applicable if( CanAutoConfigure() && AutoConfigure() ) { DoAutoConfigure(); } SetLimits( limits, warnings ); SetCaptions(); //does any type specific config ReconfigureGauge(); m_BackIsCached = false; m_ForeIsCached = false; update(); m_Modified = true; if( m_UnitsType != UNITS_ECONOMY ) { // m_SaveLimits = true; } }
InterpolatorVec ReadInterpolatedLimits(const std::string& input_dir_name, Range& mass_range, Units units) { const auto& file_names = GetOrderedFileList(input_dir_name, ".*\\.root"); std::vector<std::vector<double>> limits(all_limit_quantiles.size()); std::set<double> masses; const double units_factor = GetUnitsFactor(units); if(!file_names.size()) throw exception("No input files are found."); for(const auto& file_entry : file_names) { const std::string& file_name = file_entry.second; const double mass = file_entry.first; std::cout << "Reading " << file_name << std::endl; if(masses.count(mass)) throw exception("More than one file with for the mass point = %1%") % mass; masses.insert(mass); std::shared_ptr<TFile> file(new TFile(file_name.c_str(), "READ")); std::shared_ptr<TTree> tree(dynamic_cast<TTree*>(file->Get("limit"))); double limit; float quantileExpected; tree->SetBranchAddress("limit", &limit); tree->SetBranchAddress("quantileExpected", &quantileExpected); for(Long64_t n = 0; n < tree->GetEntries(); ++n) { tree->GetEntry(n); const size_t quantile_id = GetQuantileId(quantileExpected); limits.at(quantile_id).push_back(limit * units_factor); } } const std::vector<double> mass_vec(masses.begin(), masses.end()); mass_range = Range(mass_vec.front(), mass_vec.back()); InterpolatorVec interps; for(size_t n = 0; n < limits.size(); ++n) { if(limits[n].size() != masses.size()) throw exception("Inconsistent input limits."); InterpolatorPtr interp(new ROOT::Math::Interpolator(mass_vec, limits[n], ROOT::Math::Interpolation::kCSPLINE)); interps.push_back(interp); } return interps; }
int non_pipe_process(char ***cmd_mat) { int retval; if ((retval = execute_non_forking(*cmd_mat)) == 2) { long int sec1,uSec1; //set up time variables etimeStart(&sec1,&uSec1); //start time pid_t pid = fork_check(); if (pid == 0) { // child char **new_subcmd = process_redirection(*cmd_mat); execute_forking(new_subcmd); } else { // parent int status; if (strcmp(process_redirection(*cmd_mat)[0], "limits") == 0) { limits(pid); } else if (strcmp(process_redirection(*cmd_mat)[0], "etime") == 0) { etimeFinish(pid,sec1,uSec1); } else waitpid(pid, &status, 0); retval = 1; } } return retval; }
void Solution::print(const std::string& output_path) { Limits limit; Dimension latitude(latitudeLeft, latitudeRight, 0); Dimension longitude(longitudeLeft, longitudeRight, 0); latitude.to_radian(); longitude.to_radian(); const unsigned density = 100; for (auto i = static_cast<unsigned>(timeLeft); i < timeRight + 1; ++i) { auto path = fmt::format("{}{}{:02}{}", output_path, "time_", i, ".txt"); std::ofstream out(path); for (unsigned x = 0; x <= density; ++x) { for (unsigned y = 0; y <= density; ++y) { const float phi = latitude.left + (latitude.right - latitude.left) / density * x; const float theta = longitude.left + (longitude.right - longitude.left) / density * y; const float time = i * 3600; float sum = 0; for (const auto &item : grids) { sum += item(phi, theta, time); } limit.update(sum); fmt::print(out, "{:.2f}{}", sum, (y != density) ? ' ' : '\n'); } } out.close(); } latitude.to_degrees(); longitude.to_degrees(); std::ofstream limits(output_path + "limits.txt"); fmt::print(limits, "{}\n{}\n{}", latitude, longitude, limit); limits.close(); }
vector<vector<int> > combinationSum2(vector<int> &candidates, int target) { candidates = filteCandidates(candidates, target); vector<vector<int> > result; int n = candidates.size(); if (n == 0) return result; std::sort(candidates.begin(), candidates.end(), std::less<int>()); vector<int> limits(n, 0); int m = 1; for (int i = 0; i < n; i++) { if (candidates[i] == candidates[m - 1]) limits[m - 1]++; else { candidates[m] = candidates[i]; limits[m++] = 1; } } candidates.resize(m); vector<int> count(n, 0); dfs(result, candidates, limits, target, 0, count); return result; }
void FsoPhoneBook::requestLimits(const QString & store) { qDebug() << "FsoPhoneBook::requestLimits store=" << store; if (!simReady) { wantLimits = true; return; } QFsoDBusPendingReply < int, int, int >reply = service->gsmSim.GetPhonebookInfo("contacts"); if (!checkReply(reply)) { return; } QPhoneBookLimits l; l.setUsed(numUsed); l.setFirstIndex(1); l.setLastIndex(reply.argumentAt(0).toInt()); l.setNumberLength(reply.argumentAt(1).toInt()); l.setTextLength(reply.argumentAt(2).toInt()); emit limits(store, l); }
float MgComposite::_hitTest(const Point2d& pt, float tol, MgHitResult& res) const { MgShapeIterator it(_shapes); MgHitResult tmpRes; Box2d limits(pt, 2 * tol, 0); res.segment = 0; res.dist = _FLT_MAX; while (MgShape* sp = it.getNext()) { if (limits.isIntersect(sp->shapec()->getExtent())) { float d = sp->shapec()->hitTest(pt, tol, tmpRes); if (res.dist > d - _MGZERO) { res = tmpRes; res.dist = d; res.segment = sp->getID(); } } } return res.segment != 0; }
/* DoCache() * =================================================================== */ void DoCache( void ) { long extra; long interim; Reset_Tree( ad_cache ); /* ------------------------------------------------------ * Handle the Cache I/O Boxes and the Unused Cache... * ------------------------------------------------------ */ Enable( LCACHE ); Enable( MCACHE ); Enable( SCACHE ); Enable( CCACHE ); MakeExit( LCACHE ); MakeExit( MCACHE ); MakeExit( SCACHE ); MakeExit( CCACHE ); Enable( CUTITLE ); Enable( CUNUSED ); Enable( MUTITLE ); Enable( MUNUSED ); dcache_size = bcache_size = 0L; sprintf( data_cache_text, "%5ldK", dcache_size ); TedText( MUNUSED ) = data_cache_text; /* Character Cache */ sprintf( bitmap_cache_text, "%5ldK", bcache_size ); TedText( CUNUSED ) = bitmap_cache_text; if( !SpeedoFlag ) { Disable( LCACHE ); Disable( MCACHE ); Disable( SCACHE ); Disable( CCACHE ); NoExit( LCACHE ); NoExit( MCACHE ); NoExit( SCACHE ); NoExit( CCACHE ); Disable( CUTITLE ); Disable( CUNUSED ); Disable( MUTITLE ); Disable( MUNUSED ); } else Calc_Cache( FALSE ); /* ------------------------------------------------------ * Handle the Cache Sizes... * ------------------------------------------------------ */ OldPercent = CurPercent = Current.speedo_percent; OldSpeedoCache = Current.SpeedoCacheSize; /* Set the Speedo Character Cache */ interim = Current.speedo_percent * Current.SpeedoCacheSize; extra = ( interim % 10L ) > 5L; ccache = ( interim / 10L ) + extra; ccache = limits( ccache, MIN_CHAR_CACHE_SIZE, MAX_CACHE_SIZE ); old_ccache = ccache; sprintf( CharSizeText,"%5ld", ccache ); TedText( CSIZE ) = CharSizeText; /* Display a size based on a percentage of the Misc CACHE Size */ interim = (10L - (long)Current.speedo_percent ) * Current.SpeedoCacheSize; extra = ( interim % 10L ) > 5L; mcache = ( interim / 10L ) + extra; mcache = limits( mcache, MIN_CACHE_SIZE, MAX_CACHE_SIZE ); old_mcache = mcache; sprintf( MiscSizeText, "%5ld", mcache ); TedText( MSIZE ) = MiscSizeText; /* Set the Bitmap Font Cache */ Current.BitMapCacheSize = limits( Current.BitMapCacheSize, 0L, MAX_CACHE_SIZE ); OldBitMapSize = Current.BitMapCacheSize; sprintf( BitSizeText,"%5ld", Current.BitMapCacheSize ); TedText( BSIZE ) = BitSizeText; /* Handle Getting the Current Minimum Amount of Miscellanous Required */ CurUsage = GetCurUsage(); sprintf( CurSizeText, "%5ldK", CurUsage ); TedText( CACHEMIN ) = CurSizeText; Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); }
float max(const FloatVector *v) { return limits(v, 'b'); }