Ver Fonte

--- Merging r19053 into '.':
U packages/fcl-stl/doc/sortingexample.pp
A packages/fcl-stl/doc/hashsetexample.pp
A packages/fcl-stl/doc/hashmapexample.pp
--- Merging r19054 into '.':
A packages/fcl-stl/doc/hashmap.tex
U packages/fcl-stl/doc/main.tex
U packages/fcl-stl/doc/set.tex
A packages/fcl-stl/doc/main.pdf
U packages/fcl-stl/doc/arrayutils.tex
A packages/fcl-stl/doc/hashset.tex
U packages/fcl-stl/doc/map.tex
--- Merging r19852 into '.':
U packages/fcl-image/src/fpcanvas.pp
--- Merging r20044 into '.':
U packages/winceunits/src/rapi.pp
--- Merging r20063 into '.':
U rtl/win/wininc/func.inc
--- Merging r20085 into '.':
U packages/fcl-process/src/unix/process.inc
--- Merging r20087 into '.':
U ide/wchmhwrap.pas

# revisions: 19053,19054,19852,20044,20063,20085,20087
------------------------------------------------------------------------
r19053 | vladob | 2011-09-12 10:46:05 +0200 (Mon, 12 Sep 2011) | 1 line
Changed paths:
A /trunk/packages/fcl-stl/doc/hashmapexample.pp
A /trunk/packages/fcl-stl/doc/hashsetexample.pp
M /trunk/packages/fcl-stl/doc/sortingexample.pp

