Changeset fa5f9a1 in tol


Ignore:
Timestamp:
May 16, 2011, 4:49:03 PM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
5408466
Parents:
ad7183d
Message:

Refs #1206

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3550 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/text_type/txtgra.cpp

    rad7183d rfa5f9a1  
    6464
    6565#include <locale.h>
     66#include <stdlib.h>
    6667
    6768/*! key used to force that Sub be initialized before than Sub of matrix
    … …  
    26332634  contens_ = textToWrap.Wrap(maxLineLength, wordSeparators, prefix);
    26342635}
     2636
     2637
     2638//--------------------------------------------------------------------
     2639BInt CompareVersionString(const BText* txt1, const BText* txt2)
     2640//--------------------------------------------------------------------
     2641{
     2642  BChar sep = '.';
     2643  BArray<BText> tok1, tok2;
     2644  ReadAllTokens(*txt1, tok1, sep);
     2645  ReadAllTokens(*txt2, tok2, sep);
     2646  int n1 = tok1.Size();
     2647  int n2 = tok2.Size();
     2648  int n = Minimum(n1,n2);
     2649  int k, t1, t2;
     2650  int cmp = 0;
     2651
     2652  for(k=0; (k<n) && !cmp; k++)
     2653  {
     2654    t1 = atoi(tok1[k].String());
     2655    t2 = atoi(tok2[k].String());
     2656    cmp = t1-t2;
     2657  }
     2658  if(!cmp) { cmp = n1-n2; }
     2659  return (cmp);
     2660}
     2661
     2662//--------------------------------------------------------------------
     2663DeclareContensClass(BDat, BDatTemporary, BDatCompareVersionString);
     2664DefExtOpr(1, BDatCompareVersionString, "Compare.VersionString", 2, 2,
     2665"Text Text",
     2666"(Text a, Text b)",
     2667I2("Compares two version strings with an arbitrary number of numeric "
     2668    "tokens separated by the point character. For example 1.9 would "
     2669    "be prior to 1.10 while it is the reverse alphabetical order.",
     2670    "Compara dos cadenas de version con un número arbitrario de tokens "
     2671    "numéricos separados por el caracter punto. Por ejemplo 1.9 sería "
     2672    "anterior a 1.10 mientras que alfabéticamente es al revés.\n"),
     2673          BOperClassify::System_);
     2674void BDatCompareVersionString::CalcContens()
     2675//--------------------------------------------------------------------
     2676{
     2677  contens_ = CompareVersionString(&Text(Arg(1)),&Text(Arg(2)));
     2678}
  • tol/stdlib/general/TolPackage/client.tol

    rad7183d rfa5f9a1  
    117117  Text If(!Card(pkgSel),"",
    118118  {
    119     Set pkgSort = Sort(pkgSel, Real(Text a, Text b) { Compare(b, a) });
     119    Set pkgSort = Sort(pkgSel, Real(Text a, Text b) {
     120      Compare.VersionString(b, a) });
    120121    pkgSort[1]
    121122  })
    … …  
    616617    },
    617618    {
    618       Set ord = Sort(cls,Real ev.sort(Text a, Text b) { Compare(b, a) });
     619      Set ord = Sort(cls,Real ev.sort(Text a, Text b) {
     620        Compare.VersionString(b, a) });
    619621      Text ver = ord[1];
    620622      Date gmt = Copy(NowGmt);
    … …  
    739741  Real(TolPackage::@VersionSynchro a, TolPackage::@VersionSynchro b)
    740742  {
    741     Compare(b->co_name_version,a->co_name_version)
     743    Compare.VersionString(b->co_name_version,a->co_name_version)
    742744  })[1];
    743745  last_compatible->co_name_version
Note: See TracChangeset for help on using the changeset viewer.