Changeset fa5f9a1 in tol
- Timestamp:
- May 16, 2011, 4:49:03 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 5408466
- Parents:
- ad7183d
- Location:
- tol
- Files:
-
- 2 edited
-
btol/text_type/txtgra.cpp (modified) (2 diffs)
-
stdlib/general/TolPackage/client.tol (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/text_type/txtgra.cpp
rad7183d rfa5f9a1 64 64 65 65 #include <locale.h> 66 #include <stdlib.h> 66 67 67 68 /*! key used to force that Sub be initialized before than Sub of matrix … … 2633 2634 contens_ = textToWrap.Wrap(maxLineLength, wordSeparators, prefix); 2634 2635 } 2636 2637 2638 //-------------------------------------------------------------------- 2639 BInt 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 //-------------------------------------------------------------------- 2663 DeclareContensClass(BDat, BDatTemporary, BDatCompareVersionString); 2664 DefExtOpr(1, BDatCompareVersionString, "Compare.VersionString", 2, 2, 2665 "Text Text", 2666 "(Text a, Text b)", 2667 I2("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_); 2674 void BDatCompareVersionString::CalcContens() 2675 //-------------------------------------------------------------------- 2676 { 2677 contens_ = CompareVersionString(&Text(Arg(1)),&Text(Arg(2))); 2678 } -
tol/stdlib/general/TolPackage/client.tol
rad7183d rfa5f9a1 117 117 Text If(!Card(pkgSel),"", 118 118 { 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) }); 120 121 pkgSort[1] 121 122 }) … … 616 617 }, 617 618 { 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) }); 619 621 Text ver = ord[1]; 620 622 Date gmt = Copy(NowGmt); … … 739 741 Real(TolPackage::@VersionSynchro a, TolPackage::@VersionSynchro b) 740 742 { 741 Compare (b->co_name_version,a->co_name_version)743 Compare.VersionString(b->co_name_version,a->co_name_version) 742 744 })[1]; 743 745 last_compatible->co_name_version
Note: See TracChangeset
for help on using the changeset viewer.