new examples for fcl-stl
------------------------------------------------------------------------
------------------------------------------------------------------------
r19054 | vladob | 2011-09-12 12:15:17 +0200 (Mon, 12 Sep 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-stl/doc/arrayutils.tex
A /trunk/packages/fcl-stl/doc/hashmap.tex
A /trunk/packages/fcl-stl/doc/hashset.tex
A /trunk/packages/fcl-stl/doc/main.pdf
M /trunk/packages/fcl-stl/doc/main.tex
M /trunk/packages/fcl-stl/doc/map.tex
M /trunk/packages/fcl-stl/doc/set.tex

doc update for fcl-stl
------------------------------------------------------------------------
------------------------------------------------------------------------
r19852 | sekelsenmat | 2011-12-15 10:46:43 +0100 (Thu, 15 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-image/src/fpcanvas.pp

Virtualizes more TFPCustomCanvas drawing methods so that descendents can properly override them instead of hiding them, thus improving the hability to draw to a generic TFPCustomCanvas and get the same output in a TCanvas
------------------------------------------------------------------------
------------------------------------------------------------------------
r20044 | marco | 2012-01-10 22:37:22 +0100 (Tue, 10 Jan 2012) | 1 line
Changed paths:
M /trunk/packages/winceunits/src/rapi.pp

* Fix for #21058, cerapiuninit with lowercase init.
------------------------------------------------------------------------
------------------------------------------------------------------------
r20063 | marco | 2012-01-13 10:02:54 +0100 (Fri, 13 Jan 2012) | 2 lines
Changed paths:
M /trunk/rtl/win/wininc/func.inc

* Add CancelIO, CancelIOex Mantis #21079

------------------------------------------------------------------------
------------------------------------------------------------------------
r20085 | marco | 2012-01-15 13:09:59 +0100 (Sun, 15 Jan 2012) | 2 lines
Changed paths:
M /trunk/packages/fcl-process/src/unix/process.inc

* increase loop in determine xterm, Mantis #21028

------------------------------------------------------------------------
------------------------------------------------------------------------
r20087 | marco | 2012-01-15 16:42:07 +0100 (Sun, 15 Jan 2012) | 1 line
Changed paths:
M /trunk/ide/wchmhwrap.pas

* fix for crash of textmode IDE when loading CHM index that contains empty tags.
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20135 -

marco há 13 anos atrás
pai
commit
d810537a6f

+ 5 - 0
.gitattributes

@@ -2323,6 +2323,11 @@ packages/fcl-stl/Makefile.fpc svneol=native#text/plain
 packages/fcl-stl/doc/arrayutils.tex svneol=native#text/plain
 packages/fcl-stl/doc/deque.tex svneol=native#text/plain
 packages/fcl-stl/doc/dequeexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/hashmap.tex svneol=native#text/plain
+packages/fcl-stl/doc/hashmapexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/hashset.tex svneol=native#text/plain
+packages/fcl-stl/doc/hashsetexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/main.pdf -text
 packages/fcl-stl/doc/main.tex svneol=native#text/plain
 packages/fcl-stl/doc/makra.tex svneol=native#text/plain
 packages/fcl-stl/doc/map.tex svneol=native#text/plain

+ 11 - 6
ide/wchmhwrap.pas

@@ -121,6 +121,7 @@ var
     i,j : integer;
     item : TChmSiteMapItem;
     tli: integer;
+    s  : String;
 begin
  result:=false;
  if floaded then exit;
@@ -160,12 +161,16 @@ begin
   for i:=0 to findex.items.count-1 do
     begin
       item:=findex.items.item[i];
-      if (length(item.local)>0) and (item.local[1]<>'/') then
-        tli:=TopicLinks^.AddItem('/'+item.local)
-      else
-        tli:=TopicLinks^.AddItem(item.local);
-      TLI:=EncodeHTMLCtx(ID,TLI+1);
-      IndexEntries^.Insert(NewIndexEntry(  FormatAlias(item.text),ID,TLI));
+      s:=formatalias(item.text);
+      if s<>'' then
+        begin
+          if (length(item.local)>0) and (item.local[1]<>'/') then
+            tli:=TopicLinks^.AddItem('/'+item.local)
+          else
+            tli:=TopicLinks^.AddItem(item.local);
+          TLI:=EncodeHTMLCtx(ID,TLI+1);
+          IndexEntries^.Insert(NewIndexEntry(  FormatAlias(item.text),ID,TLI));
+        end;
     end;
    {$ifdef wdebug}
      debugmessageS({$i %file%},'TCHMWrapper: endloadindex ',{$i %line%},'1',0,0);

+ 12 - 12
packages/fcl-image/src/fpcanvas.pp

@@ -302,24 +302,24 @@ type
     // using pen and brush
     procedure Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer); virtual;
     procedure Arc(ALeft, ATop, ARight, ABottom, SX, SY, EX, EY: Integer); virtual;
-    procedure Ellipse (Const Bounds:TRect);
-    procedure Ellipse (left,top,right,bottom:integer);
+    procedure Ellipse (Const Bounds:TRect); virtual;
+    procedure Ellipse (left,top,right,bottom:integer); virtual;
     procedure EllipseC (x,y:integer; rx,ry:longword);
-    procedure Polygon (Const points:array of TPoint);
-    procedure Polyline (Const points:array of TPoint);
-    procedure RadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer);
+    procedure Polygon (Const points:array of TPoint); virtual;
+    procedure Polyline (Const points:array of TPoint); virtual;
+    procedure RadialPie(x1, y1, x2, y2, StartAngle16Deg, Angle16DegLength: Integer); virtual;
     procedure PolyBezier(Points: PPoint; NumPts: Integer;
                          Filled: boolean = False;
-                         Continuous: boolean = False); 
+                         Continuous: boolean = False);  virtual;
     procedure PolyBezier(const Points: array of TPoint;  
                          Filled: boolean = False;
-                         Continuous: boolean = False);
-    procedure Rectangle (Const Bounds : TRect);
-    procedure Rectangle (left,top,right,bottom:integer);
-    procedure FillRect(const ARect: TRect); 
-    procedure FillRect(X1,Y1,X2,Y2: Integer);
+                         Continuous: boolean = False); virtual;
+    procedure Rectangle (Const Bounds : TRect); virtual;
+    procedure Rectangle (left,top,right,bottom:integer); virtual;
+    procedure FillRect(const ARect: TRect);  virtual;
+    procedure FillRect(X1,Y1,X2,Y2: Integer); virtual;
     // using brush
-    procedure FloodFill (x,y:integer);
+    procedure FloodFill (x,y:integer); virtual;
     procedure Clear;
     // using pen
     procedure MoveTo (x,y:integer);

+ 1 - 0
packages/fcl-process/src/unix/process.inc

@@ -109,6 +109,7 @@ Function DetectXterm : String;
       Result:=TestTerminal(Terminals[i]);
       If Result then
         XTermProgram:=Terminals[i];
+       inc(i);
       end;
   end;
 

+ 6 - 0
packages/fcl-stl/doc/arrayutils.tex

@@ -44,4 +44,10 @@ O(N log N) average and worst case. Uses QuickSort, backed up by HeapSort, when Q
 using too much recursion.\\ \hline
 \multicolumn{2}{|m{15cm}|}{Sort array arr, with specified size. Array indexing should be 0 based.} \\\hline\hline
 
+\verb!function NextPermutation! \verb!(arr: TArr, size:SizeUint):boolean! &
+Worst case for one call $O(N)$. Going through all permutations takes $O(N!)$ time.\\ \hline
+\multicolumn{2}{|m{15cm}|}{Orders elements on indexes $0, 1, \dots, size-1$ into nearest
+lexikografic larger permutation.} \\\hline
+
+
 \end{longtable}

+ 72 - 0
packages/fcl-stl/doc/hashmap.tex

@@ -0,0 +1,72 @@
+\chapter{THashMap}
+
+Implements container for unordered associative array with unique keys.
+Takes 3 arguments for specialization, first one is type of keys, second one is type of values, third
+one is is a hash functor
+(class which has class function hash, which takes element and number $n$ and returns hash of the
+element in range $0, 1, \dots, n-1$). 
+Usage example:
+
+\lstinputlisting[language=Pascal]{hashmapexample.pp}
+
+Memory complexity:
+Arounds two times of size of stored elements 
+
+Members list:
+
+\begin{longtable}{|m{10cm}|m{5cm}|}
+\hline
+Method & Complexity guarantees \\ \hline
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline
+
+\verb!Create! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Constructor. Creates empty map.} \\ \hline\hline
+
+\verb!function Size(): SizeUInt! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Returns number of elements in map.} \\\hline\hline
+
+\verb!procedure Insert(key: TKey; value: TValue)! &
+O(1)  \\ \hline
+\multicolumn{2}{|m{15cm}|}{Inserts key value pair into map. If key was already there, it will have
+new value assigned.} \\\hline\hline
+
+\verb!procedure Delete(key: TKey)! &
+O(lg N) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Deletes key (and associated value) from map. If element is not in map, nothing happens.} \\\hline\hline
+
+\verb!function Contains(key: TKey):boolean! & O(1) on average \\\hline
+\multicolumn{2}{|m{15cm}|}{Checks whether element with given key is in map.} \\\hline\hline
+
+\verb!function Iterator:TIterator! & O(1) on average \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator allowing traversal through map. If map is empty returns nil.} \\\hline\hline
+
+\verb!function IsEmpty(): boolean! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Returns true when map is empty.} \\\hline
+
+\verb!property item[i: Key]: TValue; default;! & O(1) on average \\\hline
+\multicolumn{2}{|m{15cm}|}{Property for accessing key i in map. Can be used just by square
+brackets (its default property).} \\\hline\hline
+
+
+\end{longtable}
+
+Some methods return type TIterator, which has following methods:
+\begin{longtable}{|m{10cm}|m{5cm}|}                                                             
+\hline
+Method & Complexity guarantees \\ \hline                                                  
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline                                               
+\verb!function Next:boolean! & O(N) worst case, but traversal of whole set takes O(N) time \\\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to next larger element in set. Returns true on
+success. If the iterator is already pointing on last element returns false.} \\\hline\hline
+
+\verb!property Key:TKey! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading the key.} \\\hline
+
+\verb!property Value:TValue! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading and writing of the value.} \\\hline
+\verb!property MutableValue:PValue! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns pointer on stored value. Usefull for accessing records and
+objects.} \\\hline
+
+
+\end{longtable}

+ 35 - 0
packages/fcl-stl/doc/hashmapexample.pp

@@ -0,0 +1,35 @@
+{$mode objfpc}
+
+uses ghashmap;
+
+type hashlli=class
+       public
+       class function hash(a:longint; b:SizeUInt):SizeUInt;
+     end;
+     maplli=specialize THashMap<longint, longint, hashlli>;
+
+class function hashlli.hash(a:longint; b:SizeUInt):SizeUInt;
+begin
+  hash:= a mod b;
+end;
+
+var data:maplli; i:longint; iterator:maplli.TIterator;
+
+begin
+  data:=maplli.Create;
+
+  for i:=0 to 10 do
+    data[i] := 17*i;
+
+  data.delete(5);
+
+  {Iteration through elements}
+  iterator:=data.Iterator;
+  repeat
+    writeln(iterator.Key, ' ', iterator.Value);
+  until not iterator.Next;
+  {Don't forget to destroy iterator}
+  iterator.Destroy;
+
+  data.Destroy;
+end.

+ 58 - 0
packages/fcl-stl/doc/hashset.tex

@@ -0,0 +1,58 @@
+\chapter{THashSet}
+
+Implements container for storing unordered set of unique elements.
+Takes 2 arguments for specialization, first one is type of elements, second one is a hash functor
+(class which has class function hash, which takes element and number $n$ and returns hash of the
+element in range $0, 1, \dots, n-1$). 
+Usage example:
+
+\lstinputlisting[language=Pascal]{hashsetexample.pp}
+
+Memory complexity:
+Arounds two times of size of stored elements 
+Members list:
+
+\begin{longtable}{|m{10cm}|m{5cm}|}
+\hline
+Method & Complexity guarantees \\ \hline
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline
+
+\verb!Create! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Constructor. Creates empty set.} \\ \hline\hline
+
+\verb!function Size(): SizeUInt! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Returns number of elements in set.} \\\hline\hline
+
+\verb!procedure Insert(value: T)! &
+O(1) on average \\ \hline
+\multicolumn{2}{|m{15cm}|}{Inserts element into set, if given element is already there nothing
+happens.} \\\hline\hline
+
+\verb!procedure Delete(value: T)! &
+O(1) on average \\ \hline
+\multicolumn{2}{|m{15cm}|}{Deletes value from set. If element is not in set, nothing happens.} \\\hline\hline
+
+\verb!function Contains(value: T):boolean! & O(1) on average \\\hline
+\multicolumn{2}{|m{15cm}|}{Checks whether element is in set.} \\\hline\hline
+
+\verb!function Iterator:TIterator! & O(1) \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator allowing traversal through set. If set is empty returns nil.} \\\hline\hline
+
+\verb!function IsEmpty(): boolean! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Returns true when set is empty.} \\\hline
+
+\end{longtable}
+
+Some methods return type TIterator, which has following methods:
+\begin{longtable}{|m{10cm}|m{5cm}|}                                                             
+\hline
+Method & Complexity guarantees \\ \hline                                                  
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline                                               
+\verb!function Next:boolean! & O(N) worst case, but traversal of whole set takes O(N) time \\\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to next larger element in set. Returns true on
+success. If the iterator is already pointing on last element returns false.} \\\hline\hline
+
+\verb!property Data:T! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading of the element.} \\\hline
+
+\end{longtable}

+ 33 - 0
packages/fcl-stl/doc/hashsetexample.pp

@@ -0,0 +1,33 @@
+{$mode objfpc}
+
+uses ghashset;
+
+type hashlli=class
+       public
+       class function hash(a:longint; b:SizeUInt):SizeUInt;
+     end;
+     setlli=specialize THashSet<longint, hashlli>;
+
+class function hashlli.hash(a:longint; b:SizeUInt):SizeUInt;
+begin
+  hash:= a mod b;
+end;
+
+var data:setlli; i:longint; iterator:setlli.TIterator;
+
+begin
+  data:=setlli.Create;
+
+  for i:=0 to 10 do
+    data.insert(i);
+
+  {Iteration through elements}
+  iterator:=data.Iterator;
+  repeat
+    writeln(iterator.Data);
+  until not iterator.Next;
+  {Don't forget to destroy iterator}
+  iterator.Destroy;
+
+  data.Destroy;
+end.

BIN
packages/fcl-stl/doc/main.pdf


+ 2 - 0
packages/fcl-stl/doc/main.tex

@@ -59,5 +59,7 @@
 \input{arrayutils.tex}
 \input{set.tex}
 \input{map.tex}
+\input{hashset.tex}
+\input{hashmap.tex}
 
 \end{document}

+ 45 - 30
packages/fcl-stl/doc/map.tex

@@ -7,11 +7,6 @@ Usage example:
 
 \lstinputlisting[language=Pascal]{mapexample.pp}
 
-Some methods return type TMSet.PNode. Usefull fields are Data.Key, Data.Value, for retrieving
-actual Key and Value from node. This node can be also used for navigation between elements by methods of set class.
-You can also change value in node (but not key).
-(But don't do anything else with it, you can lose data integrity.)
-
 Memory complexity:
 Size of stored base + constant overhead for each stored element (3 pointers + one boolean).
 
@@ -33,55 +28,75 @@ O(lg N), N is number of elements in map \\ \hline
 \multicolumn{2}{|m{15cm}|}{Inserts key value pair into map. If key was already there, it will have
 new value assigned.} \\\hline\hline
 
+\verb!function InsertAndGetIterator! & $O(\lg N)$\\
+\verb!(key:TKey; value: TValue):TIterator! & \\ \hline
+\multicolumn{2}{|m{15cm}|}{Same as Insert but also returns iterator poiting to inserted element.} \\\hline\hline
+
 \verb!procedure Delete(key: TKey)! &
 O(lg N) \\ \hline
 \multicolumn{2}{|m{15cm}|}{Deletes key (and associated value) from map. If element is not in map, nothing happens.} \\\hline\hline
 
-\verb!function Find(key: T):TMSet.PNode! & O(lg N) \\\hline
+\verb!function Find(key: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for key in map. If value is not there returns nil. Otherwise
-returns pointer to tree node (type TMSet.PNode), which can be used for retrieving data from map.} \\\hline\hline
+returns iterator, which can be used for retrieving data from map.} \\\hline\hline
 
-\verb!function FindLess(key: T):TMSet.PNode! & O(lg N) \\\hline
+\verb!function FindLess(key: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for greatest element less than key in map. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type TMSet.PNode), which can be used for retrieving data from map.} \\\hline\hline
+returns iterator, which can be used for retrieving data from map.} \\\hline\hline
 
-\verb!function FindLessEqual(key: T):TMSet.PNode! & O(lg N) \\\hline
+\verb!function FindLessEqual(key: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for greatest element less or equal than key in map. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type TMSet.PNode), which can be used for retrieving data from map.} \\\hline\hline
+returns iterator, which can be used for retrieving data from map.} \\\hline\hline
 
-\verb!function FindGreater(key: T):TMSet.PNode! & O(lg N) \\\hline
+\verb!function FindGreater(key: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for smallest element greater than key in map. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type TMSet.PNode), which can be used for retrieving data from map.} \\\hline\hline
+returns iterator, which can be used for retrieving data from map.} \\\hline\hline
 
-\verb!function FindGreaterEqual(key: T):TMSet.PNode! & O(lg N) \\\hline
+\verb!function FindGreaterEqual(key: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for smallest element greater or equal than key in map. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type TMSet.PNode), which can be used for retrieving data from map.} \\\hline\hline
+returns iterator, which can be used for retrieving data from map.} \\\hline\hline
 
-\verb!function Min:TMSet.PNode! & O(lg N) \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns node containing smallest key of map. If map is empty returns
+\verb!function Min:TIterator! & O(lg N) \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator pointing to smallest key of map. If map is empty returns
 nil.} \\\hline\hline
 
-\verb!function Max:TMSet.PNode! & O(lg N) \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns node containing largest key of map. If map is empty returns
+\verb!function Max:TIterator! & O(lg N) \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator pointing to largest key of map. If map is empty returns
 nil.} \\\hline\hline
 
-\verb!function Next(x:TMSet.PNode):TMSet.PNode! & O(lg N) worst case, but traversal from smallest element to
-largest takes O(N) time \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns successor of x. If x is largest key of map, returns nil.} \\\hline\hline
-
-\verb!function Prev(x:TMSet.PNode):TMSet.PNode! & O(lg N) worst case, but traversal from largest element to
-smallest takes O(N) time \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns predecessor of x. If x is smallest key of map, returns nil.} \\\hline\hline
-
 \verb!function IsEmpty(): boolean! & O(1) \\ \hline
 \multicolumn{2}{|m{15cm}|}{Returns true when map is empty.} \\\hline
 
-\verb!function GetValue(key:TKey):TValue! & O(lg N) \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns value associated with key. Is key isn't in map crashes.} \\\hline
-
 \verb!property item[i: Key]: TValue; default;! & O(ln N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Property for accessing key i in map. Can be used just by square
 brackets (its default property).} \\\hline\hline
 
 
+\end{longtable}
+
+Some methods return type TIterator, which has following methods:
+\begin{longtable}{|m{10cm}|m{5cm}|}                                                             
+\hline
+Method & Complexity guarantees \\ \hline                                                  
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline                                               
+\verb!function Next:boolean! & O(lg N) worst case, but traversal from smallest element to
+largest takes O(N) time \\\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to element with smallest larger key. Returns true on
+success. If the iterator is already pointing on element with largest key returns false.} \\\hline\hline
+
+\verb!function Prev:boolean! & O(lg N) worst case, but traversal from largest element to
+smallest takes O(N) time \\\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to element with largest smaller key. Returns true on
+success. If the iterator is already pointing on element with smallest key returns false.} \\\hline\hline
+
+\verb!property Key:TKey! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading the key.} \\\hline
+
+\verb!property Value:TValue! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading and writing of the value.} \\\hline
+\verb!property MutableValue:PValue! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns pointer on stored value. Usefull for accessing records and
+objects.} \\\hline
+
+
 \end{longtable}

+ 39 - 25
packages/fcl-stl/doc/set.tex

@@ -6,10 +6,6 @@ Usage example:
 
 \lstinputlisting[language=Pascal]{setexample.pp}
 
-Some methods return type of PNode. It has field Data, which can be used for retrieving data from
-that node. This node can be also used for navigation between elements by methods of set class.
-(But don't do anything else with it, you can lose data integrity.)
-
 Memory complexity:
 Size of stored elements + constant overhead for each stored element (3 pointers + one boolean).
 
@@ -28,49 +24,67 @@ Method & Complexity guarantees \\ \hline
 
 \verb!procedure Insert(value: T)! &
 O(lg N), N is number of elements in set \\ \hline
-\multicolumn{2}{|m{15cm}|}{Inserts element into set.} \\\hline\hline
+\multicolumn{2}{|m{15cm}|}{Inserts element into set, if given element is already there nothing
+happens.} \\\hline\hline
+
+\verb!function InsertAndGetIterator! & $O(\lg N)$\\
+\verb!(value: T):TIterator! & \\ \hline
+\multicolumn{2}{|m{15cm}|}{Inserts element into set, if given element is already there nothing
+happens. Also returns iterator pointing on given element.} \\\hline\hline
 
 \verb!procedure Delete(value: T)! &
 O(lg N), N is number of elements in set \\ \hline
 \multicolumn{2}{|m{15cm}|}{Deletes value from set. If element is not in set, nothing happens.} \\\hline\hline
 
-\verb!function Find(value: T):PNode! & O(lg N) \\\hline
+\verb!function Find(value: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for value in set. If value is not there returns nil. Otherwise
-returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline
+returns iterator, which can be used for retrieving data from set.} \\\hline\hline
 
-\verb!function FindLess(value: T):PNode! & O(lg N) \\\hline
+\verb!function FindLess(value: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for greatest element less than value in set. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline
+returns iterator, which can be used for retrieving data from set.} \\\hline\hline
 
-\verb!function FindLessEqual(value: T):PNode! & O(lg N) \\\hline
+\verb!function FindLessEqual(value: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for greatest element less or equal than value in set. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline
+returns iterator, which can be used for retrieving data from set.} \\\hline\hline
 
-\verb!function FindGreater(value: T):PNode! & O(lg N) \\\hline
+\verb!function FindGreater(value: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for smallest element greater than value in set. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline
+returns iterator, which can be used for retrieving data from set.} \\\hline\hline
 
-\verb!function FindGreaterEqual(value: T):PNode! & O(lg N) \\\hline
+\verb!function FindGreaterEqual(value: T):TIterator! & O(lg N) \\\hline
 \multicolumn{2}{|m{15cm}|}{Searches for smallest element greater or equal than value in set. If such element is not there returns nil. Otherwise
-returns pointer to tree node (type PNode), which can be used for retrieving data from set.} \\\hline\hline
+returns iterator, which can be used for retrieving data from set.} \\\hline\hline
 
-\verb!function Min:PNode! & O(lg N) \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns node containing smallest element of set. If set is empty returns
+\verb!function Min:TIterator! & O(lg N) \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator pointing to the smallest element of set. If set is empty returns
 nil.} \\\hline\hline
 
-\verb!function Max:PNode! & O(lg N) \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns node containing largest element of set. If set is empty returns
+\verb!function Max:TIterator! & O(lg N) \\\hline
+\multicolumn{2}{|m{15cm}|}{Returns iterator pointing to the largest element of set. If set is empty returns
 nil.} \\\hline\hline
 
-\verb!function Next(x:PNode):PNode! & O(lg N) worst case, but traversal from smallest element to
+\verb!function IsEmpty(): boolean! & O(1) \\ \hline
+\multicolumn{2}{|m{15cm}|}{Returns true when set is empty.} \\\hline
+
+\end{longtable}
+
+Some methods return type TIterator, which has following methods:
+\begin{longtable}{|m{10cm}|m{5cm}|}                                                             
+\hline
+Method & Complexity guarantees \\ \hline                                                  
+\multicolumn{2}{|m{15cm}|}{Description} \\ \hline\hline                                               
+\verb!function Next:boolean! & O(lg N) worst case, but traversal from smallest element to
 largest takes O(N) time \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns successor of x. If x is largest element of set, returns nil.} \\\hline\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to smallest larger element in set. Returns true on
+success. If the iterator is already pointing on largest element returns false.} \\\hline\hline
 
-\verb!function Prev(x:PNode):PNode! & O(lg N) worst case, but traversal from largest element to
+\verb!function Prev:boolean! & O(lg N) worst case, but traversal from largest element to
 smallest takes O(N) time \\\hline
-\multicolumn{2}{|m{15cm}|}{Returns predecessor of x. If x is smallest element of set, returns nil.} \\\hline\hline
+\multicolumn{2}{|m{15cm}|}{Moves iterator to largest smaller element in set. Returns true on
+success. If the iterator is already pointing on smallest element returns false.} \\\hline\hline
 
-\verb!function IsEmpty(): boolean! & O(1) \\ \hline
-\multicolumn{2}{|m{15cm}|}{Returns true when set is empty.} \\\hline
+\verb!property Data:T! & $O(1)$ \\\hline
+\multicolumn{2}{|m{15cm}|}{Property, which allows reading of the element.} \\\hline
 
 \end{longtable}

+ 2 - 1
packages/fcl-stl/doc/sortingexample.pp

@@ -2,7 +2,8 @@ uses garrayutils, gutil, gvector;
 
 type vectorlli = specialize TVector<longint>;
      lesslli = specialize TLess<longint>;
-     sortlli = specialize TOrderingArrayUtils<vectorlli, longint, lesslli>;
+     sortlli = specialize 
+         TOrderingArrayUtils<vectorlli, longint, lesslli>;
 
 var data:vectorlli; n,i:longint;
 

+ 4 - 4
packages/winceunits/src/rapi.pp

@@ -339,7 +339,7 @@ type
   //added 01/19/2003 - Octavio Hernandez; [email protected]
   TDeviceToDesktop = function(DesktopLocation, TableList: String; Sync: BOOL; Overwrite: Integer; DeviceLocation: String): Longint stdcall;
 
-  TCeRapiUnInit = function : LongInt stdcall;
+  TCeRapiUninit = function : LongInt stdcall;
   TCeFindAllFiles = function(Path: PWideChar; Attr: DWORD; var Count: DWord;
     var FindData: PCe_Find_Data_array): BOOL stdcall;
   TRapiFreeBuffer = procedure(p: Pointer) stdcall;
@@ -348,7 +348,7 @@ type
 
 function CeRapiInit: LongInt;
 function CeRapiInitEx(var RInit: TRapiInit) : LongInt;
-function CeRapiUnInit: LongInt;
+function CeRapiUninit: LongInt;
 function CeFindAllFiles(Path: PWideChar; Attr: DWORD;
   var Count: DWord; var FindData: PCe_Find_Data_array): BOOL;
 procedure RapiFreeBuffer(p: Pointer);
@@ -444,7 +444,7 @@ IMPLEMENTATION
 
 var
   mCeRapiInit : TCeRapiInit;
-  mCeRapiUnInit : TCeRapiUnInit;
+  mCeRapiUninit : TCeRapiUninit;
   mCeFindAllFiles: TCeFindAllFiles;
   mRapiFreeBuffer : TRapiFreeBuffer;
   mCeRapiInitEx: TCeRapiInitEx;
@@ -530,7 +530,7 @@ begin
     {...and load all globals}
     @mCeRapiInit := GetProcAddress(RapiModule, 'CeRapiInit');
     @mCeRapiInitEx := GetProcAddress(RapiModule, 'CeRapiInitEx');
-    @mCeRapiUnInit := GetProcAddress(RapiModule, 'CeRapiUnInit');
+    @mCeRapiUninit := GetProcAddress(RapiModule, 'CeRapiUninit');
     @mCeFindAllFiles := GetProcAddress(RapiModule, 'CeFindAllFiles');
     @mRapiFreeBuffer := GetProcAddress(RapiModule, 'RapiFreeBuffer');
 

+ 3 - 1
rtl/win/wininc/func.inc

@@ -404,7 +404,8 @@ function CloseWindowStation(hWinSta:HWINSTA):WINBOOL; external 'user32' name 'Cl
 function SetProcessWindowStation(hWinSta:HWINSTA):WINBOOL; external 'user32' name 'SetProcessWindowStation';
 function GetProcessWindowStation:HWINSTA; external 'user32' name 'GetProcessWindowStation';
 function SetUserObjectSecurity(hObj:HANDLE; pSIRequested:PSECURITY_INFORMATION; pSID:PSECURITY_DESCRIPTOR):WINBOOL; external 'user32' name 'SetUserObjectSecurity';
-
+function CancelIoEx( hfile: THandle; overlapped:LPOverlapped):WINBOOL; external 'kernel32.dll' name 'CancelIoEx';
+function CancelIo  ( hfile: THandle):WINBOOL; external 'kernel32.dll' name 'CancelIo';
 function GetUserObjectSecurity(hObj:HANDLE; pSIRequested:PSECURITY_INFORMATION; pSID:PSECURITY_DESCRIPTOR; nLength:DWORD; lpnLengthNeeded:LPDWORD):WINBOOL; external 'user32' name 'GetUserObjectSecurity';
 function TranslateMessage(lpMsg:LPMSG):WINBOOL; external 'user32' name 'TranslateMessage';
 function SetMessageQueue(cMessagesMax:longint):WINBOOL; external 'user32' name 'SetMessageQueue';
@@ -1078,6 +1079,7 @@ function wglSwapLayerBuffers(DC:HDC; fuPlanes:UINT):WINBOOL; external 'opengl32'
 function wglUseFontOutlinesW(DC:HDC; first:DWORD; count:DWORD;  listbase:DWORD; deviation:Single;
   extrusion:Single; format:longint; lpgmf:LPGLYPHMETRICSFLOAT):WINBOOL; external 'opengl32' name 'wglUseFontOutlinesW';
 
+
 { translated macros }
 function Animate_Create(hWndP:HWND; id:HMENU;dwStyle:DWORD;hInstance:HINST):HWND;
 function Animate_Open(hwnd : HWND;szName : LPTSTR) : LRESULT;