]> OCCT Git - occt-wok.git/commitdiff
Initial revision
authorcas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
72 files changed:
src/WOKTools/FILES [new file with mode: 0755]
src/WOKTools/WOKTools.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_ArgTable.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_AsciiStringHasher.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_AsciiStringHasher.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMap.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMap.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMap.lxx [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMapIterator.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMapIterator.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_BasicMapIterator.lxx [new file with mode: 0755]
src/WOKTools/WOKTools_CStringHasher.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_CStringHasher.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_ChDirValue.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_ChDirValue.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_CompareOfHAsciiString.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_CompareOfHAsciiString.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_DataMap.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_DataMap.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_DataMapIterator.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_Define.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Define.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_DoubleMap.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_DoubleMap.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_DoubleMapIterator.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_EnvValue.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_EnvValue.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_Error.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Error.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_GEdge.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_GGraph.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_GGraph.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_GNode.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_GPath.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_HAsciiStringHasher.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_HAsciiStringHasher.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_IndexedDataMap.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_IndexedDataMap.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_IndexedMap.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_IndexedMap.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_Info.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Info.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_InterpFileValue.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_InterpFileValue.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_Map.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Map.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_MapIterator.gxx [new file with mode: 0755]
src/WOKTools/WOKTools_Message.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Message.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_Message.lxx [new file with mode: 0755]
src/WOKTools/WOKTools_Message_proto.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_Messages.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_MsgControl.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_MsgHandler.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_MsgStreamPtr.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_Options.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Options.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_Options_proto.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_PUsage.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_PUsage.hxx [new file with mode: 0755]
src/WOKTools/WOKTools_Replace.tcl [new file with mode: 0755]
src/WOKTools/WOKTools_Return.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Return.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_ReturnValue.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_ReturnValue.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_StringValue.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_StringValue.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_Verbose.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Verbose.cxx [new file with mode: 0755]
src/WOKTools/WOKTools_WOKSteps.edl [new file with mode: 0755]
src/WOKTools/WOKTools_Warning.cdl [new file with mode: 0755]
src/WOKTools/WOKTools_Warning.cxx [new file with mode: 0755]

diff --git a/src/WOKTools/FILES b/src/WOKTools/FILES
new file mode 100755 (executable)
index 0000000..3b82d85
--- /dev/null
@@ -0,0 +1,11 @@
+WOKTools_PUsage.hxx
+WOKTools_ArgTable.hxx
+WOKTools_MsgHandler.hxx
+WOKTools_MsgControl.hxx
+WOKTools_PUsage.cxx
+WOKTools_Messages.hxx
+WOKTools_MsgStreamPtr.hxx
+WOKTools_Options_proto.hxx
+WOKTools_Message_proto.hxx
+WOKTools_WOKSteps.edl
+WOKTools_Replace.tcl
diff --git a/src/WOKTools/WOKTools.cdl b/src/WOKTools/WOKTools.cdl
new file mode 100755 (executable)
index 0000000..abd8924
--- /dev/null
@@ -0,0 +1,136 @@
+-- File:       WOKTools.cdl
+-- Created:    Fri Nov 24 13:45:46 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+package WOKTools 
+
+       ---Purpose: 
+
+uses
+    SortTools,
+    OSD,
+    TCollection,
+    TColStd,
+    MMgt
+
+is
+
+    imported ArgTable;
+    imported PUsage;
+    imported MsgHandler;
+    imported MsgControl;
+    imported MsgStreamPtr;
+
+    enumeration ReturnType      is String, Environment, ChDir, InterpFile;
+    enumeration InterpFileType  is CShell, BourneShell, KornShell, TclInterp, EmacsLisp, WNTCmd;
+
+
+-- GENERIC COLLECTIONS
+
+    private deferred class BasicMap;
+    private deferred class BasicMapIterator;
+    class AsciiStringHasher;
+    class HAsciiStringHasher;
+    class CStringHasher;
+    class CompareOfHAsciiString;
+    
+
+    generic class Map, MapIterator;
+    ---Purpose: Optimized WOK Oriented (String) Map
+
+    generic class DataMap, DataMapIterator;
+    ---Purpose: Optimized WOK Oriented (String) DataMap
+
+    generic class DoubleMap, DoubleMapIterator;
+    ---Purpose: Optimized WOK Oriented (String) DoubleMap
+
+    generic class IndexedMap;
+       ---Purpose: A Map where the keys are indexed.
+       
+    generic class IndexedDataMap;
+       ---Purpose: An Indexed Map where data can be stored with the keys.
+
+    generic class GGraph,
+                  GEdge,
+                  GNode,
+                  GPath,
+                 SequenceOfGraphItem,
+                 SequenceOfGNode,
+                 HSequenceOfGNode,
+                 SequenceOfGPath,
+                 HSequenceOfGPath,
+                 SequenceOfGEdge,
+                 HSequenceOfGEdge,
+                  HSequenceOfGraphItem;
+                          
+    ---Purpose: Main class of graphs.
+
+    class Define;
+    class Options;
+
+    class Return;
+    
+    deferred class ReturnValue;
+       class StringValue;
+       class EnvValue;
+       class ChDirValue;
+       class InterpFileValue;
+
+    deferred class Message;
+    
+       class Info;
+       class Verbose;
+       class Warning;
+       class Error;
+       -- class LogMsg;
+
+
+-- INSTANCIATIONS
+
+    class MapOfHAsciiString
+       instantiates Map     from WOKTools (HAsciiString       from TCollection,
+                                           HAsciiStringHasher from WOKTools); 
+
+    class DataMapOfHAsciiStringOfHAsciiString
+       instantiates DataMap from WOKTools (HAsciiString       from TCollection,
+                                           HAsciiString       from TCollection,
+                                           HAsciiStringHasher from WOKTools); 
+
+    class IndexedMapOfHAsciiString
+       instantiates IndexedMap from WOKTools ( HAsciiString       from TCollection,
+                                               HAsciiStringHasher from WOKTools); 
+    class IndexedDataMapOfHAsciiString
+       instantiates IndexedDataMap from WOKTools ( HAsciiString       from TCollection, AsciiString       from TCollection,
+                                                   HAsciiStringHasher from WOKTools); 
+
+    class DataMapOfHAsciiStringOfHSequenceOfHAsciiString
+       instantiates        DataMap from WOKTools ( HAsciiString            from TCollection, 
+                                                   HSequenceOfHAsciiString from TColStd, 
+                                                   HAsciiStringHasher      from WOKTools );
+    class SequenceOfReturnValue 
+       instantiates  Sequence from TCollection ( ReturnValue from WOKTools); 
+    class HSequenceOfReturnValue 
+       instantiates HSequence from TCollection ( ReturnValue from WOKTools,  SequenceOfReturnValue  from WOKTools);
+
+    class SequenceOfDefine 
+       instantiates  Sequence from TCollection ( Define from WOKTools); 
+    class HSequenceOfDefine 
+       instantiates HSequence from TCollection ( Define from WOKTools,  SequenceOfDefine  from WOKTools);
+
+    class SequenceOfBoolean instantiates
+         Sequence from TCollection(Boolean from Standard);
+    class HSequenceOfBoolean instantiates
+         HSequence from TCollection(Boolean from Standard,SequenceOfBoolean);  
+    class Array1OfHAsciiString instantiates 
+         Array1 from TCollection(HAsciiString from TCollection);
+    
+    class SortOfHAsciiString instantiates 
+         HeapSort from SortTools(HAsciiString from TCollection,
+                                 Array1OfHAsciiString from WOKTools,
+                                 CompareOfHAsciiString from WOKTools);
+                                 
+end WOKTools;
diff --git a/src/WOKTools/WOKTools_ArgTable.hxx b/src/WOKTools/WOKTools_ArgTable.hxx
new file mode 100755 (executable)
index 0000000..6f904c2
--- /dev/null
@@ -0,0 +1,12 @@
+// File:       WOKTools_ArgTable.hxx
+// Created:    Tue May 30 15:08:34 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#ifndef WOKTools_ArgTable_HeaderFile
+#define WOKTools_ArgTable_HeaderFile
+
+typedef  char **WOKTools_ArgTable;
+
+#endif
diff --git a/src/WOKTools/WOKTools_AsciiStringHasher.cdl b/src/WOKTools/WOKTools_AsciiStringHasher.cdl
new file mode 100755 (executable)
index 0000000..f181f60
--- /dev/null
@@ -0,0 +1,25 @@
+-- File:       WOKTools_AsciiStringHasher.cdl
+-- Created:    Tue May 30 10:03:37 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class AsciiStringHasher from WOKTools
+uses
+    AsciiString from TCollection
+is
+
+   HashCode(myclass; Key : AsciiString from TCollection) returns Integer;
+           ---Level: Public
+       ---Purpose: Returns a HasCode value  for  the  Key <K>  in the
+       -- range 0..Upper.
+       -- Default ::HashCode(K,Upper)
+           
+   IsEqual(myclass; K1, K2 : AsciiString from TCollection) returns Boolean;
+       ---Level: Public
+       ---Purpose: Returns True  when the two  keys are the same. Two
+       -- same  keys  must   have  the  same  hashcode,  the
+       -- contrary is not necessary.
+       -- Default K1 == K2
+end;
diff --git a/src/WOKTools/WOKTools_AsciiStringHasher.cxx b/src/WOKTools/WOKTools_AsciiStringHasher.cxx
new file mode 100755 (executable)
index 0000000..16fcaeb
--- /dev/null
@@ -0,0 +1,54 @@
+// File:       WOKTools_StringHasher.cxx
+// Created:    Tue May 30 10:03:23 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_AsciiStringHasher.ixx>
+
+
+
+ Standard_Integer WOKTools_AsciiStringHasher::HashCode (const TCollection_AsciiString &Value)
+{
+  if(Value.IsEmpty()) return 0;
+
+  register Standard_CString string = Value.ToCString();
+  register int c;
+  register unsigned int result;
+
+  result=0;
+  while(1) {
+    c=*string;
+    string++;
+    if(c==0) break;
+    result += (result << 3) + c;
+  }
+  return result;
+
+#if 0
+  Standard_CString charPtr   = (Standard_CString)Value.ToCString();
+  Standard_Integer aHashCode = 0,  alen,  i  = 0,  pos = 0,  count,  *tmphash;
+  Standard_Character tabchar[20];
+  
+  alen = Value.Length();
+  
+  while(i < alen) {
+    for (count = 0,pos = i;count < sizeof(int); count++) {
+      if (pos + count >= alen)  tabchar[count] = '\0';
+      else tabchar[count] = charPtr[pos + count];
+      i++;
+    }
+    tmphash = (int *)tabchar;   
+    aHashCode = aHashCode ^ *tmphash;
+  }
+  return aHashCode;
+#endif
+}
+
+ Standard_Boolean WOKTools_AsciiStringHasher::IsEqual(const TCollection_AsciiString &K1, const TCollection_AsciiString &K2)
+{
+  if (K1.Length() != K2.Length()) return(Standard_False);
+  if (memcmp(K1.ToCString(), K2.ToCString(), K1.Length()) == 0) return Standard_True;
+  return Standard_False;
+}
+
diff --git a/src/WOKTools/WOKTools_BasicMap.cdl b/src/WOKTools/WOKTools_BasicMap.cdl
new file mode 100755 (executable)
index 0000000..3baf9f1
--- /dev/null
@@ -0,0 +1,96 @@
+-- File:       WOKTools_BasicMap.cdl
+-- Created:    Mon May 29 17:38:59 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+private deferred class BasicMap from WOKTools 
+
+       ---Purpose: Root  class of  all the maps,  provides utilitites
+       -- for managing the buckets.
+
+is
+    Initialize(NbBuckets : Integer; single : Boolean);
+       ---Purpose: Initialize the map.  Single is  True when the  map
+       -- uses only one table of buckets.
+       -- 
+       -- One table  : Map, DataMap
+       -- Two tables : DoubleMap, IndexedMap, IndexedDataMap
+
+    NbBuckets(me) returns Integer
+       ---Purpose: Returns the number of buckets in <me>.
+       ---C++: inline
+    is static;
+
+    Extent(me) returns Integer
+       ---Purpose: Returns the number of keys already stored in <me>.
+       --          
+       ---C++: inline
+    is static;
+    
+    IsEmpty(me) returns Boolean
+       ---Purpose: Returns  True when the map  contains no keys. 
+       -- This is exactly Extent() == 0.
+       ---C++: inline
+    is static;
+    
+    BeginResize(me; 
+               NbBuckets     : Integer; 
+               NewBuckets    : out Integer;
+               data1, data2  : out Address from Standard) 
+    returns Boolean
+       ---Purpose: Tries to resize  the Map with  NbBuckets.  Returns
+       -- True if  possible, NewBuckts is  the  new nuber of
+       -- buckets.   data1 and data2  are the new tables  of
+       -- buckets where the data must be copied.
+    is static protected;
+    
+    EndResize(me : in out; 
+             NbBuckets    : Integer; 
+             NewBuckets   : Integer;
+             data1, data2 : Address from Standard) 
+       ---Purpose: If  BeginResize was  succesfull  after copying the
+       -- data to  data1  and data2 this methods  update the
+       -- tables and destroys the old ones.
+    is static protected;
+    
+    Resizable(me) returns Boolean
+       ---Purpose: Returns   True  if resizing   the   map should  be
+       -- considered.
+       ---C++: inline
+    is static protected;
+    
+    Increment(me : in out) 
+       ---Purpose: Decrement the  extent of the  map.
+       ---C++: inline
+    is static protected;
+    
+    Decrement(me : in out) 
+       ---Purpose: Decrement the  extent of the  map.
+       ---C++: inline
+    is static protected;
+    
+    Index(me; ahascode : Integer from Standard; NbBuckets : Integer from Standard)  returns Integer from Standard
+       ---C++: inline
+    is static protected;
+    
+    Destroy(me : in out)
+       ---Purpose: Destroys the buckets.
+    is static protected;
+    
+    Statistics(me; S : in out OStream)
+       ---Purpose: Prints  on <S> usefull  statistics  about  the map
+       -- <me>.  It  can be used  to test the quality of the hashcoding. 
+    is static;
+       
+fields
+    isDouble    : Boolean from Standard; -- True for double maps
+    mySaturated : Boolean from Standard;
+    myNbBuckets : Integer;
+    mySize      : Integer;
+    myData1     : Address from Standard is protected;
+    myData2     : Address from Standard is protected;
+    
+friends
+    class BasicMapIterator from WOKTools
+end BasicMap;
diff --git a/src/WOKTools/WOKTools_BasicMap.cxx b/src/WOKTools/WOKTools_BasicMap.cxx
new file mode 100755 (executable)
index 0000000..6ed538f
--- /dev/null
@@ -0,0 +1,155 @@
+static const char* sccsid = "@(#)WOKTools_BasicMap.cxx 3.2 95/01/10"; // Do not delete this line. Used by sccs.
+// File:       WOKTools_BasicMap.cxx
+// Created:    Fri Feb 26 17:20:43 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+#include <WOKTools_BasicMap.ixx>
+#include <TCollection.hxx>
+#include <WOKTools_BasicMapIterator.hxx>
+
+#ifdef WNT
+#include <windows.h>
+#else
+#include <unistd.h>
+#include <memory.h>
+#endif
+
+#include <malloc.h>
+
+//=======================================================================
+//function : WOKTools_BasicMap
+//purpose  : 
+//=======================================================================
+
+WOKTools_BasicMap::WOKTools_BasicMap(const Standard_Integer NbBuckets, 
+                                          const Standard_Boolean single) :
+       isDouble(!single),
+       mySaturated(Standard_False),
+       myNbBuckets(NbBuckets),
+       mySize(0),
+       myData1(NULL),
+       myData2(NULL)
+{
+}
+
+
+//=======================================================================
+//function : BeginResize
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean  WOKTools_BasicMap::BeginResize
+  (const Standard_Integer NbBuckets,
+   Standard_Integer& N,
+   Standard_Address& data1,
+   Standard_Address& data2)const 
+{
+  if (mySaturated) return Standard_False;
+  N = TCollection::NextPrimeForMap(NbBuckets);
+  if (N <= myNbBuckets) {
+    if (IsEmpty())
+      N = myNbBuckets;
+    else
+      return Standard_False;
+  }
+  data1 = aStorageManager.Allocate((N+1)*sizeof(void*));
+  memset(data1, 0, (N+1)*sizeof(void*));
+  if (isDouble) {
+    data2 = aStorageManager.Allocate((N+1)*sizeof(void*));
+    memset(data2, 0, (N+1)*sizeof(void*));
+  }
+  else
+    data2 = NULL;
+  return Standard_True;
+}
+
+
+//=======================================================================
+//function : EndResize
+//purpose  : 
+//=======================================================================
+
+void  WOKTools_BasicMap::EndResize(const Standard_Integer NbBuckets,
+                                     const Standard_Integer N,
+                                     const Standard_Address data1,
+                                     const Standard_Address data2)
+{
+  if (myData1)
+    aStorageManager.Free(myData1,(myNbBuckets+1)*sizeof(void*));
+  if (myData2)
+    aStorageManager.Free(myData2,(myNbBuckets+1)*sizeof(void*));
+  myNbBuckets = N;
+  mySaturated = myNbBuckets <= NbBuckets;
+  myData1 = data1;
+  myData2 = data2;
+}
+
+
+//=======================================================================
+//function : Destroy
+//purpose  : 
+//=======================================================================
+
+void  WOKTools_BasicMap::Destroy()
+{
+  mySize = 0;
+  mySaturated = Standard_False;
+  if (myData1)
+    aStorageManager.Free(myData1,(myNbBuckets+1)*sizeof(void*));
+  if (isDouble) {
+    if (myData2)
+      aStorageManager.Free(myData2,(myNbBuckets+1)*sizeof(void*));
+  }
+  myData1 = myData2 = NULL;
+}
+
+
+//=======================================================================
+//function : Statistics
+//purpose  : 
+//=======================================================================
+
+void WOKTools_BasicMap::Statistics(Standard_OStream& S) const
+{
+  S <<"\nMap Statistics\n---------------\n\n";
+  S <<"This Map has "<<myNbBuckets<<" Buckets and "<<mySize<<" Keys\n\n";
+  if (mySaturated) S<<"The maximum number of Buckets is reached\n";
+  
+  if (mySize == 0) return;
+
+  // compute statistics on 1
+  Standard_Integer * sizes = new Standard_Integer [mySize+1];
+  Standard_Integer i,l,nb;
+  WOKTools_MapNode* p;
+  WOKTools_MapNode** data;
+  
+  S << "\nStatistics for the first Key\n";
+  for (i = 0; i <= mySize; i++) sizes[i] = 0;
+  data = (WOKTools_MapNode**) myData1;
+  nb = 0;
+  for (i = 0; i <= myNbBuckets; i++) {
+    l = 0;
+    p = data[i];
+    if (p) nb++;
+    while (p) {
+      l++;
+      p = p->next;
+    }
+    sizes[l]++;
+  }
+
+  // display results
+  l = 0;
+  for (i = 0; i<= mySize; i++) {
+    if (sizes[i] > 0) {
+      l += sizes[i] * i;
+      S << setw(5) << sizes[i] <<" buckets of size "<<i<<"\n";
+    }
+  }
+
+  Standard_Real mean = ((Standard_Real) l) / ((Standard_Real) nb);
+  S<<"\n\nMean of length : "<<mean<<"\n";
+
+  delete [] sizes;
+}
diff --git a/src/WOKTools/WOKTools_BasicMap.lxx b/src/WOKTools/WOKTools_BasicMap.lxx
new file mode 100755 (executable)
index 0000000..a8a46a7
--- /dev/null
@@ -0,0 +1,81 @@
+// File:       WOKTools_BasicMap.lxx
+// Created:    Fri Feb 26 17:02:30 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+#include <MMgt_StorageManager.hxx>
+
+extern Standard_IMPORT MMgt_StorageManager aStorageManager;
+
+
+//=======================================================================
+//function : NbBuckets
+//purpose  : 
+//=======================================================================
+
+inline Standard_Integer WOKTools_BasicMap::NbBuckets() const
+{
+  return myNbBuckets;
+}
+
+//=======================================================================
+//function : Extent
+//purpose  : 
+//=======================================================================
+
+inline Standard_Integer WOKTools_BasicMap::Extent() const
+{
+  return mySize;
+}
+
+//=======================================================================
+//function : IsEmpty
+//purpose  : 
+//=======================================================================
+
+inline Standard_Boolean WOKTools_BasicMap::IsEmpty() const
+{
+  return mySize == 0;
+}
+
+//=======================================================================
+//function : Resizable
+//purpose  : 
+//=======================================================================
+
+inline Standard_Boolean  WOKTools_BasicMap::Resizable()const
+{
+  return IsEmpty() || (!mySaturated && (mySize > myNbBuckets));
+}
+
+//=======================================================================
+//function : Increment
+//purpose  : 
+//=======================================================================
+
+inline void  WOKTools_BasicMap::Increment()
+{
+  mySize++;
+}
+
+
+//=======================================================================
+//function : Index
+//purpose  : 
+//=======================================================================
+inline Standard_Integer WOKTools_BasicMap::Index(const Standard_Integer ahascode, const Standard_Integer NbBuckets) const
+{
+  return (Abs(ahascode)%NbBuckets) + 1;
+}
+
+//=======================================================================
+//function : Decrement
+//purpose  : 
+//=======================================================================
+
+inline void  WOKTools_BasicMap::Decrement()
+{
+  mySize--;
+}
+
+
diff --git a/src/WOKTools/WOKTools_BasicMapIterator.cdl b/src/WOKTools/WOKTools_BasicMapIterator.cdl
new file mode 100755 (executable)
index 0000000..1452441
--- /dev/null
@@ -0,0 +1,55 @@
+-- File:       WOKTools_BasicMapIterator.cdl
+-- Created:    Mon May 29 17:41:11 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+private deferred class BasicMapIterator from WOKTools 
+
+       ---Purpose: This  class  provides    basic   services  for the
+       -- iterators  on Maps. The  iterators  are  inherited
+       -- from this one.
+       -- 
+       -- The  iterator   contains  an   array   of pointers
+       -- (buckets). Each bucket is a  pointer  on a node. A
+       -- node contains a pointer on the next node.
+       -- 
+       -- This class  provides also basic  services for  the
+       -- implementation of Maps.
+
+uses
+    BasicMap from WOKTools
+
+is
+    Initialize;
+       ---Purpose: Creates an empty iterator.
+
+    Initialize(M : BasicMap from WOKTools);
+       ---Purpose: Initialize on the first node in the buckets.
+       
+    Initialize(me : in out; M : BasicMap from WOKTools)
+       ---Purpose: Initialize on the first node in the buckets.
+    is static protected;
+    
+    Reset(me : in out)
+       ---Purpose: Resets the iterator to the first node.
+    is static;
+    
+    More(me) returns Boolean
+       ---Purpose: Returns True if there is a current  element in the
+       --          iterator.
+       ---C++: inline
+    is static;
+    
+    Next(me : in out)
+       ---Purpose: Sets the  iterator   to the  next   node.  If  the
+       -- iterator is empty it will not change.
+    is static;
+
+fields
+       myNbBuckets : Integer;
+        myBuckets   : Address from Standard;
+        myBucket    : Integer;
+        myNode      : Address from Standard is protected;
+
+end BasicMapIterator;
diff --git a/src/WOKTools/WOKTools_BasicMapIterator.cxx b/src/WOKTools/WOKTools_BasicMapIterator.cxx
new file mode 100755 (executable)
index 0000000..d2bd88d
--- /dev/null
@@ -0,0 +1,88 @@
+static const char* sccsid = "@(#)WOKTools_BasicMapIterator.cxx 3.2 95/01/10"; // Do not delete this line. Used by sccs.
+// File:       WOKTools_BasicMapIterator.cxx
+// Created:    Fri Feb 26 15:46:25 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+
+#include <WOKTools_BasicMapIterator.ixx>
+#include <WOKTools_BasicMap.hxx>
+
+//=======================================================================
+//function : WOKTools_BasicMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_BasicMapIterator::WOKTools_BasicMapIterator () :
+       myNbBuckets(0),
+       myBuckets(NULL),
+       myBucket(0),
+       myNode(NULL)
+{}
+
+
+//=======================================================================
+//function : WOKTools_BasicMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_BasicMapIterator::WOKTools_BasicMapIterator 
+  (const WOKTools_BasicMap& M) :
+  myNbBuckets(M.myNbBuckets),
+  myBuckets(M.myData1),
+  myBucket(-1),
+  myNode(NULL)
+{
+  if (!myBuckets) myNbBuckets = -1;
+  Next();
+}
+
+//=======================================================================
+//function : Initialize
+//purpose  : 
+//=======================================================================
+
+void WOKTools_BasicMapIterator::Initialize
+  (const WOKTools_BasicMap& M)
+{
+  myNbBuckets = M.myNbBuckets;
+  myBuckets = M.myData1;
+  myBucket = -1;
+  myNode = NULL;
+  if (!myBuckets) myNbBuckets = -1;
+  Next();
+}
+
+//=======================================================================
+//function : Reset
+//purpose  : 
+//=======================================================================
+
+void WOKTools_BasicMapIterator::Reset()
+{
+  myBucket = -1;
+  myNode = NULL;
+  Next();
+}
+
+//=======================================================================
+//function : Next
+//purpose  : 
+//=======================================================================
+
+void WOKTools_BasicMapIterator::Next()
+{
+  if (!myBuckets) return; 
+
+  if (myNode) {
+    myNode = ((WOKTools_MapNode*) myNode)->next;
+    if (myNode) return;
+  }
+
+  while (!myNode) {
+    myBucket++;
+    if (myBucket > myNbBuckets) return;
+    myNode = ((void**)myBuckets)[myBucket];
+  }
+}
+
diff --git a/src/WOKTools/WOKTools_BasicMapIterator.lxx b/src/WOKTools/WOKTools_BasicMapIterator.lxx
new file mode 100755 (executable)
index 0000000..17f994c
--- /dev/null
@@ -0,0 +1,25 @@
+// File:       WOKTools_BasicMapIterator.lxx
+// Created:    Fri Feb 26 15:48:30 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+#include <stddef.h>
+
+//=======================================================================
+//function : More
+//purpose  : 
+//=======================================================================
+
+inline Standard_Boolean WOKTools_BasicMapIterator::More() const
+{
+  return myNode != NULL;
+}
+
+
+// base class for the nodes
+
+struct WOKTools_MapNode {
+  WOKTools_MapNode(WOKTools_MapNode* n) : next(n) {}
+  WOKTools_MapNode* next;
+};
+
diff --git a/src/WOKTools/WOKTools_CStringHasher.cdl b/src/WOKTools/WOKTools_CStringHasher.cdl
new file mode 100755 (executable)
index 0000000..3c8c3ae
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKTools_CStringHasher.cdl
+-- Created:    Fri Jul 19 16:28:16 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1996
+
+class CStringHasher from WOKTools
+uses
+    CString from Standard
+is
+
+   HashCode(myclass; Key : CString from Standard) returns Integer;
+           ---Level: Public
+       ---Purpose: Returns a HasCode value  for  the  Key <K>  in the
+       -- range 0..Upper.
+       -- Default ::HashCode(K,Upper)
+           
+   IsEqual(myclass; K1, K2 : CString from Standard) returns Boolean;
+       ---Level: Public
+       ---Purpose: Returns True  when the two  keys are the same. Two
+       -- same  keys  must   have  the  same  hashcode,  the
+       -- contrary is not necessary.
+       -- Default K1 == K2
+end;
diff --git a/src/WOKTools/WOKTools_CStringHasher.cxx b/src/WOKTools/WOKTools_CStringHasher.cxx
new file mode 100755 (executable)
index 0000000..69aab51
--- /dev/null
@@ -0,0 +1,47 @@
+// File:       WOKTools_CStringHasher.cxx
+// Created:    Fri Jul 19 16:26:06 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#include <WOKTools_CStringHasher.ixx>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : HashCode
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKTools_CStringHasher::HashCode (const Standard_CString Value)
+{
+
+  if(Value == NULL) return 0;
+  
+  Standard_CString charPtr   = Value;
+  Standard_Integer aHashCode = 0,  alen,  i  = 0,  pos = 0,  count,  *tmphash;
+  Standard_Character tabchar[20];
+  
+  alen = strlen(Value);
+  
+  while(i < alen) {
+    for (count = 0,pos = i;count < sizeof(int); count++) {
+      if (pos + count >= alen)  tabchar[count] = '\0';
+      else tabchar[count] = charPtr[pos + count];
+      i++;
+    }
+    tmphash = (int *)tabchar;   
+    aHashCode = aHashCode ^ *tmphash;
+  }
+  return aHashCode;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : IsEqual
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_CStringHasher::IsEqual(const Standard_CString K1, const Standard_CString K2)
+{
+  if (strcmp(K1, K2) == 0) return(Standard_True);
+  else                     return(Standard_False);
+}
+
diff --git a/src/WOKTools/WOKTools_ChDirValue.cdl b/src/WOKTools/WOKTools_ChDirValue.cdl
new file mode 100755 (executable)
index 0000000..acfad4e
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKTools_ChDirValue.cdl
+-- Created:    Wed Sep 27 17:49:57 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class    ChDirValue  from WOKTools 
+inherits ReturnValue from WOKTools
+
+       ---Purpose: 
+
+uses
+    HAsciiString from TCollection
+is
+
+    Create(apath : HAsciiString from TCollection) returns mutable ChDirValue from WOKTools; 
+    
+    SetPath(me:mutable; apath: HAsciiString from TCollection);
+    Path(me) returns HAsciiString from TCollection;
+
+fields
+    mypath : HAsciiString from TCollection;
+end ChDirValue;
diff --git a/src/WOKTools/WOKTools_ChDirValue.cxx b/src/WOKTools/WOKTools_ChDirValue.cxx
new file mode 100755 (executable)
index 0000000..c32cb31
--- /dev/null
@@ -0,0 +1,24 @@
+// File:       WOKTools_ChDirValue.cxx
+// Created:    Wed Sep 27 18:26:59 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_ChDirValue.ixx>
+
+ WOKTools_ChDirValue::WOKTools_ChDirValue(const Handle(TCollection_HAsciiString)& apath)
+{
+  SetType(WOKTools_ChDir);
+  mypath = apath;
+}
+
+void WOKTools_ChDirValue::SetPath(const Handle(TCollection_HAsciiString)& apath)
+{
+  mypath = apath;
+}
+
+Handle(TCollection_HAsciiString) WOKTools_ChDirValue::Path() const 
+{
+  return mypath;
+}
+
diff --git a/src/WOKTools/WOKTools_CompareOfHAsciiString.cdl b/src/WOKTools/WOKTools_CompareOfHAsciiString.cdl
new file mode 100755 (executable)
index 0000000..c426575
--- /dev/null
@@ -0,0 +1,31 @@
+-- File:       WOKTools_CompareOfHAsciiString.cdl
+-- Created:    Thu Jan 30 17:58:23 1997
+-- Author:     Arnaud BOUZY
+--             <adn@legox.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+
+class CompareOfHAsciiString from WOKTools 
+
+uses HAsciiString from TCollection
+
+is
+
+    Create;
+    
+    IsLower (me; Left, Right: HAsciiString from TCollection)
+       ---Level: Public
+       ---Purpose: returns True if <Left> is lower than <Right>.
+    returns Boolean;
+    
+    IsGreater (me; Left, Right: HAsciiString from TCollection)
+       ---Level: Public
+       ---Purpose: returns True if <Left> is greater than <Right>.
+    returns Boolean;
+
+    IsEqual(me; Left, Right: HAsciiString from TCollection)
+       ---Level: Public
+       ---Purpose: returns True when <Right> and <Left> are equal.
+    returns Boolean;
+
+end CompareOfHAsciiString;
diff --git a/src/WOKTools/WOKTools_CompareOfHAsciiString.cxx b/src/WOKTools/WOKTools_CompareOfHAsciiString.cxx
new file mode 100755 (executable)
index 0000000..61e884d
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright:  Matra-Datavision 1997
+// File:       WOKTools_CompareOfHAsciiString.cxx
+// Created:    Thu Jan 30 18:02:41 1997
+// Author:     Arnaud BOUZY
+//             <adn>
+
+#include <WOKTools_CompareOfHAsciiString.ixx>
+
+WOKTools_CompareOfHAsciiString::WOKTools_CompareOfHAsciiString()
+{
+}
+
+Standard_Boolean WOKTools_CompareOfHAsciiString::IsLower(const Handle(TCollection_HAsciiString)& Left,const Handle(TCollection_HAsciiString)& Right) const
+{
+  return Left->IsLess(Right);
+}
+
+Standard_Boolean WOKTools_CompareOfHAsciiString::IsGreater(const Handle(TCollection_HAsciiString)& Left,const Handle(TCollection_HAsciiString)& Right) const
+{
+  return Left->IsGreater(Right);
+}
+
+Standard_Boolean WOKTools_CompareOfHAsciiString::IsEqual(const Handle(TCollection_HAsciiString)& Left,const Handle(TCollection_HAsciiString)& Right) const
+{
+  return Left->IsSameString(Right);
+}
+
diff --git a/src/WOKTools/WOKTools_DataMap.cdl b/src/WOKTools/WOKTools_DataMap.cdl
new file mode 100755 (executable)
index 0000000..49af10d
--- /dev/null
@@ -0,0 +1,153 @@
+-- File:       WOKTools_DataMap.cdl
+-- Created:    Mon May 29 15:51:42 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+generic class DataMap from WOKTools
+   (TheKey    as any;
+    TheItem   as any;
+    Hasher as any) -- as MapHasher(TheKey)
+inherits BasicMap from WOKTools
+
+       ---Purpose: The DataMap is a Map to store keys with associated
+       -- Items. See Map  from WOKTools for  a discussion
+       -- about the number of buckets.
+       -- 
+       -- The DataMap can be seen as an extended array where
+       -- the Keys  are the   indices.  For this reason  the
+       -- operator () is defined on DataMap to fetch an Item
+       -- from a Key. So the following syntax can be used :
+       -- 
+       -- anItem = aMap(aKey);
+       -- aMap(aKey) = anItem;
+       -- 
+       -- This analogy has its  limit.   aMap(aKey) = anItem
+       -- can  be done only  if aKey was previously bound to
+       -- an item in the map.
+
+raises
+    DomainError  from Standard,
+    NoSuchObject from Standard
+
+    class DataMapIterator inherits BasicMapIterator from WOKTools
+       ---Purpose: Provides iteration on the  content  of a map.  The
+       -- iteration  methods are inherited  from  the BasicMapIterator. 
+       ---Warning: While using an iterator on a map if the content of
+       -- the map  is   modified  during the  iteration  the
+       -- result is unpredictable.
+
+    raises NoSuchObject from Standard  
+    is
+               Create returns DataMapIterator from WOKTools;
+           ---Purpose: Creates an undefined Iterator (empty).
+       
+       Create (aMap : DataMap from WOKTools) 
+       returns DataMapIterator from WOKTools;
+           ---Purpose: Creates an Iterator on the map <aMap>.
+       
+       Initialize(me : in out; aMap : DataMap from WOKTools)
+           ---Level: Public
+           ---Purpose: Resets the Iterator in the map <aMap>.
+       is static;
+       
+       Key(me) returns any TheKey
+           ---Level: Public
+           ---Purpose: Returns the current Key. An error is raised if
+           -- the iterator is empty (More returns False).
+           ---C++: return const &
+       raises
+           NoSuchObject from Standard
+       is static;
+       
+       Value(me) returns any TheItem
+           ---Level: Public
+           ---Purpose: Returns the current Item. An error is raised if
+           -- the iterator is empty (More returns False).
+           ---C++: return const &
+       raises
+           NoSuchObject from Standard
+       is static;
+
+       Hashcode(me) returns Integer from Standard
+       raises
+           NoSuchObject from Standard
+       is static;
+       
+    end DataMapIterator from WOKTools;
+
+is
+    Create(NbBuckets : Integer = 1) returns DataMap from WOKTools;
+       ---Purpose: Creates   a DataMap with  <NbBuckets> buckets. Without
+       -- arguments the map is automatically dimensioned.
+    
+
+    Create(Other : DataMap from WOKTools) returns DataMap from WOKTools
+       ---Purpose: As  copying  Map  is an expensive  operation it is
+       -- incorrect  to  do  it implicitly. This constructor is private and 
+       -- will raise an error if the Map is not empty. 
+       -- To copy the content of a DataMap use the Assign method (operator =).
+    raises DomainError from Standard
+    is private;
+    
+    Assign(me : in out; Other : DataMap from WOKTools) 
+    returns DataMap from WOKTools
+       ---Level: Public
+       ---Purpose: Replace the content of this map by  the content of
+       -- the map <Other>.
+       ---C++: alias operator =
+       ---C++: return &
+    is static;
+    
+    ReSize(me : in out; NbBuckets : Integer)
+       ---Level: Public
+       ---Purpose: Changes the  number    of  buckets of  <me>  to be
+       -- <NbBuckets>. The keys  already  stored in  the map are kept.
+    is static;
+    
+    Clear(me : in out)
+       ---Level: Public
+       ---Purpose: Removes all keys in the map.
+       ---C++: alias ~
+    is static;
+    
+    Bind(me : in out; K : TheKey; I : TheItem) returns Boolean
+       ---Level: Public
+       ---Purpose: Adds the Key <K> to  the Map <me>  with  the  Item
+       -- <I>.  Returns True  if the Key  was not already in
+       -- the  Map.  If the  Key was already in the  Map the
+       -- Item in the Map is not replaced.
+    is static;
+
+    IsBound(me; K : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True if the key <K>  is stored  in the map <me>. 
+    is static;
+    
+    UnBind(me : in out; K : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Removes the Key <K> from the  map. Returns True if
+       -- the Key was in the Map.
+    is static;
+    
+    Find(me; K : TheKey) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns  the Item stored  with the Key  <K> in the Map. 
+        ---Trigger: An exception is raised when <K> is not in the map.
+    raises NoSuchObject from Standard  
+       ---C++: alias operator()
+       ---C++: return const &
+    is static;
+    
+    ChangeFind(me : in out; K : TheKey) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns the  Item stored with  the Key  <K> in the
+       -- Map. This Item can be   modified with  the  syntax
+       -- aMap(K) = newItem; 
+        ---Trigger: An exception is raised when <K> is not in the map.
+       ---C++: alias operator()
+       ---C++: return &
+    raises NoSuchObject from Standard 
+    is static;
+    
+end DataMap;
diff --git a/src/WOKTools/WOKTools_DataMap.gxx b/src/WOKTools/WOKTools_DataMap.gxx
new file mode 100755 (executable)
index 0000000..d70781b
--- /dev/null
@@ -0,0 +1,329 @@
+// File:       WOKTools_DataMap.gxx
+// Created:    Fri Jan  8 16:33:21 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+
+#include <Standard_DomainError.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+// Node definition and nodes storage management
+
+#if (defined IRIX || defined WNT)
+
+template <class Item, class Key> class DataMapNode  : public WOKTools_MapNode {
+  public :
+    DataMapNode(const Key& K, const Standard_Integer ahascode, const Item& I, DataMapNode* n) :
+      WOKTools_MapNode(n), key(K), hashcode(ahascode) { value = I; }
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  Key           key;
+  Standard_Integer hashcode;
+  Item          value;
+};
+
+#define Node DataMapNode<TheItem,TheKey>
+
+#else
+
+class Node  : public WOKTools_MapNode {
+  public :
+    Node(const TheKey& K, const Standard_Integer ahascode, const TheItem& I, Node* n) :
+      WOKTools_MapNode(n), key(K), hashcode(ahascode) { value = I; }
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  TheKey           key;
+  Standard_Integer hashcode;
+  TheItem          value;
+};
+
+#endif
+
+//=======================================================================
+//function : WOKTools_DataMap
+//purpose  : 
+//=======================================================================
+
+WOKTools_DataMap::WOKTools_DataMap(const Standard_Integer NbBuckets) :
+       WOKTools_BasicMap(NbBuckets,Standard_True)
+{
+}
+
+//=======================================================================
+//function : WOKTools_DataMap
+//purpose  : 
+//=======================================================================
+
+WOKTools_DataMap::WOKTools_DataMap(const WOKTools_DataMap& Other) :
+       WOKTools_BasicMap(Other.NbBuckets(),Standard_True)
+{
+  if (!Other.IsEmpty())
+    Standard_DomainError::Raise("WOKTools:Copy of DataMap");
+}
+
+//=======================================================================
+//function : Assign
+//purpose  : 
+//=======================================================================
+
+WOKTools_DataMap& WOKTools_DataMap::Assign
+  (const WOKTools_DataMap& Other)
+{
+  // very simple implementation
+  // optimal (does not recompute the hashcode values)
+
+  if (this == &Other) return *this;
+  Clear();
+  ReSize(Other.NbBuckets());
+  Node** data = (Node**)myData1;
+  for (WOKTools_DataMapIterator It(Other); It.More(); It.Next()) {
+    int hashcode = It.Hashcode();
+    int k = Index(hashcode,NbBuckets());
+    Node* p = data[k];
+    while (p) {
+      if (hashcode == p->hashcode) {
+       if (Hasher::IsEqual(p->key,It.Key())) {
+         p->value = It.Value();
+         break;
+       }
+      }
+      p = (Node*) p->next;
+    }
+    Increment();
+    data[k] = new Node(It.Key(),hashcode,It.Value(),data[k]);
+  }
+  return *this;
+}
+
+
+//=======================================================================
+//function : ReSize
+//purpose  : 
+//=======================================================================
+void WOKTools_DataMap::ReSize(const Standard_Integer N)
+{
+  Node** newdata;
+  Node** dummy;
+  int newBuck;
+  if (BeginResize(N,newBuck,
+                 *(void **)&newdata,*(void **)&dummy)) {
+    if (myData1) {
+      Node** olddata = (Node**) myData1;
+      Node *p, *q;
+      int i,k;
+      for (i = 0; i <= NbBuckets(); i++) {
+       if (olddata[i]) {
+         p = olddata[i];
+         while (p) {
+           k = Index(p->hashcode,newBuck);
+           q = (Node*)  p->next;
+           p->next = newdata[k];
+           newdata[k] = p;
+           p = q;
+         }
+       }
+      }
+    }
+    EndResize(N,newBuck,newdata,dummy);
+  }
+}
+
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DataMap::Clear()
+{
+  if (IsEmpty() == Standard_False) {
+    int i;
+    Node** data = (Node**) myData1;
+    Node *p,*q;
+    for (i = 0; i <= NbBuckets(); i++) {
+      if (data[i]) {
+       p = data[i];
+       while (p) {
+         q = (Node*) p->next;
+         delete p;
+         p = q;
+       }
+      }
+    }
+  }
+  WOKTools_BasicMap::Destroy();
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_DataMap::Bind(const TheKey& K, const TheItem& I)
+{
+  if (Resizable()) ReSize(Extent());
+  Node** data = (Node**)myData1;
+  int hashcode = Hasher::HashCode(K);
+  int k = Index(hashcode,NbBuckets());
+  Node* p = data[k];
+  while (p) {
+    if (hashcode == p->hashcode) {
+      if (Hasher::IsEqual(p->key,K)) {
+       p->value = I;
+       return Standard_False;
+      }
+    }
+    p = (Node*) p->next;
+  }
+  Increment();
+  data[k] = new Node(K,hashcode,I,data[k]);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Contains
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_DataMap::IsBound(const TheKey& K) const
+{
+  if (IsEmpty()==Standard_True) return Standard_False;
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  Node* p = data[Index(hashcode,NbBuckets())];
+  while (p) {
+    if ( hashcode == p->hashcode ) {
+      if (Hasher::IsEqual(p->key,K)) {
+       return Standard_True;
+      }
+    }
+    p = (Node*) p->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Remove
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DataMap::UnBind(const TheKey& K)
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  int k = Index(hashcode, NbBuckets());
+  Node* p = data[k];
+  Node* q = NULL;
+  while (p) {
+    if ( hashcode == p->hashcode ) {
+      if (Hasher::IsEqual(p->key,K)) {
+       Decrement();
+       if (q) q->next = p->next;
+       else   data[k] = (Node*) p->next;
+       delete p;
+       return Standard_True;
+      }
+    }
+    q = p;
+    p = (Node*) p->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Find
+//purpose  : 
+//=======================================================================
+const TheItem& WOKTools_DataMap::Find(const TheKey& K) const
+{
+  Standard_NoSuchObject_Raise_if(IsEmpty(),"WOKTools_DataMap::Find");
+  
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  Node* p = data[Index(hashcode, NbBuckets())];
+  while (p) {
+    if(hashcode == p->hashcode) {
+      if (Hasher::IsEqual(p->key,K)) {
+       return p->value;
+      }
+    }
+    p = (Node*) p->next;
+  }
+  Standard_NoSuchObject::Raise("WOKTools_DataMap::Find");
+  return p->value;
+}
+
+//=======================================================================
+//function : ChangeFind
+//purpose  : 
+//=======================================================================
+TheItem& WOKTools_DataMap::ChangeFind(const TheKey& K)
+{
+  Standard_NoSuchObject_Raise_if(IsEmpty(),"WOKTools_DataMap::ChangeFind");
+  
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  Node* p = data[Index(hashcode, NbBuckets())];
+  while (p) {
+    if ( hashcode == p->hashcode ) {
+      if (Hasher::IsEqual(p->key,K)) {
+       return p->value;
+      }
+    }
+    p = (Node*)  p->next;
+  }
+  Standard_NoSuchObject::Raise("WOKTools_DataMap::ChangeFind");
+  return p->value;
+}
+
+
+
+
+
+// method of the iterator
+
+//=======================================================================
+//function : Key
+//purpose  : 
+//=======================================================================
+
+const TheKey& WOKTools_DataMapIterator::Key() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_DataMapIterator::Key");  
+  return ((Node*) myNode)->key;
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+const TheItem& WOKTools_DataMapIterator::Value() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_DataMapIterator::Value");  
+  return ((Node*) myNode)->value;
+}
+
+
+//=======================================================================
+//function : Hashcode
+//purpose  : 
+//=======================================================================
+ Standard_Integer WOKTools_DataMapIterator::Hashcode() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_DataMapIterator::Value");  
+  return ((Node*) myNode)->hashcode;
+}
+
+#ifdef Node
+#undef Node
+#endif
+
diff --git a/src/WOKTools/WOKTools_DataMapIterator.gxx b/src/WOKTools/WOKTools_DataMapIterator.gxx
new file mode 100755 (executable)
index 0000000..4a1c63e
--- /dev/null
@@ -0,0 +1,34 @@
+// File:       WOKTools_DataMapIterator.gxx
+// Created:    Fri Feb 26 19:21:18 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+
+//=======================================================================
+//function : WOKTools_DataMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_DataMapIterator::WOKTools_DataMapIterator() :
+       WOKTools_BasicMapIterator()
+{}
+
+//=======================================================================
+//function : WOKTools_DataMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_DataMapIterator::WOKTools_DataMapIterator(const WOKTools_DataMap& aMap) :
+       WOKTools_BasicMapIterator(aMap)
+{}
+
+//=======================================================================
+//function : WOKTools_DataMapIterator
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DataMapIterator::Initialize(const WOKTools_DataMap& aMap)
+{
+  WOKTools_BasicMapIterator::Initialize(aMap);
+}
+
diff --git a/src/WOKTools/WOKTools_Define.cdl b/src/WOKTools/WOKTools_Define.cdl
new file mode 100755 (executable)
index 0000000..9c927dc
--- /dev/null
@@ -0,0 +1,37 @@
+-- File:       WOKTools_Define.cdl
+-- Created:    Fri Nov 24 14:41:27 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Define from WOKTools 
+
+       ---Purpose: 
+
+uses
+    HAsciiString from TCollection
+    
+is
+    Create returns Define from WOKTools;
+
+    Create(aname, avalue : HAsciiString from TCollection) 
+       returns Define from WOKTools;
+
+    GetDefineIn(me:out; aline : HAsciiString from TCollection);
+    AddValue(me:out; aline : HAsciiString from TCollection);
+    IsValueValid(me; avalue : HAsciiString from TCollection)
+       returns Boolean from Standard;
+
+    Name(me) returns HAsciiString from TCollection;
+    Value(me) returns HAsciiString from TCollection;
+
+    SetName(me:out; aname : HAsciiString from TCollection);
+    SetValue(me:out; avalue : HAsciiString from TCollection);
+
+fields
+    
+    myname  : HAsciiString from TCollection;
+    myvalue : HAsciiString from TCollection;
+
+end Define;
diff --git a/src/WOKTools/WOKTools_Define.cxx b/src/WOKTools/WOKTools_Define.cxx
new file mode 100755 (executable)
index 0000000..52aa7cc
--- /dev/null
@@ -0,0 +1,151 @@
+// File:       WOKTools_Define.cxx
+// Created:    Fri Nov 24 14:55:54 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_Define.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <Standard_ProgramError.hxx>
+
+//=======================================================================
+//function : WOKTools_Define
+//purpose  : 
+//=======================================================================
+ WOKTools_Define::WOKTools_Define()
+{}
+
+//=======================================================================
+//function : WOKTools_Define
+//purpose  : 
+//=======================================================================
+ WOKTools_Define::WOKTools_Define(const Handle(TCollection_HAsciiString)& aname, 
+                                 const Handle(TCollection_HAsciiString)& avalue)
+: myname(aname), myvalue(avalue)
+{
+}
+
+//=======================================================================
+//function : GetDefineIn
+//purpose  : 
+//=======================================================================
+void WOKTools_Define::GetDefineIn(const Handle(TCollection_HAsciiString)& aline)
+{
+    // recherche du premier = de la ligne
+  Standard_Integer apos = aline->Location(1, '=', 1, aline->Length());
+  
+  if( apos == 0 )
+    {
+      // il n'y a pas de = dans la ligne
+      ErrorMsg << "WOKTools_Define::GetDefineIn" << "Missing = in line : " << aline << endm;
+      Standard_ProgramError::Raise("WOKTools_Define::GetDefineIn");
+    }
+
+  if( apos == 1 )
+    {
+      // il n'y a pas de nom du parametre dans la ligne
+      ErrorMsg << "WOKTools_Define::GetDefineIn" << "Missing parameter name in line : " << aline << endm;
+      Standard_ProgramError::Raise("WOKTools_Define::GetDefineIn");
+    }  
+  // evaluation de du nom
+  myname = aline->SubString(1, apos-1);
+  myname->LeftAdjust();
+  myname->RightAdjust();
+  
+  // evaluation de la valeur
+  if(apos < aline->Length())
+    {
+      myvalue = new TCollection_HAsciiString(aline->SubString(apos+1, aline->Length()));
+
+      if(!IsValueValid(myvalue))
+         Standard_ProgramError::Raise("WOKTools_Define::GetDefineIn");
+    }
+  else
+    {
+      myvalue = new TCollection_HAsciiString;
+    }
+  myvalue->LeftAdjust();
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_Define::Name() const 
+{
+  return myname;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_Define::Value() const 
+{
+  return myvalue;
+}
+
+//=======================================================================
+//function : SetName
+//purpose  : 
+//=======================================================================
+void WOKTools_Define::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+  myname = aname;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Define::SetValue(const Handle(TCollection_HAsciiString)& avalue)
+{
+  myvalue = avalue;
+}
+
+//=======================================================================
+//function : AddValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Define::AddValue(const Handle(TCollection_HAsciiString)& aline)
+{
+  // evaluation d'une autre valeur de l'item
+
+  Handle(TCollection_HAsciiString) othervalue = new TCollection_HAsciiString(aline);
+  if(!IsValueValid(othervalue))
+    Standard_ProgramError::Raise("WOKTools_Define::AddValue");
+
+  othervalue->LeftAdjust();
+
+  myvalue->AssignCat(" ");
+  myvalue->AssignCat(othervalue);
+}
+
+//=======================================================================
+//function : IsValueValid
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Define::IsValueValid(const Handle(TCollection_HAsciiString)& avalue) const
+{
+  Standard_Integer   i;
+  Standard_Character c;
+  Standard_Boolean   valid = Standard_True;
+  
+  for (i=1; i<= avalue->Length() && valid; i++)
+    {
+      c = avalue->Value(i);
+      if (IsEqual(c,'~') || IsEqual(c,'*'))
+       valid = Standard_False;
+    }
+  
+  if(!valid)
+    {
+      ErrorMsg << "WOKTools_Define::IsValueValid" 
+              << "Parameter value with ~ or * in : " << avalue << " is illegal" << endm;
+    }
+  return valid;
+}
diff --git a/src/WOKTools/WOKTools_DoubleMap.cdl b/src/WOKTools/WOKTools_DoubleMap.cdl
new file mode 100755 (executable)
index 0000000..b52c473
--- /dev/null
@@ -0,0 +1,161 @@
+-- File:       WOKTools_DoubleMap.cdl
+-- Created:    Thu Jun 29 14:40:21 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+generic class DoubleMap from WOKTools (TheKey1    as any;
+                                         TheKey2    as any;
+                                         Hasher1 as any; -- as MapHasher(TheKey1)
+                                         Hasher2 as any) -- as MapHasher(TheKey2)
+inherits BasicMap from WOKTools
+
+       ---Purpose: The DoubleMap  is used to  bind  pairs (Key1,Key2)
+       -- and retrieve them in linear time.
+       -- 
+       -- See Map from WOKTools for a discussion about the number of buckets.
+       
+raises
+    DomainError     from Standard,
+    MultiplyDefined from Standard,
+    NoSuchObject    from Standard
+
+    class DoubleMapIterator inherits BasicMapIterator from WOKTools
+    
+       ---Purpose: Provides iteration on the  content  of a map.
+       -- The iteration methods are inherited from  the BasicMapIterator. 
+       --          
+       ---Warning: While using an iterator on a map if the content of
+       -- the map is modified during the iteration the result is 
+       -- unpredictable.
+       
+    raises NoSuchObject from Standard  
+    is
+               Create returns DoubleMapIterator from WOKTools;
+           ---Purpose: Creates an undefined Iterator (empty).
+       
+       Create (aMap : DoubleMap from WOKTools) 
+       returns DoubleMapIterator from WOKTools;
+           ---Purpose: Creates an Iterator on the map <aMap>.
+       
+       Initialize(me : in out; aMap : DoubleMap from WOKTools)
+           ---Level: Public
+           ---Purpose: Resets the Iterator in the map <aMap>.
+       is static;
+       
+       Key1(me) returns any TheKey1
+           ---Level: Public
+           ---Purpose: Returns the current Key1. An error is raised if
+           -- the iterator is empty (More returns False).
+           ---C++: return const &
+       raises
+           NoSuchObject from Standard
+       is static;
+       
+       Key2(me) returns any TheKey2
+           ---Level: Public
+           ---Purpose: Returns the current Key2. An error is raised if
+           -- the iterator is empty (More returns False).
+           ---C++: return const &
+       raises
+           NoSuchObject from Standard
+       is static;
+       
+               Hashcode1(me) returns Integer from Standard
+       raises
+           NoSuchObject from Standard
+       is static;
+       
+       Hashcode2(me) returns Integer from Standard
+       raises
+           NoSuchObject from Standard
+       is static;
+
+    end DoubleMapIterator from WOKTools;
+
+is
+
+    Create(NbBuckets : Integer = 1) returns DoubleMap from WOKTools;
+       ---Purpose: Creates   a DoubleMap with  <NbBuckets> buckets. Without
+       -- arguments the map is automatically dimensioned.
+    
+
+    Create(Other : DoubleMap from WOKTools) 
+    returns DoubleMap from WOKTools
+       ---Purpose: As  copying  Map  is an expensive  operation it is
+       -- incorrect  to  do  it implicitly. This constructor is private and 
+       -- will raise an  error if the Map  is not  empty. To copy the
+       -- content of a  Map use the  Assign  method (operator =).
+    raises DomainError from Standard
+    is private;
+    
+    Assign(me : in out; Other : DoubleMap from WOKTools) 
+    returns DoubleMap from WOKTools
+       ---Level: Public
+       ---Purpose: Replace the content of this map by  the content of
+       -- the map <Other>.
+       ---C++: alias operator =
+       ---C++: return &
+    is static;
+    
+    ReSize(me : in out; NbBuckets : Integer)
+       ---Level: Public
+       ---Purpose: Changes the  number    of  buckets of  <me>  to be
+       -- <NbBuckets>. The keys  already  stored in  the map are kept.
+    is static;
+    
+    Clear(me : in out)
+       ---Level: Public
+       ---Purpose: Removes all keys from the map.
+       ---C++: alias ~
+    is static;
+    
+    Bind(me : in out; K1 : TheKey1; K2 : TheKey2)
+       ---Level: Public
+       ---Purpose: Adds the pair <K1>,<K2> to the map.
+       ---Trigger: An exception is raised if K1 or K2 are already bound.          
+    raises MultiplyDefined from Standard 
+    is static;
+    
+    AreBound(me; K1 : TheKey1; K2 : TheKey2) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True if <K1>  and  <K2>  are bound to each other. 
+    is static;
+
+    IsBound1(me; K : TheKey1) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns  True if the  TheKey <K> is  bound in the map <me>.
+    is static;
+    
+    IsBound2(me; K : TheKey2) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True if  the key <K> is bound in the map <me>.
+    is static;
+    
+    Find1(me; K : TheKey1) returns any TheKey2
+       ---Level: Public
+       ---Purpose: Returns the Key2 bound to <K> in the map.
+       ---C++: return const &
+    raises NoSuchObject
+    is static;
+    
+    Find2(me; K : TheKey2) returns any TheKey1
+       ---Level: Public
+       ---Purpose: Returns the Key1 bound to <K> in the map.
+       ---C++: return const &
+    raises NoSuchObject
+    is static;
+    
+    UnBind1(me : in out; K : TheKey1) returns Boolean
+       ---Level: Public
+       ---Purpose: Unbind the Key <K>  from the map.  Returns True if
+       -- the Key was bound in the Map.
+    is static;
+    
+    UnBind2(me : in out; K : TheKey2) returns Boolean
+       ---Level: Public
+       ---Purpose: Unbind the Key <K>  from the map.  Returns True if
+       -- the Key was bound in the Map.
+    is static;
+    
+end DoubleMap;
diff --git a/src/WOKTools/WOKTools_DoubleMap.gxx b/src/WOKTools/WOKTools_DoubleMap.gxx
new file mode 100755 (executable)
index 0000000..32dae29
--- /dev/null
@@ -0,0 +1,502 @@
+// File:       WOKTools_DoubleMap.gxx
+// Created:    Thu Jun 29 16:09:33 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <Standard_DomainError.hxx>
+#include <Standard_MultiplyDefined.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+// Node definition and nodes storage management
+
+#if (defined IRIX || defined WNT)
+
+template <class Key1, class Key2> class DoubleMapNode : public WOKTools_MapNode{
+  public :
+    Node(const Key1& K1, const Standard_Integer acode1, const Key2& K2, const Standard_Integer acode2, DoubleMapNode* n1, DoubleMapNode* n2) :
+      WOKTools_MapNode(n1),key1(K1),hashcode1(acode1), key2(K2), hashcode2(acode2), next2(n2) {}
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  Key1   key1;
+  Standard_Integer hashcode1;
+  Key2   key2;
+  Standard_Integer hashcode2;
+  DoubleMapNode*  next2;
+};
+
+#define Node DoubleMapNode<TheKey1,TheKey2>
+
+#else
+
+class Node : public WOKTools_MapNode{
+  public :
+    Node(const TheKey1& K1, const Standard_Integer acode1, const TheKey2& K2, const Standard_Integer acode2, Node* n1, Node* n2) :
+      WOKTools_MapNode(n1),key1(K1),hashcode1(acode1), key2(K2), hashcode2(acode2), next2(n2) {}
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  TheKey1   key1;
+  Standard_Integer hashcode1;
+  TheKey2   key2;
+  Standard_Integer hashcode2;
+  Node*  next2;
+};
+
+#endif
+
+//=======================================================================
+//function : WOKTools_DoubleMap
+//purpose  : 
+//=======================================================================
+
+WOKTools_DoubleMap::WOKTools_DoubleMap(const Standard_Integer NbBuckets):
+       WOKTools_BasicMap(NbBuckets,Standard_False)
+{
+}
+
+//=======================================================================
+//function : WOKTools_DoubleMap
+//purpose  : 
+//=======================================================================
+
+WOKTools_DoubleMap::WOKTools_DoubleMap
+  (const WOKTools_DoubleMap& Other) :
+       WOKTools_BasicMap(Other.NbBuckets(),Standard_False)
+{
+  if (Other.Extent() != 0)
+    Standard_DomainError::Raise("WOKTools:Copy of DoubleMap");
+}
+
+//=======================================================================
+//function : Assign
+//purpose  : 
+//=======================================================================
+
+WOKTools_DoubleMap& WOKTools_DoubleMap::Assign
+  (const WOKTools_DoubleMap& Other)
+{
+  if (this == &Other) return *this;
+  Clear();
+  ReSize(Other.NbBuckets());
+  Node** data1 = (Node**)myData1;
+  Node** data2 = (Node**)myData2;
+  for (WOKTools_DoubleMapIterator It(Other); It.More(); It.Next()) {
+    int hashcode1 = It.Hashcode1();
+    int k1 = Index(hashcode1,NbBuckets());
+    int hashcode2 = It.Hashcode2();
+    int k2 = Index(hashcode2,NbBuckets());
+
+    Node* p;
+    p = data1[k1];
+    while (p) {
+      if ( hashcode1 == p->hashcode1 ) {
+       if (Hasher1::IsEqual(p->key1,It.Key1())) 
+         Standard_MultiplyDefined::Raise("DoubleMap:Assign");
+      }
+      p = (Node*) p->next;
+    }
+    p = data2[k2];
+    while (p) {
+      if ( hashcode2 == p->hashcode2 ) {
+       if (Hasher2::IsEqual(p->key2,It.Key2())) 
+         Standard_MultiplyDefined::Raise("DoubleMap:Assign");
+      }
+      p = p->next2;
+    }
+    p = new Node(It.Key1(),hashcode1, It.Key2(),hashcode2, data1[k1],data2[k2]);
+    data1[k1] = p;
+    data2[k2] = p;
+    
+    Increment();
+  }
+  
+  return *this;
+}
+
+
+//=======================================================================
+//function : ReSize
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DoubleMap::ReSize(const Standard_Integer N)
+{
+  Node** newdata1;
+  Node** newdata2;
+  Standard_Integer newBuck;
+  if (BeginResize(N,newBuck,
+                 *(Standard_Address*)&newdata1,
+                 *(Standard_Address*)&newdata2)) {
+    Node *p, *q;
+    Standard_Integer i,k1,k2;
+    if (myData1) {
+      Node** olddata1 = (Node**) myData1;
+      for (i = 0; i <= NbBuckets(); i++) {
+       if (olddata1[i]) {
+         p = olddata1[i];
+         while (p) {
+           k1 = Index(p->hashcode1, newBuck);
+           k2 = Index(p->hashcode2, newBuck);
+           q = (Node*) p->next;
+           p->next = newdata1[k1];
+           p->next2 = newdata2[k2];
+           newdata1[k1] = p;
+           newdata2[k2] = p;
+           p = q;
+         }
+       }
+      }
+    }
+    EndResize(N,newBuck,newdata1,newdata2);
+  }
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DoubleMap::Clear()
+{
+  if (!IsEmpty()) {
+    Standard_Integer i;
+    Node** data1 = (Node**) myData1;
+    Node** data2 = (Node**) myData2;
+    Node *p,*q;
+    for (i = 0; i <= NbBuckets(); i++) {
+      p = data1[i];
+      while (p) {
+       q = (Node*) p->next;
+       delete p;
+       p = q;
+      }
+    }
+  }
+  WOKTools_BasicMap::Destroy();
+}
+
+//=======================================================================
+//function : Bind
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DoubleMap::Bind(const TheKey1& K1, const TheKey2& K2)
+{
+  if (Resizable()) ReSize(Extent());
+  Node** data1 = (Node**)myData1;
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode1 = Hasher1::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode1, NbBuckets());
+  Standard_Integer hashcode2 = Hasher2::HashCode(K2);
+  Standard_Integer k2 = Index(hashcode2, NbBuckets());
+  Node* p;
+  p = data1[k1];
+  while (p) {
+    if ( hashcode1 == p->hashcode1 ) {
+      if (Hasher1::IsEqual(p->key1,K1)) 
+       Standard_MultiplyDefined::Raise("DoubleMap:Bind");
+    }
+    p = (Node*) p->next;
+  }
+  p = data2[k2];
+  while (p) {
+    if ( hashcode2 == p->hashcode2 ) {
+      if (Hasher2::IsEqual(p->key2,K2)) 
+       Standard_MultiplyDefined::Raise("DoubleMap:Bind");
+    }
+    p = p->next2;
+  }
+  p = new Node(K1,hashcode1, K2,hashcode2, data1[k1],data2[k2]);
+  data1[k1] = p;
+  data2[k2] = p;
+  Increment();
+}
+
+//=======================================================================
+//function : AreBound
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DoubleMap::AreBound(const TheKey1& K1, 
+                                                const TheKey2& K2) const
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode1 = Hasher1::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode1, NbBuckets());
+  Standard_Integer hashcode2 = Hasher2::HashCode(K2);
+  Standard_Integer k2 = Index(hashcode2, NbBuckets());
+  Node *p1, *p2;
+  p1 = data1[k1];
+  while (p1) {
+    if ( hashcode1 == p1->hashcode1 ) {
+      if (Hasher1::IsEqual(p1->key1,K1)) break;
+    }
+    p1 = (Node*) p1->next;
+  }
+  if (p1 == NULL) return Standard_False;
+  p2 = data2[k2];
+  while (p2) {
+    if ( hashcode2 == p2->hashcode2 ) {
+      if (Hasher2::IsEqual(p2->key2,K2)) break;
+    }
+    p2 = p2->next2;
+  }
+  if (p2 == NULL) return Standard_False;
+  return p1 == p2;
+}
+
+//=======================================================================
+//function : IsBound1
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DoubleMap::IsBound1(const TheKey1& K1) const
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode1 = Hasher1::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode1, NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if ( hashcode1 == p1->hashcode1 ) {
+      if (Hasher1::IsEqual(p1->key1,K1)) return Standard_True;
+    }
+    p1 = (Node*)  p1->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : IsBound2
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DoubleMap::IsBound2(const TheKey2& K2) const
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode2 = Hasher2::HashCode(K2);
+  Standard_Integer k2 = Index(hashcode2, NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if ( hashcode2 == p2->hashcode2 ) {
+      if (Hasher2::IsEqual(p2->key2,K2)) return Standard_True;
+    }
+    p2 = p2->next2;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Find1
+//purpose  : 
+//=======================================================================
+
+const TheKey2& WOKTools_DoubleMap::Find1(const TheKey1& K1) const
+{
+  Standard_NoSuchObject_Raise_if(IsEmpty(),"WOKTools_DoubleMap::Find1");  
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode1 = Hasher1::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode1, NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if ( hashcode1 == p1->hashcode1 ) {
+      if (Hasher1::IsEqual(p1->key1,K1)) return p1->key2;
+    }
+    p1 = (Node*) p1->next;
+  }
+  Standard_NoSuchObject::Raise("WOKTools_DoubleMap::Find1");
+  return p1->key2;
+}
+
+//=======================================================================
+//function : Find2
+//purpose  : 
+//=======================================================================
+
+const TheKey1& WOKTools_DoubleMap::Find2(const TheKey2& K2) const
+{
+  Standard_NoSuchObject_Raise_if(IsEmpty(),"WOKTools_DoubleMap::Find2");  
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode2 = Hasher2::HashCode(K2);
+  Standard_Integer k2 = Index(hashcode2, NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if ( hashcode2 == p2->hashcode2 ) {
+      if (Hasher2::IsEqual(p2->key2,K2)) return p2->key1;
+    }
+    p2 = p2->next2;
+  }
+  Standard_NoSuchObject::Raise("WOKTools_DoubleMap::Find2");
+  return p2->key1;
+}
+
+//=======================================================================
+//function : UnBind1
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DoubleMap::UnBind1(const TheKey1& K1)
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode1 = Hasher1::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode1, NbBuckets());
+  Standard_Integer k2;
+  Node *p1, *p2, *q1, *q2;
+  q1 = q2 = NULL;
+  p1 = data1[k1];
+  while (p1) {
+    if (hashcode1 == p1->hashcode1) {
+      if (Hasher1::IsEqual(p1->key1,K1)) {
+       // remove from the first
+       if (q1)
+         q1->next = p1->next;
+       else
+         data1[k1] = (Node*) p1->next;
+       // remove from the second
+       Standard_Integer hashcode2 = Hasher2::HashCode(p1->key2);
+       Standard_Integer k2 = Index(hashcode2, NbBuckets());
+       p2 = data2[k2];
+       while (p2) {
+         if (p2 == p1) {
+           if (q2)
+             q2->next2 = p2->next2;
+           else
+             data2[k2] = p2->next2;
+           break;
+         }
+         q2 = p2;
+         p2 = p2->next2;
+       }
+       delete p1;
+       Decrement();
+       return Standard_True;
+      }
+    }
+    q1 = p1;
+    p1 = (Node*) p1->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : UnBind2
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_DoubleMap::UnBind2(const TheKey2& K2)
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Node** data2 = (Node**)myData2;
+  Standard_Integer hashcode2 = Hasher2::HashCode(K2);
+  Standard_Integer k2 = Index(hashcode2, NbBuckets());
+  Standard_Integer k1;
+  Node *p1, *p2, *q1, *q2;
+  q1 = q2 = NULL;
+  p2 = data2[k2];
+  while (p2) {
+    if (hashcode2 == p2->hashcode2) {
+      if (Hasher2::IsEqual(p2->key2,K2)) {
+       // remove from the second
+       if (q2)
+         q2->next2 = p2->next2;
+       else
+         data2[k2] = p2->next2;
+       // remove from the first
+       Standard_Integer hashcode1 = Hasher1::HashCode(p2->key1);
+       Standard_Integer k1 = Index(hashcode1, NbBuckets());
+       p1 = data1[k1];
+       while (p1) {
+         if (p2 == p1) {
+           if (q1)
+             q1->next = p1->next;
+           else
+             data1[k1] = (Node*) p1->next;
+           break;
+         }
+         q1 = p1;
+         p1 = (Node*)  p1->next;
+       }
+       delete p2;
+       Decrement();
+       return Standard_True;
+      }
+    }
+    q2 = p2;
+    p2 = p2->next2;
+  }
+  return Standard_False;
+}
+
+// method of the iterator
+
+//=======================================================================
+//function : Key1
+//purpose  : 
+//=======================================================================
+
+const TheKey1& WOKTools_DoubleMapIterator::Key1() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_DoubleMapIterator::Key1");  
+  return ((Node*) myNode)->key1;
+}
+
+//=======================================================================
+//function : Key2
+//purpose  : 
+//=======================================================================
+
+const TheKey2& WOKTools_DoubleMapIterator::Key2() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_DoubleMapIterator::Key2");  
+  return ((Node*) myNode)->key2;
+}
+
+
+// method of the iterator
+
+//=======================================================================
+//function : Hashcode1
+//purpose  : 
+//=======================================================================
+
+Standard_Integer WOKTools_DoubleMapIterator::Hashcode1() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_MapIterator::HashCode1");  
+  return ((Node*) myNode)->hashcode1;
+}
+
+
+//=======================================================================
+//function : Hashcode2
+//purpose  : 
+//=======================================================================
+
+Standard_Integer WOKTools_DoubleMapIterator::Hashcode2() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_MapIterator::HashCode2");  
+  return ((Node*) myNode)->hashcode2;
+}
+
+
+#ifdef Node
+#undef Node
+#endif
+
diff --git a/src/WOKTools/WOKTools_DoubleMapIterator.gxx b/src/WOKTools/WOKTools_DoubleMapIterator.gxx
new file mode 100755 (executable)
index 0000000..ed4eb57
--- /dev/null
@@ -0,0 +1,33 @@
+// File:       WOKTools_DoubleMapIterator.gxx
+// Created:    Thu Jun 29 16:11:03 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+//=======================================================================
+//function : WOKTools_DoubleMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_DoubleMapIterator::WOKTools_DoubleMapIterator() :
+       WOKTools_BasicMapIterator()
+{}
+
+//=======================================================================
+//function : WOKTools_DoubleMapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_DoubleMapIterator::WOKTools_DoubleMapIterator(const WOKTools_DoubleMap& aMap) :
+       WOKTools_BasicMapIterator(aMap)
+{}
+
+//=======================================================================
+//function : WOKTools_DoubleMapIterator
+//purpose  : 
+//=======================================================================
+
+void WOKTools_DoubleMapIterator::Initialize(const WOKTools_DoubleMap& aMap)
+{
+  WOKTools_BasicMapIterator::Initialize(aMap);
+}
+
diff --git a/src/WOKTools/WOKTools_EnvValue.cdl b/src/WOKTools/WOKTools_EnvValue.cdl
new file mode 100755 (executable)
index 0000000..96c7736
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       WOKTools_EnvValue.cdl
+-- Created:    Wed Sep 27 17:47:42 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class    EnvValue    from WOKTools 
+inherits ReturnValue from WOKTools
+       ---Purpose: 
+
+uses
+    HAsciiString from TCollection
+    
+is
+    
+    Create(avarname, avalue : HAsciiString from TCollection) returns mutable EnvValue  from WOKTools; 
+    ---Purpose: Creates an EnvValue to Set in Environment
+    
+    Create(avarname : HAsciiString from TCollection) returns mutable EnvValue  from WOKTools;
+    ---Purpose: Creates an EnvValue to UnSet Environment
+    
+    SetName(me:mutable; aname : HAsciiString from TCollection);
+    Name(me) returns HAsciiString from TCollection;
+    
+    SetValue(me:mutable; avalue : HAsciiString from TCollection);
+    Value(me) returns HAsciiString from TCollection;
+    
+    ToSet(me) returns Boolean from Standard;
+    
+fields
+    myflag  : Boolean      from Standard;
+    myname  : HAsciiString from TCollection;
+    myvalue : HAsciiString from TCollection;
+end EnvValue;
diff --git a/src/WOKTools/WOKTools_EnvValue.cxx b/src/WOKTools/WOKTools_EnvValue.cxx
new file mode 100755 (executable)
index 0000000..8d7add6
--- /dev/null
@@ -0,0 +1,75 @@
+// File:       WOKTools_EnvValue.cxx
+// Created:    Wed Sep 27 18:28:14 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_EnvValue.ixx>
+
+//=======================================================================
+//function : WOKTools_EnvValue
+//purpose  : To set in env
+//=======================================================================
+ WOKTools_EnvValue::WOKTools_EnvValue(const Handle(TCollection_HAsciiString)& avarname, const Handle(TCollection_HAsciiString)& avalue)
+{
+  SetType(WOKTools_Environment);
+  myname  = avarname;
+  myvalue = avalue;
+  myflag  = Standard_True;
+}
+
+//=======================================================================
+//function : WOKTools_EnvValue
+//purpose  : to unset in env
+//=======================================================================
+ WOKTools_EnvValue::WOKTools_EnvValue(const Handle(TCollection_HAsciiString)& avarname)
+{
+  SetType(WOKTools_Environment);
+  myname  = avarname;
+  myflag  = Standard_False;
+}
+
+//=======================================================================
+//function : SetName
+//purpose  : 
+//=======================================================================
+void WOKTools_EnvValue::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+  myname  = aname;
+}
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_EnvValue::Name() const 
+{
+  return myname;
+}
+
+//=======================================================================
+//function : SetValue
+//purpose  : 
+//=======================================================================
+void WOKTools_EnvValue::SetValue(const Handle(TCollection_HAsciiString)& avalue)
+{
+  myvalue = avalue;
+}
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_EnvValue::Value() const 
+{
+  return myvalue;
+}
+
+//=======================================================================
+//function : ToSet
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_EnvValue::ToSet() const
+{
+  return myflag;
+}
diff --git a/src/WOKTools/WOKTools_Error.cdl b/src/WOKTools/WOKTools_Error.cdl
new file mode 100755 (executable)
index 0000000..ff82066
--- /dev/null
@@ -0,0 +1,22 @@
+-- File:       WOKTools_Error.cdl
+-- Created:    Wed Jun 28 20:22:09 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+class Error from WOKTools 
+inherits Message from WOKTools
+
+       ---Purpose: Error messages
+
+uses
+    AsciiString from TCollection
+is
+
+    Create returns Error from WOKTools;
+    
+    Code(me)
+       returns Character from Standard
+       is redefined;
+           
+end Error;
diff --git a/src/WOKTools/WOKTools_Error.cxx b/src/WOKTools/WOKTools_Error.cxx
new file mode 100755 (executable)
index 0000000..b2228a5
--- /dev/null
@@ -0,0 +1,19 @@
+// File:       WOKTools_Error.cxx
+// Created:    Wed Jun 28 20:22:48 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <stream.h>
+
+#include <WOKTools_Error.ixx>
+
+Standard_EXPORT WOKTools_Error ErrorMsg;
+
+WOKTools_Error::WOKTools_Error() : WOKTools_Message("WOK_ERROR", "Error   : ")
+{
+  Set();
+}
+
+
+Standard_Character WOKTools_Error::Code() const 
+{return 'E';}
diff --git a/src/WOKTools/WOKTools_GEdge.gxx b/src/WOKTools/WOKTools_GEdge.gxx
new file mode 100755 (executable)
index 0000000..b5da8b4
--- /dev/null
@@ -0,0 +1,34 @@
+#include <WOKTools_HSequenceOfBoolean.hxx>
+
+WOKTools_GEdge::WOKTools_GEdge()
+{
+}
+
+WOKTools_GEdge::WOKTools_GEdge(const Handle(WOKTools_GNode)& src,
+                              const Handle(WOKTools_GNode)& dest)
+{
+  mySource      = src;
+  myDestination = dest;
+}
+
+
+void WOKTools_GEdge::Source(const Handle(WOKTools_GNode)& src)
+{
+  mySource = src;
+}
+
+void WOKTools_GEdge::Destination(const Handle(WOKTools_GNode)& dest)
+{
+  myDestination =  dest;
+}
+
+Handle(WOKTools_GNode) WOKTools_GEdge::Source() const
+{
+  return mySource;
+}
+
+Handle(WOKTools_GNode) WOKTools_GEdge::Destination() const
+{
+  return myDestination;
+}
+
diff --git a/src/WOKTools/WOKTools_GGraph.cdl b/src/WOKTools/WOKTools_GGraph.cdl
new file mode 100755 (executable)
index 0000000..2bf7f05
--- /dev/null
@@ -0,0 +1,342 @@
+-- File:       WOKTools_GGraph.cdl
+-- Created:    Mon Apr 18 11:36:05 1994
+-- Author:     Christophe LEYNADIER
+--             <cle@pernox>
+---Copyright:   Matra Datavision 1994
+
+generic class GGraph from WOKTools (GraphItem as any)
+  
+   
+       ---Version:
+
+       ---Purpose: Manage graphes and trees.
+       ---References:
+
+  inherits TShared from MMgt
+  
+  uses HArray2OfBoolean from TColStd,
+       HArray2OfInteger from TColStd,
+       HArray1OfReal    from TColStd
+       
+  raises NullObject,ConstructionError
+  
+      
+    class SequenceOfGNode instantiates 
+          Sequence from TCollection(GNode from WOKTools);
+    class HSequenceOfGNode instantiates 
+          HSequence from TCollection(GNode from WOKTools,SequenceOfGNode);
+         
+    class SequenceOfGEdge instantiates 
+          Sequence from TCollection(GEdge from WOKTools);
+    class HSequenceOfGEdge instantiates 
+          HSequence from TCollection(GEdge from WOKTools,SequenceOfGEdge);
+         
+    class SequenceOfGPath instantiates 
+          Sequence from TCollection(GPath from WOKTools);
+    class HSequenceOfGPath instantiates 
+          HSequence from TCollection(GPath from WOKTools,SequenceOfGPath);
+
+    class SequenceOfGraphItem instantiates 
+          Sequence  from TCollection(GraphItem);
+    class HSequenceOfGraphItem instantiates 
+          HSequence from TCollection(GraphItem,
+                                    SequenceOfGraphItem);
+                 
+
+class GNode
+  
+    inherits TShared from MMgt
+  
+
+    raises NullObject,ConstructionError
+    
+    is
+    
+    -------------------------
+    --Category: Constructors
+    -------------------------                                                              
+      Create(anItem      : GraphItem)
+        returns mutable GNode from WOKTools
+        raises NullObject,ConstructionError;
+      ---Level: Public
+      ---Purpose: Create a new node
+    
+      SetValue(me : mutable; anItem : GraphItem)
+        raises NullObject;
+      ---Level: Public
+      ---Purpose: Set the user item of <me>.
+     
+      Value(me) returns any GraphItem;
+      ---Level: Public
+      ---Purpose: Returns the user item of <me>.
+      
+      AddEdgeIn(me : mutable; In : GEdge from WOKTools);
+      AddEdgeOut(me : mutable; Out : GEdge from WOKTools);
+      ---Level: Public
+
+      GEdgesIn(me)  returns mutable HSequenceOfGEdge from WOKTools;
+      ---Level: Public
+      ---Purpose: Returns the all the GEdges going to <me>
+
+      GEdgesOut(me) returns mutable HSequenceOfGEdge from WOKTools;
+      ---Level: Public
+      ---Purpose: Returns the all the GEdges leaving from <me>
+
+    fields
+    
+      myItem    : GraphItem;                 -- the user item
+      myEdgeIn  : HSequenceOfGEdge from WOKTools;
+      myEdgeOut : HSequenceOfGEdge from WOKTools;
+      
+  end GNode;
+
+class GEdge
+    
+    inherits TShared from MMgt
+    
+    uses HSequenceOfReal from TColStd
+       
+    is
+    
+      Create 
+       returns mutable GEdge from WOKTools;
+      
+      Create(src,dest : GNode from WOKTools)
+        returns mutable GEdge from WOKTools;
+      ---Level: Public.
+      ---Purpose: Create a new edge
+    
+      Source(me : mutable; src : GNode from WOKTools);
+      Destination(me : mutable; src : GNode from WOKTools);
+      
+      Source(me)
+       returns GNode from WOKTools;
+      Destination(me)
+       returns GNode from WOKTools;
+      
+    fields
+      mySource : GNode from WOKTools;
+      myDestination : GNode from WOKTools;
+    
+      
+  end GEdge;
+  
+  class GPath
+    
+    ---Purpose: A path is a set of all edges between two nodes.
+    
+    inherits TShared from MMgt
+    
+    raises NullObject,ConstructionError
+    
+    is
+      Create(aSeqEdge : HSequenceOfGEdge from WOKTools; isCycle : Boolean from Standard) 
+        returns mutable GPath from WOKTools
+       raises ConstructionError;
+      ---Level: Public
+      ---Purpose: Create a path with a sequence of edges.
+      
+      NodeLength(me) returns Integer from Standard;
+      ---Level: Public
+      ---Purpose: Returns the number of nodes in <me>.
+      
+      EdgeLength(me) returns Integer from Standard;
+      ---Level: Public
+      ---Purpose: Returns the number of edges in <me>.
+     
+      Nodes(me) returns mutable HSequenceOfGNode from WOKTools;    
+      ---Level: Public         
+      ---Purpose: Returns all the nodes of <me>.
+       
+      Edges(me) returns mutable HSequenceOfGEdge from WOKTools;    
+      ---Level: Public
+      ---Purpose: Returns all the edges of <me>.
+   
+      IsCycle(me) returns Boolean from Standard;
+    
+    fields
+      myEdges : HSequenceOfGEdge from WOKTools; -- the edges
+      myCycle : Boolean from Standard;          -- true if i am a cycle      
+  end GPath;
+      
+  is
+    
+    Create
+      returns mutable GGraph from WOKTools;
+    ---Level: Public
+    ---Purpose: create an empty graphic graph
+
+    Destroy(me : mutable);
+    ---Level: Public
+    ---Purpose: Destroy Graph structure and elements.
+    ---C++: alias ~
+
+    AreLinked(me                : mutable;
+             aNode,anOtherNode : GNode from WOKTools) 
+      returns Boolean from Standard
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns TRUE if the two nodes are linked with an edge
+    --          The direction is not checked. 
+    
+    AreDirectedLinked(me                   : mutable; 
+                     aSource,aDestination : GNode from WOKTools) 
+      returns Boolean from Standard
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns TRUE if the two nodes are linked with an edge
+    --          and nodes and edges can be displayed in <aView>.
+    --          The direction is checked.
+
+    DirectedLink(me                   : mutable; 
+                aSource,aDestination : GNode from WOKTools) 
+      returns mutable GEdge from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns an edge if the two nodes are linked
+    --          The direction is checked.
+   
+    AddItem(me     : mutable;
+           anItem : GraphItem) 
+      returns mutable GNode from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Add an item in the graph. This create a new node and
+    --          returns it (it has no edges, so it's a root-leaf).
+   
+    AddEdge(me          : mutable;
+           aPred,aSucc : GNode from WOKTools) 
+      returns mutable GEdge from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Add an edge between two nodes.
+    
+    DelNode(me    : mutable;
+           aNode : GNode from WOKTools)
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Remove a node from <me>.
+    ---Warning: All successors of me are also deleted.
+
+    DelNode(me     : mutable;
+           anItem : GraphItem)
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Remove all nodes from <me> having an item <GraphItem>.
+    ---Warning: All successors of me are also deleted.
+    
+    DelEdge(me     : mutable;
+           anEdge : GEdge from WOKTools)
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Remove an edge from <me>.
+    
+    DelEdge(me                : mutable;
+           aNode,anOtherNode : GNode from WOKTools)
+      raises NullObject;
+     ---Level: Public
+     ---Purpose: Remove an edge between two nodes of <me>.
+    
+    Path(me                : mutable; 
+        aNode,anOtherNode : GNode from WOKTools)
+      returns mutable HSequenceOfGPath from WOKTools
+      raises NullObject ;
+    ---Level: Public
+    ---Purpose: Returns a set of paths between two nodes.
+    ---Warning: It return a set in which all elements are displayed
+    --          in <aView>.    
+    BestPath(me                : mutable; 
+            aNode,anOtherNode : GNode from WOKTools)
+      returns mutable HSequenceOfGPath from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns a set of the smallest paths between
+    --          two nodes of <me>. (if there is more than one
+    --          path, they had the same length)
+    ---Warning: It return a set in which all elements are displayed
+    --          in <aView>.    
+    Find(me     : mutable; 
+        anItem : GraphItem) returns mutable GNode from WOKTools
+      raises NullObject;
+     ---Level: Public
+     ---Purpose: Returns the node with the user item <anItem>.
+
+    Fathers(me    : mutable; 
+           aNode : GNode from WOKTools)
+      returns mutable HSequenceOfGNode from WOKTools;
+    ---Level: Public
+    ---Purpose: Returns all Fathers of aNode.            
+          
+    Roots(me : mutable) returns mutable HSequenceOfGNode from WOKTools;
+    ---Level: Public
+    ---Purpose: Returns a sequence of all roots of <me>.
+       
+    Leaves(me : mutable; aNode : GNode from WOKTools) 
+      returns mutable HSequenceOfGNode from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns a sequence of all leaves of <me> from
+    --          the node <aNode>.
+        
+    Leaves(me : mutable) returns mutable HSequenceOfGNode from WOKTools;
+    ---Level: Public
+    ---Purpose: Returns a sequence of all leaves of <me>.
+       
+    Heirs(me     : mutable;
+         aNode  : GNode from WOKTools;
+         aLevel : Integer from Standard)      
+      returns mutable HSequenceOfGNode from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns a sequence of the heirs of aNode at <aLevel> 
+    ---Warning: If <aLevel> is zero, returns a Sequence of all Heirs of aNode.
+  
+    Brothers(me     : mutable;
+            aNode  : GNode from WOKTools)      
+      returns mutable HSequenceOfGNode from WOKTools
+      raises NullObject;
+    ---Level: Public
+    ---Purpose: Returns a sequence of the brothers of aNode.
+    --          a Brother is a node who has same father as <aNode>.
+
+    Nodes(me) returns mutable HSequenceOfGNode from WOKTools;
+    ---Level: Public
+    ---Purpose: Returns the nodes of <me>.
+
+    Edges(me) returns mutable HSequenceOfGEdge from WOKTools;
+    ---Level: Public
+    ---Purpose: Returns the edges of <me>.
+    
+    Index(myclass; aSeq : HSequenceOfGNode from WOKTools; aNode  : GNode from WOKTools)
+      returns Integer from Standard;
+      
+    Index(myclass; aSeq : HSequenceOfGEdge from WOKTools; anEdge  : GEdge from WOKTools)
+      returns Integer from Standard;
+      
+    MustBeRecompute(me : mutable)
+      returns Boolean from Standard
+      is private;
+
+    BuildAdjMatrix(me : mutable) 
+       is private;
+       
+    BuildIndMatrix(me : mutable) 
+       is private;
+       
+  fields
+    myGNodes              : HSequenceOfGNode;
+    myGEdges              : HSequenceOfGEdge;
+    myMatrixAdj           : HArray2OfBoolean from TColStd;    
+    myRoyWars             : HArray2OfBoolean from TColStd;    
+    myMatrixInd           : HArray2OfInteger from TColStd;
+    myModifiedFlag        : Boolean from Standard;
+
+ friends 
+
+    class GNode from WOKTools
+    
+end GGraph;
+
diff --git a/src/WOKTools/WOKTools_GGraph.gxx b/src/WOKTools/WOKTools_GGraph.gxx
new file mode 100755 (executable)
index 0000000..cde272e
--- /dev/null
@@ -0,0 +1,794 @@
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <TColStd_HArray2OfBoolean.hxx>
+#include <TColStd_HArray1OfBoolean.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HArray2OfInteger.hxx>
+
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_DomainError.hxx>
+
+// Construction of a graph :
+//     we need an interface generic item to initialize the nodes,edges
+//
+
+WOKTools_GGraph::WOKTools_GGraph() : myGNodes(new WOKTools_HSequenceOfGNode),myGEdges(new WOKTools_HSequenceOfGEdge)
+{
+}
+
+void WOKTools_GGraph::Destroy()
+{
+  Standard_Integer                  anIndex = 1;
+  Handle(WOKTools_GNode)            aNullGNode;
+
+  for(anIndex = 1; anIndex <= myGNodes->Length(); anIndex++) {
+    myGNodes->Value(anIndex)->GEdgesOut()->Clear();
+    myGNodes->Value(anIndex)->GEdgesIn()->Clear();
+  }
+
+  for(anIndex = 1; anIndex <= myGEdges->Length(); anIndex++) {
+    myGEdges->Value(anIndex)->Destination(aNullGNode);
+    myGEdges->Value(anIndex)->Source(aNullGNode);
+  }
+
+  myGEdges->Clear();
+  myGNodes->Clear();
+}
+
+// returns Standard_True if the two nodes are linked.
+// no matter for the direction.
+//
+Standard_Boolean WOKTools_GGraph::AreLinked(const Handle(WOKTools_GNode)& aNode, 
+                                           const Handle(WOKTools_GNode)& anOtherNode) 
+{
+  MustBeRecompute();
+
+  Standard_NullObject_Raise_if (aNode.IsNull() || anOtherNode.IsNull(),"call AreLinked with null node");
+
+  Standard_Integer i,j;
+
+  i = WOKTools_GGraph::Index(myGNodes,aNode);
+  j = WOKTools_GGraph::Index(myGNodes,anOtherNode);
+
+  return (myMatrixAdj->Value(i,j) || myMatrixAdj->Value(j,i));
+}
+
+// returns Standard_True if the two nodes are linked in the direction :
+//       aSource -------> aDestination.
+//
+// Standard_False otherwise.
+//
+Standard_Boolean WOKTools_GGraph::AreDirectedLinked(const Handle(WOKTools_GNode)& aSource, 
+                                                   const Handle(WOKTools_GNode)& aDestination) 
+{
+  MustBeRecompute();
+  
+  Standard_NullObject_Raise_if (aSource.IsNull() || aDestination.IsNull(), "null source or destination");
+  
+  Standard_Integer i,j;
+
+  i = WOKTools_GGraph::Index(myGNodes,aSource);
+  j = WOKTools_GGraph::Index(myGNodes,aDestination);
+
+  return myMatrixAdj->Value(i,j);
+}
+
+Handle(WOKTools_GEdge) WOKTools_GGraph::DirectedLink(const Handle(WOKTools_GNode)& aSource, 
+                                                    const Handle(WOKTools_GNode)& aDestination) 
+{
+
+  Handle(WOKTools_GEdge)          anEdge;
+
+  MustBeRecompute();
+
+  Standard_NullObject_Raise_if (aSource.IsNull() || aDestination.IsNull(), "null source or destination");
+  
+  Standard_Integer i,psrc,pdest;
+  Standard_Boolean isFound = Standard_False;
+
+  psrc  = WOKTools_GGraph::Index(myGNodes,aSource);
+  pdest = WOKTools_GGraph::Index(myGNodes,aDestination);
+
+  for (i = 1; i <= myMatrixInd->UpperRow() && !isFound; i++) {
+    if (myMatrixInd->Value(i,psrc) == -1 &&  myMatrixInd->Value(i,pdest) == 1) {
+      anEdge = myGEdges->Value(i);
+      isFound = Standard_True;
+    }
+  }
+  
+  return anEdge;
+}
+
+// no comments
+//
+Handle(WOKTools_GNode) WOKTools_GGraph::AddItem(const GraphItem& anItem)
+{
+  Handle(WOKTools_GNode)            aGNode;
+
+  
+  aGNode = Find(anItem);
+
+  if (aGNode.IsNull()) {
+    aGNode = new WOKTools_GNode(anItem);
+    
+    myGNodes->Append(aGNode);
+    myModifiedFlag = Standard_True;
+  }
+
+  return(aGNode);
+}
+
+// no comments
+//
+Handle(WOKTools_GEdge) WOKTools_GGraph::AddEdge(const Handle(WOKTools_GNode)& aPred, 
+                                               const Handle(WOKTools_GNode)& aSucc)
+{
+  Handle(WOKTools_GEdge)          aGEdge;
+
+  if (!aPred.IsNull() && !aSucc.IsNull()) {
+    myModifiedFlag = Standard_True;
+
+    aGEdge = new WOKTools_GEdge(aPred,aSucc);
+
+    aPred->AddEdgeOut(aGEdge);
+    aSucc->AddEdgeIn(aGEdge);
+
+    myGEdges->Append(aGEdge); 
+  }
+  else Standard_NullObject::Raise();
+  
+  return aGEdge;
+}
+
+// no comments
+//
+void WOKTools_GGraph::DelNode(const Handle(WOKTools_GNode)& aNode)
+{
+  Standard_NullObject_Raise_if(aNode.IsNull(), "null node");
+
+  Standard_Integer                  pos = WOKTools_GGraph::Index(myGNodes,aNode);
+  Standard_Integer                  i;     
+  Handle(WOKTools_HSequenceOfGEdge) in  = aNode->GEdgesIn(),
+                                    out = aNode->GEdgesOut(),
+                                    tmpseq;
+
+  for (i = 1; i <= in->Length(); i++) {
+    tmpseq = in->Value(i)->Source()->GEdgesOut();
+    tmpseq->Remove(WOKTools_GGraph::Index(tmpseq,in->Value(i)));
+    myGEdges->Remove(WOKTools_GGraph::Index(myGEdges,in->Value(i)));
+  }
+
+  for (i = 1; i <= out->Length(); i++) {
+    tmpseq = out->Value(i)->Destination()->GEdgesIn();
+    tmpseq->Remove(WOKTools_GGraph::Index(tmpseq,out->Value(i)));
+    myGEdges->Remove(WOKTools_GGraph::Index(myGEdges,out->Value(i)));
+  }
+
+  myGNodes->Remove(pos);
+  myModifiedFlag = Standard_True;
+}
+
+
+// delete all nodes that bring the "anItem" users item.
+//
+void WOKTools_GGraph::DelNode(const GraphItem& anItem)
+{
+  Standard_Integer anInt;
+
+  for (anInt = 1; anInt <= myGNodes->Length(); anInt++) {
+    if (myGNodes->Value(anInt)->Value() == anItem) {
+      DelNode(myGNodes->Value(anInt));
+      if (anInt > 1) anInt--;
+    }
+  }
+}
+
+// no comments
+//
+void WOKTools_GGraph::DelEdge(const Handle(WOKTools_GEdge)& anEdge)
+{
+  Standard_Integer anIndex;
+
+  if (!anEdge.IsNull()) {
+    anIndex = WOKTools_GGraph::Index(myGEdges,anEdge);
+
+    if (anIndex != 0) {
+      Handle(WOKTools_HSequenceOfGEdge) in,
+                                        out;
+
+      in  = anEdge->Destination()->GEdgesIn();
+      out = anEdge->Source()->GEdgesOut();
+
+      in->Remove(WOKTools_GGraph::Index(in,anEdge));
+      out->Remove(WOKTools_GGraph::Index(out,anEdge));
+
+      myGEdges->Remove(anIndex);
+      myModifiedFlag = Standard_True;
+    }
+  }
+  else {
+    Standard_NullObject::Raise();
+  }
+}
+
+
+// no comments
+//
+void WOKTools_GGraph::DelEdge(const Handle(WOKTools_GNode)& aNode, 
+                             const Handle(WOKTools_GNode)& anOtherNode)
+{
+  Standard_NullObject_Raise_if (aNode.IsNull() || anOtherNode.IsNull(), "null node");
+
+  Standard_Integer                i;
+
+  for (i = 1; i <= myGEdges->Length(); i++) {
+    if ((myGEdges->Value(i)->Destination() == aNode && myGEdges->Value(i)->Source() == anOtherNode) ||
+       (myGEdges->Value(i)->Source() == aNode && myGEdges->Value(i)->Destination() == anOtherNode)) {
+      DelEdge(myGEdges->Value(i));
+      if (i > 1) i--;
+    }
+  }
+}
+
+// find all pathes between two nodes
+//
+Handle(WOKTools_HSequenceOfGPath) WOKTools_GGraph::Path(const Handle(WOKTools_GNode)& aNode,   
+                                                       const Handle(WOKTools_GNode)& anOtherNode)
+{
+  Handle(WOKTools_HSequenceOfGPath)  aSeqPath     = new WOKTools_HSequenceOfGPath;
+  Handle(WOKTools_HSequenceOfGEdge)  aSeqEdge;
+  Standard_Integer                   aStartIndex  = 1,
+                                     aCurrentInd  = 1,
+                                     anInt;
+  Handle(TColStd_HSequenceOfInteger) aChild       = new TColStd_HSequenceOfInteger,
+                                     aFather      = new TColStd_HSequenceOfInteger;
+  Standard_Boolean                   aEnd         = Standard_False,
+                                     isCycle;
+  Handle(TColStd_HArray1OfBoolean)   aVisited,fatherFlag;
+
+  MustBeRecompute();
+  Standard_NullObject_Raise_if (aNode.IsNull() || anOtherNode.IsNull(),"null node");
+
+  // we start with this node (its the root)
+  
+  aStartIndex = WOKTools_GGraph::Index(myGNodes,aNode);
+  aCurrentInd = 1;
+  aVisited    = new TColStd_HArray1OfBoolean(1,myGNodes->Length(),Standard_False);
+  fatherFlag  = new TColStd_HArray1OfBoolean(1,myGNodes->Length(),Standard_False);
+
+  while(!aEnd) {
+    // here, we go downstairs
+    //
+    isCycle = Standard_False;
+    while(aCurrentInd <= myMatrixAdj->UpperRow()) {
+
+      if (myMatrixAdj->Value(aStartIndex,aCurrentInd)) {
+//     isCycle = Standard_False;
+
+       if ((!fatherFlag->Value(aStartIndex) || (myGNodes->Value(aCurrentInd)->Value() == anOtherNode->Value())) &&
+           (myGNodes->Value(aCurrentInd)->Value() != aNode->Value())) {
+
+         if (!isCycle)
+           isCycle = fatherFlag->Value(aStartIndex);
+
+         fatherFlag->SetValue(aStartIndex,Standard_True);
+
+         aFather->Append(aStartIndex);
+         aChild->Append(aCurrentInd);
+
+         // we set this node visited
+         // so, in the next loops we will not use it
+         // 
+         aVisited->SetValue(aCurrentInd,Standard_True);
+         aStartIndex = aCurrentInd;
+
+         if (myGNodes->Value(aCurrentInd)->Value() == anOtherNode->Value()) {
+           aCurrentInd = myMatrixAdj->UpperRow();
+         }
+         else {
+           aCurrentInd = 0;
+         }
+       } 
+       else {
+         // isCycle = Standard_True;
+       }
+      }
+
+      aCurrentInd++;
+    }
+       
+    // we are in a leaf, we go upstairs to seek a brother to the father node
+    // 
+    if (aCurrentInd > myMatrixAdj->UpperRow() && !aFather->IsEmpty()) {
+      // we have found the good node
+      //
+      if (myGNodes->Value(aChild->Value(aChild->Length()))->Value() == anOtherNode->Value()) {
+       aSeqEdge = new WOKTools_HSequenceOfGEdge;
+       for (anInt = 1; anInt < aFather->Length(); anInt++) {
+         aSeqEdge->Append(DirectedLink(myGNodes->Value(aFather->Value(anInt)),myGNodes->Value(aFather->Value(anInt + 1))));
+       }
+       
+       aSeqEdge->Append(DirectedLink(myGNodes->Value(aFather->Value(aFather->Length())),myGNodes->Value(aChild->Value(aChild->Length()))));           
+       aSeqPath->Append(new WOKTools_GPath(aSeqEdge,isCycle));  
+      }
+
+      aStartIndex = aFather->Value(aFather->Length());
+      aCurrentInd = aChild->Value(aChild->Length()) + 1;
+
+      fatherFlag->SetValue(aStartIndex,Standard_False);
+      
+      aChild->Remove(aChild->Length());
+      aFather->Remove(aFather->Length());
+    }
+    else {
+      aEnd = Standard_True;
+    }
+  }
+
+ return(aSeqPath);
+}
+
+// find the best pathes between two nodes (minimum crossed nodes)
+//
+Handle(WOKTools_HSequenceOfGPath) WOKTools_GGraph::BestPath(const Handle(WOKTools_GNode)& aNode,
+                                                           const Handle(WOKTools_GNode)& anOtherNode) 
+{
+  Handle(WOKTools_HSequenceOfGPath) aSeqPath = new WOKTools_HSequenceOfGPath,
+                                    aSeqNPath;
+  Standard_Integer                  anInt;
+  Handle(WOKTools_GPath)            aPath;
+
+  if (!aNode.IsNull() && !anOtherNode.IsNull()) {
+    MustBeRecompute();
+
+    aSeqNPath = Path(aNode,anOtherNode);
+    
+    if (!aSeqNPath->IsEmpty()) {
+      aPath = aSeqNPath->Value(1);
+      
+      for (anInt = 2; anInt <= aSeqNPath->Length(); anInt++) {
+       if (aPath->NodeLength() > aSeqNPath->Value(anInt)->NodeLength()) {
+         aSeqPath->Clear();
+         aSeqPath->Append(aSeqNPath->Value(anInt));
+         aPath = aSeqNPath->Value(anInt);
+       }
+       else if (aPath->NodeLength() == aSeqNPath->Value(anInt)->NodeLength()) {
+         aSeqPath->Append(aSeqNPath->Value(anInt));
+       }
+      }
+    }
+  }
+  else {
+    Standard_NullObject::Raise();
+  }
+
+ return(aSeqPath);
+}
+
+// find the list of nodes with the item <anItem>.
+//
+
+Handle(WOKTools_GNode) WOKTools_GGraph::Find(const GraphItem& anItem) 
+{
+  Handle(WOKTools_GNode) aNode;
+  Standard_Integer       anInt;
+  Standard_Boolean       isFound = Standard_False;
+
+  for (anInt = 1; anInt <= myGNodes->Length() && !isFound; anInt++) {
+    if (anItem == myGNodes->Value(anInt)->Value()) {
+      aNode = myGNodes->Value(anInt);
+      isFound = Standard_True;
+    }
+  }
+
+  return aNode;
+}
+
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Fathers(const Handle(WOKTools_GNode)& aNode) 
+{
+  Handle(WOKTools_HSequenceOfGNode) aSeqNode = new WOKTools_HSequenceOfGNode;
+  Handle(WOKTools_GNode)            aTmpNode;
+  Standard_Integer                  aCounter;
+  Handle(WOKTools_HSequenceOfGEdge) aSeqEdge;
+
+  MustBeRecompute();
+
+  if (!aNode.IsNull()) {
+     aSeqEdge = aNode->GEdgesIn();
+     
+     if (!aSeqEdge.IsNull()) {
+       for (aCounter = 1; aCounter <= aSeqEdge->Length(); aCounter++) {
+        aTmpNode = aSeqEdge->Value(aCounter)->Source();         
+        aSeqNode->Append(aTmpNode);
+       }
+     }
+   }
+
+  return(aSeqNode);
+}
+// returns the roots of the graph
+//
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Roots()
+{
+  Handle(WOKTools_HSequenceOfGNode)        aSeqNode = new WOKTools_HSequenceOfGNode;
+  Standard_Integer                         anInt,j;
+  Standard_Boolean                         IsRoots;
+
+  MustBeRecompute();
+  for (anInt = 1; anInt <= myGNodes->Length(); anInt++) {
+    IsRoots = Standard_True;
+
+    for (j = 1; j <= myGEdges->Length() && IsRoots; j++) {
+      if (myMatrixInd->Value(j,anInt) == 1) {
+       IsRoots = Standard_False;
+      }
+    }
+    
+    if (IsRoots) {
+      aSeqNode->Append(myGNodes->Value(anInt));
+    }
+  }
+  
+  return(aSeqNode);
+}
+
+// find leaves of the graph with root <aNode> 
+//
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Leaves(const Handle(WOKTools_GNode)& aNode)
+{
+ Standard_Integer                      aStartIndex,
+                                       aCurrentInd;
+ Handle(TColStd_HSequenceOfInteger)    aChild       = new TColStd_HSequenceOfInteger,
+                                       aFather      = new TColStd_HSequenceOfInteger;
+ Standard_Boolean                      aEnd         = Standard_False,
+                                       goUp         = Standard_False,
+                                       isCycle;
+ Handle(TColStd_HArray1OfBoolean)      aVisited;
+ Handle(WOKTools_HSequenceOfGNode)     aSeqNode  = new WOKTools_HSequenceOfGNode;
+
+ MustBeRecompute();
+ if (!aNode.IsNull()) {
+   aCurrentInd = WOKTools_GGraph::Index(myGNodes,aNode);
+
+   if (aCurrentInd != 0) {
+     aVisited = new TColStd_HArray1OfBoolean(1,myGNodes->Length(),Standard_False);
+
+     // we start with this node (its the root)
+     //
+     aStartIndex = aCurrentInd;
+     aVisited->SetValue(aStartIndex,Standard_True);
+     aCurrentInd = 1;
+        
+     while(!aEnd) {
+       // here, we go downstairs
+       //
+       isCycle = Standard_False;
+
+       while(aCurrentInd <= myMatrixAdj->UpperRow()) {
+          
+        if (myMatrixAdj->Value(aStartIndex,aCurrentInd)) {
+          goUp = Standard_False;
+          isCycle = Standard_False;
+
+          if (!aVisited->Value(aCurrentInd)) {
+            aFather->Append(aStartIndex);
+            aChild->Append(aCurrentInd);
+
+            // we set this node visited
+            // so, in the next loops we will not use it
+            // 
+            aVisited->SetValue(aCurrentInd,Standard_True);
+            aStartIndex = aCurrentInd;
+            aCurrentInd = 0;
+          } 
+          else {
+            isCycle = Standard_True;
+          }
+        }
+
+        aCurrentInd++;
+       }
+       
+       // we are in a leaf, we go upstairs to seek a brother to the father node
+       // 
+       if ((aCurrentInd > myMatrixAdj->UpperRow()) && !aFather->IsEmpty()) {
+
+        aStartIndex = aFather->Value(aFather->Length());
+        aCurrentInd = aChild->Value(aChild->Length()) + 1;
+
+        if (!isCycle && !goUp) {
+          aSeqNode->Append(myGNodes->Value(aChild->Value(aChild->Length())));         
+        }
+
+        goUp = Standard_True;
+        aChild->Remove(aChild->Length());
+        aFather->Remove(aFather->Length());
+       }
+       else aEnd = Standard_True;
+     }
+   }
+ }
+ else {
+   Standard_NullObject::Raise();
+ } 
+
+ return aSeqNode;
+}
+
+// returns the leaves of the graph
+//
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Leaves()
+{
+  Handle(WOKTools_HSequenceOfGNode)        aSeqNode = new WOKTools_HSequenceOfGNode;
+  Standard_Integer                         anInt,j;
+  Standard_Boolean                         IsLeaves;
+
+  MustBeRecompute();
+  for (anInt = 1; anInt <= myGNodes->Length(); anInt++) {
+    IsLeaves = Standard_True;
+
+    for (j = 1; j <= myGEdges->Length() && IsLeaves; j++) {
+      if (myMatrixInd->Value(j,anInt) == -1) {
+       IsLeaves = Standard_False;
+      }
+    }
+    
+    if (IsLeaves) {
+      aSeqNode->Append(myGNodes->Value(anInt));
+    }
+  }
+  
+  return(aSeqNode);
+}
+
+// returns the graphics nodes of the graph
+//
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Nodes() const 
+{
+  return myGNodes;
+}
+
+// returns the graphic edges of the graph
+//
+Handle(WOKTools_HSequenceOfGEdge) WOKTools_GGraph::Edges() const 
+{
+  return myGEdges;
+}
+
+// Build the adjacency matrix
+// 
+void WOKTools_GGraph::BuildAdjMatrix() 
+{
+  Standard_Integer                  aK,aI,i;
+  Handle(WOKTools_GNode)            aGNode;
+  Handle(WOKTools_HSequenceOfGEdge) seqEdge;
+
+  Standard_NullObject_Raise_if (myGNodes->Length() == 0,"Attempt to construct an empty Graph");
+  
+  myMatrixAdj = new TColStd_HArray2OfBoolean(1,myGNodes->Length(),1,myGNodes->Length());
+
+  // initialisation de la matrice.
+  //
+  for (aI = myMatrixAdj->LowerRow(); aI <= myMatrixAdj->UpperRow(); aI++) {
+    for (Standard_Integer aJ = myMatrixAdj->LowerCol(); aJ <= myMatrixAdj->UpperCol(); aJ++) {
+      myMatrixAdj->SetValue(aI,aJ,Standard_False);
+    }
+  }
+
+ for (aI = 1; aI <= myGNodes->Length(); aI++) {
+   seqEdge  = myGNodes->Value(aI)->GEdgesOut();
+
+   for (i = 1; i <= seqEdge->Length(); i++) {
+     aGNode = seqEdge->Value(i)->Destination();
+       
+     if (aGNode != myGNodes->Value(aI)) {
+       aK = WOKTools_GGraph::Index(myGNodes,aGNode);
+       myMatrixAdj->SetValue(aI,aK,Standard_True);
+     }
+   } 
+ }
+}
+
+void WOKTools_GGraph::BuildIndMatrix() 
+{
+  Standard_Integer                aK,aI,aJ;
+  Handle(WOKTools_GNode)          aGNodeS,aGNodeD;
+
+  Standard_NullObject_Raise_if (myGNodes->Length() == 0,"Attempt to construct an empty Graph");
+  
+  myMatrixInd = new TColStd_HArray2OfInteger(1,myGEdges->Length(),1,myGNodes->Length());
+
+  // initialisation de la matrice.
+  //
+  for (aI = myMatrixInd->LowerRow(); aI <= myMatrixInd->UpperRow(); aI++) {
+    for (aJ = myMatrixInd->LowerCol(); aJ <= myMatrixInd->UpperCol(); aJ++) {
+      myMatrixInd->SetValue(aI,aJ,0);
+    }
+  }
+
+  for (aI = 1; aI <= myGEdges->Length(); aI++) {
+    aGNodeD = myGEdges->Value(aI)->Destination();
+    aGNodeS = myGEdges->Value(aI)->Source();
+    
+    aJ = WOKTools_GGraph::Index(myGNodes,aGNodeS);
+    aK = WOKTools_GGraph::Index(myGNodes,aGNodeD);
+
+    myMatrixInd->SetValue(aI,aJ,-1);
+    
+    if (myMatrixInd->Value(aI,aK) >= 0) {
+      myMatrixInd->SetValue(aI,aK,1);
+    }
+  }
+}
+
+Standard_Boolean WOKTools_GGraph::MustBeRecompute()
+{
+  Standard_Boolean result = myModifiedFlag;
+
+  if (myModifiedFlag) {
+    BuildAdjMatrix();
+    BuildIndMatrix();
+    myModifiedFlag = Standard_False;
+  }
+
+  return result;
+}
+
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Heirs(const Handle(WOKTools_GNode)& aNode,
+                                                        const Standard_Integer        aLevel)
+{
+ Standard_Integer                      aStartIndex  = 1,
+                                       aCurrentInd  = 1,
+                                      aIndexLevel  = 1;
+ Handle(TColStd_HSequenceOfInteger)    aChild       = new TColStd_HSequenceOfInteger,
+                                       aFather      = new TColStd_HSequenceOfInteger;
+ Standard_Boolean                      aEnd         = Standard_False;
+ Handle(TColStd_HArray1OfBoolean)      aVisited;
+ Handle(WOKTools_HSequenceOfGNode)     aSeqGNode    = new WOKTools_HSequenceOfGNode;
+
+ MustBeRecompute();
+ if (!aNode.IsNull()) {
+   if ((aLevel >= 0) && (WOKTools_GGraph::Index(myGNodes,aNode) != 0)) {
+     aVisited = new TColStd_HArray1OfBoolean(1,myGNodes->Length(),Standard_False);
+       
+     // we start with this node (its the root)
+     //
+     aStartIndex = WOKTools_GGraph::Index(myGNodes,aNode);
+     aVisited->SetValue(aStartIndex,Standard_True);
+     aCurrentInd = 1;
+       
+     if (aLevel == 0) aIndexLevel = 0;
+
+     while(!aEnd) {
+       // here, we go downstairs
+       //
+       while(aCurrentInd <= myMatrixAdj->UpperRow()) {
+        if (myMatrixAdj->Value(aStartIndex,aCurrentInd) && !aVisited->Value(aCurrentInd) && (aIndexLevel <= aLevel)) {
+          aSeqGNode->Append(myGNodes->Value(aCurrentInd));
+          
+          // we set this node (aCurrentInd) visited
+          // so, in the next loops we will not use it
+          // 
+          aVisited->SetValue(aCurrentInd,Standard_True);
+          
+          aFather->Append(aStartIndex);
+          aChild->Append(aCurrentInd);
+          
+          if (aLevel != 0) aIndexLevel++;
+          
+          aStartIndex = aCurrentInd;
+          aCurrentInd = 0;
+        } 
+        aCurrentInd++;
+       }
+           
+       // we are in a leaf, we go upstairs to seek a brother to the father node
+       // 
+       if (aCurrentInd > myMatrixAdj->UpperRow() && !aFather->IsEmpty()) {
+        aStartIndex = aFather->Value(aFather->Length());
+        aCurrentInd = aFather->Value(aChild->Length()) + 1;
+        
+        if (aLevel != 0) aIndexLevel--;
+        
+        aChild->Remove(aChild->Length());
+        aFather->Remove(aFather->Length());
+       }
+       else aEnd = Standard_True;
+     }
+   }
+ }
+ else {
+   Standard_NullObject::Raise();
+ }
+ return(aSeqGNode);
+}
+
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GGraph::Brothers(const Handle(WOKTools_GNode)& aNode)
+{
+ Standard_Integer                      aStartIndex  = 1,
+                                       aCurrentInd  = 1,
+                                       aFatherIndex = 1;
+ Handle(WOKTools_HSequenceOfGNode)     aFather      = new WOKTools_HSequenceOfGNode,
+                                       aSeqGNode    = new WOKTools_HSequenceOfGNode;
+
+ MustBeRecompute();
+ if (!aNode.IsNull()) {
+   if (WOKTools_GGraph::Index(myGNodes,aNode) != 0) {
+     // we start with this node (its the root)
+     // and we take his fathers
+     
+     aStartIndex = WOKTools_GGraph::Index(myGNodes,aNode);
+     
+     while(aCurrentInd <= myMatrixAdj->UpperRow()) {
+       if (myMatrixAdj->Value(aCurrentInd,aStartIndex))
+        aFather->Append(myGNodes->Value(aCurrentInd));
+       
+       aCurrentInd++;
+     } 
+     // we take childs of all fathers
+
+     if (!aFather->IsEmpty()) {
+       for (aFatherIndex = 1; aFatherIndex <= aFather->Length(); aFatherIndex++) {
+        aCurrentInd = 1;               
+        aStartIndex = WOKTools_GGraph::Index(myGNodes,aFather->Value(aFatherIndex));
+        
+        while(aCurrentInd <= myMatrixAdj->UpperRow()) {
+          if (myMatrixAdj->Value(aStartIndex,aCurrentInd) && myGNodes->Value(aCurrentInd) != aNode)
+            aSeqGNode->Append(myGNodes->Value(aCurrentInd));
+          
+          aCurrentInd++;
+        }
+       }
+     }
+   }
+ }
+ else Standard_NullObject::Raise();
+ return(aSeqGNode);
+}
+
+
+Standard_Integer WOKTools_GGraph::Index(const Handle(WOKTools_HSequenceOfGNode)& aSeq,
+                                       const Handle(WOKTools_GNode)& aNode)
+{
+  Standard_Integer result = 0,
+                   i;
+  
+  for (i = 1; i <= aSeq->Length() && result == 0; i++) {
+    if (aNode->Value() == aSeq->Value(i)->Value()) {
+      result = i;
+    }
+  }
+
+  return result;
+}
+
+Standard_Integer WOKTools_GGraph::Index(const Handle(WOKTools_HSequenceOfGEdge)& aSeq,
+                                       const Handle(WOKTools_GEdge)& anEdge)
+{
+  Standard_Integer       result = 0,
+                         i;
+  Handle(WOKTools_GNode) aNode1,aNode2,aNodeA,aNodeB;
+
+  aNodeA = anEdge->Source();
+  aNodeB = anEdge->Destination();
+  
+  for (i = 1; i <= aSeq->Length() && result == 0; i++) {
+    aNode1 = aSeq->Value(i)->Source();
+    aNode2 = aSeq->Value(i)->Destination();
+    
+    if ( ((aNode1->Value() == aNodeA->Value()) && (aNode2->Value() == aNodeB->Value())) ||
+       ((aNode2->Value() == aNodeA->Value()) && (aNode1->Value() == aNodeB->Value()))) {
+      result = i;
+    }
+  }
+  
+  return result;
+}
diff --git a/src/WOKTools/WOKTools_GNode.gxx b/src/WOKTools/WOKTools_GNode.gxx
new file mode 100755 (executable)
index 0000000..9445f4e
--- /dev/null
@@ -0,0 +1,42 @@
+#include <WOKTools_HSequenceOfBoolean.hxx>
+#include WOKTools_GEdge_hxx
+
+WOKTools_GNode::WOKTools_GNode(const GraphItem& anItem)
+{
+  myItem     = anItem;
+  myEdgeIn   = new WOKTools_HSequenceOfGEdge;
+  myEdgeOut  = new WOKTools_HSequenceOfGEdge;
+}
+
+void WOKTools_GNode::SetValue(const GraphItem& anItem)
+{
+  myItem = anItem;
+}
+
+GraphItem WOKTools_GNode::Value() const 
+{
+  return myItem;
+}
+
+void WOKTools_GNode::AddEdgeIn(const Handle(WOKTools_GEdge)& in)
+{
+  myEdgeIn->Append(in);
+}
+
+void WOKTools_GNode::AddEdgeOut(const Handle(WOKTools_GEdge)& out)
+{
+  myEdgeOut->Append(out);
+}
+
+Handle(WOKTools_HSequenceOfGEdge) WOKTools_GNode::GEdgesOut() const
+{
+  return myEdgeOut;
+}
+
+
+Handle(WOKTools_HSequenceOfGEdge) WOKTools_GNode::GEdgesIn() const
+{
+  return myEdgeIn;
+}
+
+
diff --git a/src/WOKTools/WOKTools_GPath.gxx b/src/WOKTools/WOKTools_GPath.gxx
new file mode 100755 (executable)
index 0000000..9b98019
--- /dev/null
@@ -0,0 +1,57 @@
+WOKTools_GPath::WOKTools_GPath(const Handle(WOKTools_HSequenceOfGEdge)& aSeqEdge,
+                              const Standard_Boolean isCycle)
+{
+  myCycle = isCycle;
+
+  if (!aSeqEdge.IsNull()) {
+    myEdges = aSeqEdge;
+  }  
+  else {
+    Standard_ConstructionError::Raise();
+  }
+}
+
+Standard_Integer WOKTools_GPath::NodeLength() const 
+{
+  return myEdges->Length() + 1;
+}
+
+Standard_Integer WOKTools_GPath::EdgeLength() const 
+{
+  return myEdges->Length();
+}
+
+Handle(WOKTools_HSequenceOfGNode) WOKTools_GPath::Nodes() const 
+{
+  Handle(WOKTools_HSequenceOfGNode) aSeqNode;
+  Handle(WOKTools_GNode)            aNode;
+  Standard_Integer                  anInt;
+  
+  aSeqNode = new WOKTools_HSequenceOfGNode;
+  
+  for (anInt = 1; anInt <= myEdges->Length(); anInt++) {
+    aNode = myEdges->Value(anInt)->Source(); 
+    
+    aSeqNode->Append(aNode);
+  }
+  
+  if (!myEdges->IsEmpty()) {
+    aSeqNode->Append(myEdges->Value(myEdges->Length())->Destination());
+  }
+
+  return aSeqNode;
+}
+
+Handle(WOKTools_HSequenceOfGEdge) WOKTools_GPath::Edges() const 
+{
+  return myEdges;
+}
+
+Standard_Boolean WOKTools_GPath::IsCycle() const
+{
+  return myCycle;
+}
+
+
+
+
diff --git a/src/WOKTools/WOKTools_HAsciiStringHasher.cdl b/src/WOKTools/WOKTools_HAsciiStringHasher.cdl
new file mode 100755 (executable)
index 0000000..19f2d64
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKTools_HAsciiStringHasher.cdl
+-- Created:    Wed Jun 28 11:12:13 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+class HAsciiStringHasher from WOKTools
+uses
+    HAsciiString from TCollection
+is
+
+   HashCode(myclass; Key : HAsciiString from TCollection) returns Integer;
+           ---Level: Public
+       ---Purpose: Returns a HasCode value  for  the  Key <K>  in the
+       -- range 0..Upper.
+       -- Default ::HashCode(K,Upper)
+           
+   IsEqual(myclass; K1, K2 : HAsciiString from TCollection) returns Boolean;
+       ---Level: Public
+       ---Purpose: Returns True  when the two  keys are the same. Two
+       -- same  keys  must   have  the  same  hashcode,  the
+       -- contrary is not necessary.
+       -- Default K1 == K2
+end;
diff --git a/src/WOKTools/WOKTools_HAsciiStringHasher.cxx b/src/WOKTools/WOKTools_HAsciiStringHasher.cxx
new file mode 100755 (executable)
index 0000000..50873dc
--- /dev/null
@@ -0,0 +1,55 @@
+// File:       WOKTools_HAsciiStringHasher.cxx
+// Created:    Wed Jun 28 11:12:48 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_HAsciiStringHasher.ixx>
+
+
+
+ Standard_Integer WOKTools_HAsciiStringHasher::HashCode (const Handle(TCollection_HAsciiString) &Value)
+{
+  
+  if(Value.IsNull()) return 0;
+
+  register Standard_CString string = Value->ToCString();
+  register int c;
+  register unsigned int result;
+
+  result=0;
+  while(1) {
+    c=*string;
+    string++;
+    if(c==0) break;
+    result += (result << 3) + c;
+  }
+  return result;
+
+#if 0
+  Standard_CString charPtr   = (Standard_CString)Value->ToCString();
+  Standard_Integer aHashCode = 0,  alen,  i  = 0,  pos = 0,  count,  *tmphash;
+  Standard_Character tabchar[20];
+  
+  alen = Value->Length();
+  
+  while(i < alen) {
+    for (count = 0,pos = i;count < sizeof(int); count++) {
+      if (pos + count >= alen)  tabchar[count] = '\0';
+      else tabchar[count] = charPtr[pos + count];
+      i++;
+    }
+    tmphash = (int *)tabchar;   
+    aHashCode = aHashCode ^ *tmphash;
+  }
+  return aHashCode;
+#endif
+}
+
+Standard_Boolean WOKTools_HAsciiStringHasher::IsEqual(const Handle(TCollection_HAsciiString) &K1, const Handle(TCollection_HAsciiString) &K2)
+{
+  if (K1->Length() != K2->Length()) return(Standard_False);
+  if (memcmp(K1->ToCString(), K2->ToCString(), K1->Length()) == 0) return Standard_True;
+  return Standard_False;
+}
+
diff --git a/src/WOKTools/WOKTools_IndexedDataMap.cdl b/src/WOKTools/WOKTools_IndexedDataMap.cdl
new file mode 100755 (executable)
index 0000000..f015ece
--- /dev/null
@@ -0,0 +1,160 @@
+-- File:       WOKTools_IndexedDataMap.cdl
+-- Created:    Mon Jun 17 17:13:41 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1996
+
+
+generic class IndexedDataMap from WOKTools 
+    (TheKey    as any;
+     TheItem   as any;
+     Hasher as any) -- as MapHasher(TheKey)
+inherits BasicMap from WOKTools
+
+       ---Purpose: An indexed map is used  to store keys and to  bind
+       -- an index to them.  Each  new key stored in the map
+       -- gets an index.  Index are  incremented as keys are
+       -- stored in the map. A key can be found by the index
+       -- and an index by the key.  No  key but the last can
+       -- be  removed so the  indices   are in the range 1..
+       -- Extent.  An Item is stored with each key.
+       -- 
+       -- This   class is   similar  to  IndexedMap     from
+       -- WOKTools  with the Item as  a new feature. Note
+       -- the important difference on  the operator  ().  In
+       -- the IndexedMap this operator returns  the Key.  In
+       -- the IndexedDataMap this operator returns the Item.
+       -- 
+       -- See  the  class   Map   from WOKTools   for   a
+       -- discussion about the number of buckets.
+
+raises
+    DomainError  from Standard,
+    OutOfRange   from Standard,
+    NoSuchObject from Standard
+
+is
+
+    Create(NbBuckets : Integer = 1) returns IndexedDataMap from WOKTools;
+       ---Purpose: Creates   a Map with  <NbBuckets> buckets. Without
+       -- arguments the map is automatically dimensioned.
+    
+
+    Create(Other : IndexedDataMap from WOKTools)
+    returns IndexedDataMap from WOKTools
+       ---Purpose: As  copying  Map  is an expensive  operation it is
+       -- incorrect  to  do  it implicitly. This constructor
+       -- will raise an  error if the Map  is not  empty. To copy the 
+       -- content of a  Map use the  Assign  method (operator =).
+    raises DomainError from Standard
+    is private;
+    
+    Assign(me : in out; Other : IndexedDataMap from WOKTools) 
+    returns IndexedDataMap from WOKTools
+       ---Level: Public
+       ---Purpose: Replace the content of this map by  the content of
+       -- the map <Other>.
+       ---C++: alias operator =
+       ---C++: return &
+    is static;
+    
+    ReSize(me : in out; NbBuckets : Integer)
+       ---Level: Public
+       ---Purpose: Changes the  number    of  buckets of  <me>  to be
+       -- <NbBuckets>. The keys  already  stored in  the map are kept.
+    is static;
+    
+    Clear(me : in out)
+       ---Level: Public
+       ---Purpose: Removes all keys in the map.
+       ---C++: alias ~
+    is static;
+    
+    Add(me : in out; K : TheKey; I : TheItem) returns Integer
+       ---Level: Public
+       ---Purpose: Adds  the Key  <K> to the  Map <me>.   Returns the
+       -- index of  the  Key.  The key is new  in the map if
+       -- Extent  has  been  incremented.  The Item  <I>  is
+       -- stored with the key. If the key was already in the
+       -- map the previous item is replaced by <I>.
+    is static;
+
+    Substitute(me : in out; I : Integer; K : TheKey; T : TheItem)
+       ---Level: Public
+       ---Purpose: Substitutes the Key at  index <I>  with  <K>.  <I>
+       -- must be a valid index, <K> must  be a new key. <T>
+       -- becomes the Item stored with <K>.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent.
+        -- Raises DomainError if Contains(K).
+    raises
+       OutOfRange  from Standard, 
+       DomainError from Standard   
+    is static;
+    
+    RemoveLast(me : in out)
+       ---Level: Public
+       ---Purpose: Removes  the last key entered  in the map, i.e the
+       -- key of index Extent().
+        ---Trigger: Raises OutOfRange if Extent() == 0.
+    raises
+       OutOfRange  from Standard  
+    is static;
+
+    Contains(me; K : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True if the key <K>  is stored  in the map <me>. 
+    is static;
+
+    FindNodeFromIndex(me; I:Integer)
+       returns Address is static private;
+    
+    FindKey(me; I : Integer) returns any TheKey
+       ---Level: Public
+       ---Purpose: Returns the Key of index <I>.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+       ---C++: return const &
+    raises OutOfRange from Standard 
+    is static;
+    
+    FindFromIndex(me; I : Integer) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns the Item of index <I>.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+       ---C++: alias operator ()
+       ---C++: return const &
+    raises OutOfRange from Standard 
+    is static;
+    
+    ChangeFromIndex(me : in out; I : Integer) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns  the  Item of index <I>.  The Item  can be
+       -- modified with the syntax aMap(Index) = newItem.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+       ---C++: alias operator ()
+       ---C++: return &
+    raises OutOfRange from Standard 
+    is static;
+    
+    FindIndex(me; K : TheKey) returns Integer
+       ---Level: Public
+       ---Purpose: Returns the index of the key <K>.
+       -- Returns 0 if K is not in the map.
+    is static;
+    
+    FindFromKey(me; K : TheKey) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns the Item of the key <K>
+        ---Trigger: Raises NoSuchObject if K is not in the map.
+    raises NoSuchObject from Standard 
+       ---C++: return const &
+    is static;
+    
+    ChangeFromKey(me : in out; K : TheKey) returns any TheItem
+       ---Level: Public
+       ---Purpose: Returns the Item of the key <K>
+        ---Trigger: Raises NoSuchObject if K is not in the map.
+    raises NoSuchObject from Standard 
+       ---C++: return &
+    is static;
+    
+end IndexedDataMap;
diff --git a/src/WOKTools/WOKTools_IndexedDataMap.gxx b/src/WOKTools/WOKTools_IndexedDataMap.gxx
new file mode 100755 (executable)
index 0000000..0f37f77
--- /dev/null
@@ -0,0 +1,470 @@
+// File:       WOKTools_IndexedDataMap.gxx
+// Created:    Mon Jun 17 20:05:40 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax.paris1.matra-dtv.fr>
+
+#include <Standard_DomainError.hxx>
+#include <Standard_MultiplyDefined.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <WOKTools_BasicMapIterator.hxx>
+
+// Node definition and nodes storage management
+
+#if (defined IRIX || defined WNT)
+
+template <class Key, class Item> class IndexedDataMapNode : public WOKTools_MapNode {
+  public :
+  IndexedDataMapNode(const Key& K1, const Standard_Integer K2, const Item& I, 
+                const Standard_Integer ahashcode, IndexedDataMapNode* n1, IndexedDataMapNode* n2) 
+    : WOKTools_MapNode(n1),key(K1),index(K2),value(I),hashcode(ahashcode),next2(n2) {}
+  void* operator new(size_t aSize) {
+    return aStorageManager.Allocate(aSize);
+  }
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  Key                 key;
+  Standard_Integer    index;
+  Item                value;
+  IndexedDataMapNode* next2;
+  Standard_Integer    hashcode;
+};
+
+#define Node IndexedDataMapNode<TheKey,TheItem>
+
+#else
+
+class Node : public WOKTools_MapNode {
+  public :
+    Node(const TheKey& K1, const Standard_Integer K2, const TheItem& I, 
+        const Standard_Integer ahashcode, Node* n1, Node* n2) :
+      WOKTools_MapNode(n1),key(K1),index(K2),hashcode(ahashcode),next2(n2) { value =I;}
+  void* operator new(size_t aSize) {
+    return aStorageManager.Allocate(aSize);
+  }
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  TheKey                key;
+  Standard_Integer      index;
+  TheItem               value;
+  Node*                 next2;
+  Standard_Integer      hashcode;
+};
+
+#endif
+
+//=======================================================================
+//function : WOKTools_IndexedDataMap
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedDataMap::WOKTools_IndexedDataMap(const Standard_Integer NbBuckets)
+  : WOKTools_BasicMap(NbBuckets,Standard_False)
+{
+}
+
+//=======================================================================
+//function : WOKTools_IndexedDataMap
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedDataMap::WOKTools_IndexedDataMap(const WOKTools_IndexedDataMap& Other) 
+  : WOKTools_BasicMap(Other.NbBuckets(),Standard_False)
+{
+  if (Other.Extent() != 0)
+    Standard_DomainError::Raise("WOKTools:Copy of non empty IndexedDataMap");
+}
+
+//=======================================================================
+//function : Assign
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedDataMap& WOKTools_IndexedDataMap::Assign(const WOKTools_IndexedDataMap& Other)
+{
+  // very simple implementation
+  // not optimal (recompute the hashcode values)
+
+  if (this == &Other) return *this;
+  Clear();
+  ReSize(Other.NbBuckets());
+  Node** data1 = (Node**)myData1;
+  for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
+    Node* OtherNode =  (Node *) Other.FindNodeFromIndex(i);
+    int hashcode = OtherNode->hashcode;
+    int k1 = Index(hashcode,NbBuckets());
+    Node* p = data1[k1];
+    while (p) {
+      if (hashcode == p->hashcode) {
+       if (Hasher::IsEqual(p->key,OtherNode->key)) {
+         break;
+       }
+      }
+      p = (Node*) p->next;
+    }
+    Increment();
+    Node** data2 = (Node**)myData2;
+    Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+    p = new Node(OtherNode->key,OtherNode->index,OtherNode->value,hashcode,data1[k1],data2[k2]);
+    data1[k1] = p;
+    data2[k2] = p;
+  }
+  return *this;
+}
+
+
+
+//=======================================================================
+//function : ReSize
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedDataMap::ReSize(const Standard_Integer N)
+{
+  Node** newdata1;
+  Node** newdata2;
+  Standard_Integer newBuck;
+  if (BeginResize(N,newBuck,
+                 *(Standard_Address*)&newdata1,
+                 *(Standard_Address*)&newdata2)) {
+    Node *p, *q;
+    Standard_Integer i,k1,k2;
+    if (myData1) {
+      Node** olddata1 = (Node**) myData1;
+      for (i = 0; i <= NbBuckets(); i++) {
+       if (olddata1[i]) {
+         p = olddata1[i];
+         while (p) {
+           k1 = Index(Hasher::HashCode(p->key),newBuck);
+           k2 = ::HashCode(p->index,newBuck);
+           q = (Node*)p->next;
+           p->next  = newdata1[k1];
+           p->next2 = newdata2[k2];
+           newdata1[k1] = p;
+           newdata2[k2] = p;
+           p = q;
+         }
+       }
+      }
+    }
+    EndResize(N,newBuck,newdata1,newdata2);
+  }
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedDataMap::Clear()
+{
+  if (!IsEmpty()) {
+    Standard_Integer i;
+    Node** data1 = (Node**) myData1;
+    Node** data2 = (Node**) myData2;
+    Node *p,*q;
+    for (i = 0; i <= NbBuckets(); i++) {
+      p = data1[i];
+      while (p) {
+       q = (Node*) p->next;
+       delete p;
+       p = q;
+      }
+      data1[i] = data2[i] = NULL;
+    }
+  }
+  WOKTools_BasicMap::Destroy();
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+
+Standard_Integer WOKTools_IndexedDataMap::Add(const TheKey& K1, const TheItem& I)
+{
+  if (Resizable())  ReSize(Extent());
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node* p;
+  p = data1[k1];
+  while (p) {
+    if( hashcode == p->hashcode) 
+      if (Hasher::IsEqual(p->key,K1)) 
+       return p->index;
+    p = (Node*) p->next;
+  }
+  Increment();
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+  p = new Node(K1,Extent(),I,hashcode,data1[k1],data2[k2]);
+  data1[k1] = p;
+  data2[k2] = p;
+  return Extent();
+}
+
+
+//=======================================================================
+//function : Substitute
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedDataMap::Substitute(const Standard_Integer I,
+                                           const TheKey& K1,
+                                           const TheItem& T)
+{
+  Standard_OutOfRange_Raise_if(I < 1 || I > Extent(), 
+                              "IndexedMap::Substitute");
+  Node** data1 = (Node**)myData1;
+  Node* p;
+
+  // check if K1 is not already in the map
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  p = data1[k1];
+  while (p) {
+    if(hashcode == p->hashcode)
+      if (Hasher::IsEqual(p->key,K1)) 
+       Standard_DomainError::Raise("IndexedMap::Substitute");
+    p = (Node*) p->next;
+  }
+
+  // Find the node for the index I
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(I,NbBuckets());
+  p = data2[k2];
+  while (p) {
+    if (p->index == I)
+      break;
+    p = (Node*) p->next2;
+  }
+
+  // remove the old key
+  Standard_Integer k = Index(Hasher::HashCode(p->key),NbBuckets());
+  Node* q = data1[k];
+  if (q == p) data1[k] = (Node*) p->next;
+  else {
+    while(q->next != p) q = (Node*) q->next;
+    q->next = p->next;
+  }
+
+  // update the node
+  p->key = K1;
+  p->value = T;
+  p->next = data1[k1];
+  data1[k1] = p;
+}
+
+//=======================================================================
+//function : RemoveLast
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedDataMap::RemoveLast()
+{
+  Standard_OutOfRange_Raise_if(Extent() == 0,
+                              "IndexedMap::RemoveLast");
+  Node** data1 = (Node**)myData1;
+  Node* p;
+  Node* q;
+
+  // Find the node for the last index and remove it
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+  p = data2[k2];
+  q = NULL;
+  while (p) {
+    if (p->index == Extent())
+      break;
+    q = p;
+    p = (Node*) p->next2;
+  }
+  if (q == NULL) 
+    data2[k2] = p->next2;
+  else 
+    q->next2 = p->next2;
+
+  // remove the key
+  Standard_Integer k = Index(Hasher::HashCode(p->key),NbBuckets());
+  q = data1[k];
+  if (q == p) data1[k] = (Node*) p->next;
+  else {
+    while(q->next != p) q = (Node*) q->next;
+    q->next = p->next;
+  }
+
+  Decrement();
+  delete p;
+}
+
+//=======================================================================
+//function : Contains
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_IndexedDataMap::Contains(const TheKey& K1) const
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if( hashcode == p1->hashcode )
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return Standard_True;
+    p1 = (Node*) p1->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : FindNodeFromIndex
+//purpose  : 
+//=======================================================================
+Standard_Address WOKTools_IndexedDataMap::FindNodeFromIndex(const Standard_Integer K2) const
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(K2,NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if (p2->index == K2) 
+      return p2;
+    p2 = p2->next2;
+  }
+  Standard_OutOfRange::Raise("IndexedDataMap : missing index !!!");
+  return p2->key;
+}
+
+//=======================================================================
+//function : FindKey
+//purpose  : 
+//=======================================================================
+const TheKey& WOKTools_IndexedDataMap::FindKey(const Standard_Integer K2) const
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(K2,NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if (p2->index == K2) return p2->key;
+    p2 = p2->next2;
+  }
+  Standard_OutOfRange::Raise("IndexedDataMap : missing index !!!");
+  return p2->key;
+}
+
+//=======================================================================
+//function : FindFromIndex
+//purpose  : 
+//=======================================================================
+const TheItem& WOKTools_IndexedDataMap::FindFromIndex(const Standard_Integer K2) const
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(K2,NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if (p2->index == K2) return p2->value;
+    p2 = p2->next2;
+  }
+  Standard_OutOfRange::Raise("IndexedDataMap : missing index !!!");
+  return p2->value;
+}
+
+//=======================================================================
+//function : ChangeFromIndex
+//purpose  : 
+//=======================================================================
+TheItem& WOKTools_IndexedDataMap::ChangeFromIndex(const Standard_Integer K2)
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(K2,NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if (p2->index == K2) return p2->value;
+    p2 = p2->next2;
+  }
+  Standard_OutOfRange::Raise("IndexedDataMap : missing index !!!");
+  return p2->value;
+}
+
+//=======================================================================
+//function : FindIndex
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKTools_IndexedDataMap::FindIndex(const TheKey& K1) const
+{
+  if (IsEmpty()) return 0;
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if(hashcode == p1->hashcode)
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return p1->index;
+    p1 = (Node*)p1->next;
+  }
+  return 0;
+}
+
+//=======================================================================
+//function : FindFromKey
+//purpose  : 
+//=======================================================================
+const TheItem& WOKTools_IndexedDataMap::FindFromKey(const TheKey& K1) const
+{
+  Standard_OutOfRange_Raise_if(IsEmpty(),"WOKTools_IndexedDataMap::FindFromKey");  
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode =  Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if( hashcode == p1->hashcode )
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return p1->value;
+    p1 = (Node*) p1->next;
+  }
+  Standard_OutOfRange::Raise("WOKTools_IndexedDataMap::FindFromKey");
+  return p1->value;
+}
+
+//=======================================================================
+//function : ChangeFromKey
+//purpose  : 
+//=======================================================================
+TheItem& WOKTools_IndexedDataMap::ChangeFromKey(const TheKey& K1)
+{
+  Standard_OutOfRange_Raise_if(IsEmpty(),"WOKTools_IndexedDataMap::ChangeFromKey");  
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if( hashcode == p1->hashcode)
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return p1->value;
+    p1 = (Node*)p1->next;
+  }
+  Standard_OutOfRange::Raise("WOKTools_IndexedDataMap::ChangeFromKey");
+  return p1->value;
+}
+
+
+
+#ifdef Node
+#undef Node
+#endif
+
diff --git a/src/WOKTools/WOKTools_IndexedMap.cdl b/src/WOKTools/WOKTools_IndexedMap.cdl
new file mode 100755 (executable)
index 0000000..e4efada
--- /dev/null
@@ -0,0 +1,123 @@
+-- File:       WOKTools_IndexedMap.cdl
+-- Created:    Mon Jun 17 17:12:20 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1996
+
+generic class IndexedMap from WOKTools (TheKey as any;
+                                          Hasher as any) -- as MapHasher(TheKey)
+inherits BasicMap from WOKTools
+
+       ---Purpose: An indexed map is used to  store  keys and to bind
+       -- an index to them.  Each new key stored in  the map
+       -- gets an index.  Index are incremented  as keys are
+       -- stored in the map. A key can be found by the index
+       -- and an index by the  key. No key  but the last can
+       -- be  removed so the  indices are  in the range  1..Extent.
+       -- See  the  class   Map   from WOKTools   for   a
+       -- discussion about the number of buckets.
+
+raises
+    DomainError from Standard,
+    OutOfRange  from Standard
+
+is
+
+
+    Create(NbBuckets : Integer = 1) returns IndexedMap from WOKTools;
+       ---Purpose: Creates   a Map with  <NbBuckets> buckets. Without
+       -- arguments the map is automatically dimensioned.
+    
+
+    Create(Other : IndexedMap from WOKTools)
+    returns IndexedMap from WOKTools
+       ---Purpose: As  copying  Map  is an expensive  operation it is
+       -- incorrect  to  do  it implicitly. This constructor
+       -- will raise an  error if the Map  is not  empty. To
+       -- copy the content of a  Map use the  Assign  method (operator =).
+    raises DomainError from Standard
+    is private;
+    
+    
+    Assign(me : in out; Other : IndexedMap from WOKTools) 
+    returns IndexedMap from WOKTools
+       ---Level: Public
+       ---Purpose: Replace the content of this map by  the content of
+       -- the map <Other>.
+       ---C++: alias operator =
+       ---C++: return &
+    is static;
+    
+    ReSize(me : in out; NbBuckets : Integer)
+       ---Level: Public
+       ---Purpose: Changes the  number    of  buckets of  <me>  to be
+       -- <NbBuckets>. The keys  already  stored in  the map are kept.
+    is static;
+    
+    Clear(me : in out)
+       ---Level: Public
+       ---Purpose: Removes all keys in the map.
+       ---C++: alias ~
+    is static;
+    
+    Add(me : in out; K : TheKey) returns Integer
+       ---Level: Public
+       ---Purpose: Adds  the Key <K> to   the Map <me>.  Returns  the
+       -- index  of the Key.  The key is new  in the map  if Extent 
+       -- has been incremented.
+    is static;
+    
+    Substitute(me : in out; I : Integer; K : TheKey)
+       ---Level: Public
+       ---Purpose: Substitutes the Key  at index  <I>  with <K>. 
+       -- <I> must be a valid index, <K> must be a new key.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+        -- Raises DomainError if Contains(K)
+    raises
+       OutOfRange  from Standard,  
+       DomainError from Standard   
+    is static;
+    
+    RemoveLast(me : in out)
+       ---Level: Public
+       ---Purpose: Removes  the last key entered  in the map, i.e the
+       -- key of index Extent().
+        ---Trigger: Raises OutOfRange if Extent() == 0
+    raises
+       OutOfRange  from Standard 
+    is static;
+
+    Contains(me; K : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True if the key <K>  is stored  in the map <me>. 
+    is static;
+    
+    FindNodeFromIndex(me; I : Integer) returns Address from Standard
+       ---Level: Public
+       ---Purpose: Returns the Key of index <I>.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+    raises OutOfRange from Standard 
+    is static private;
+    
+    FindKey(me; I : Integer) returns any TheKey
+       ---Level: Public
+       ---Purpose: Returns the Key of index <I>.
+        ---Trigger: Raises OutOfRange if I < 1 or I > Extent
+       ---C++: alias operator ()
+       ---C++: return const &
+    raises OutOfRange from Standard 
+    is static;
+    
+    FindNodeFromKey(me; K : TheKey) returns Address from Standard
+       ---Level: Public
+       ---Purpose: Returns the Index of K
+    raises OutOfRange from Standard 
+    is static private;
+    
+    FindIndex(me; K : TheKey) returns Integer
+       ---Level: Public
+       ---Purpose: Returns the index of the key <K> Returns 0 if K is
+       -- not in the map.
+    is static;
+    
+end IndexedMap;
diff --git a/src/WOKTools/WOKTools_IndexedMap.gxx b/src/WOKTools/WOKTools_IndexedMap.gxx
new file mode 100755 (executable)
index 0000000..31b999d
--- /dev/null
@@ -0,0 +1,380 @@
+// File:       WOKTools_IndexedMap.gxx
+// Created:    Mon Jun 17 17:15:12 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax.paris1.matra-dtv.fr>
+
+#include <Standard_DomainError.hxx>
+#include <Standard_MultiplyDefined.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <WOKTools_BasicMapIterator.hxx>
+
+// Node definition and nodes storage management
+#if (defined IRIX || defined WNT)
+
+template <class Key> class IndexedMapNode : public WOKTools_MapNode {
+  public :
+  IndexedMapNode(const Key& K1, const Standard_Integer K2, const Standard_Integer ahashcode, IndexedMapNode* n1, IndexedMapNode* n2) 
+    : WOKTools_MapNode(n1),key(K1),index(K2),hashcode(ahashcode),next2(n2) {}
+  void* operator new(size_t aSize) {
+    return aStorageManager.Allocate(aSize);
+  }
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+
+  Key                key;
+  Standard_Integer   index;
+  IndexedMapNode*    next2;
+  Standard_Integer   hashcode;
+};
+
+#define Node IndexedMapNode<TheKey>
+
+
+#else
+
+class Node : public WOKTools_MapNode {
+  public :
+  Node(const TheKey& K, const Standard_Integer theIndex, const Standard_Integer ahashcode, Node* n1, Node* n2) 
+    : WOKTools_MapNode(n1),key(K),index(theIndex),hashcode(ahashcode),next2(n2) {}
+  void* operator new(size_t aSize) {
+    return aStorageManager.Allocate(aSize);
+  }
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+  
+  TheKey             key;
+  Standard_Integer   index;
+  Node*              next2;
+  Standard_Integer   hashcode;
+};
+
+#endif
+
+//=======================================================================
+//function : WOKTools_IndexedMap
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedMap::WOKTools_IndexedMap(const Standard_Integer NbBuckets)
+  : WOKTools_BasicMap(NbBuckets,Standard_False)
+{
+}
+
+//=======================================================================
+//function : WOKTools_IndexedMap
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedMap::WOKTools_IndexedMap(const WOKTools_IndexedMap& Other) 
+  : WOKTools_BasicMap(Other.NbBuckets(),Standard_False)
+{
+  if (!Other.IsEmpty())
+    Standard_DomainError::Raise("WOKTools:Copy of IndexedMap");
+}
+
+//=======================================================================
+//function : Assign
+//purpose  : 
+//=======================================================================
+WOKTools_IndexedMap& WOKTools_IndexedMap::Assign(const WOKTools_IndexedMap& Other)
+{
+  if (this == &Other) return *this;
+  Clear();
+  ReSize(Other.NbBuckets());
+  Node** data1 = (Node**)myData1;
+  for (Standard_Integer i=1; i<= Other.Extent(); i++) {
+    Node *OtherNode = (Node *) Other.FindNodeFromIndex(i);
+    int hashcode = OtherNode->hashcode;
+    int k1 = Index(hashcode,NbBuckets());
+    Node* p = data1[k1];
+    while (p) {
+      if (hashcode == p->hashcode) {
+       if (Hasher::IsEqual(p->key,OtherNode->key)) {
+         break;
+       }
+      }
+      p = (Node*) p->next;
+    }
+    Increment();
+    Node** data2 = (Node**)myData2;
+    Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+    p = new Node(OtherNode->key,OtherNode->index,hashcode,data1[k1],data2[k2]);
+    data1[k1] = p;
+    data2[k2] = p;
+  }
+  return *this;
+}
+
+//=======================================================================
+//function : ReSize
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedMap::ReSize(const Standard_Integer N)
+{
+  Node** newdata1;
+  Node** newdata2;
+  Standard_Integer newBuck;
+  if (BeginResize(N,newBuck,
+                 *(Standard_Address*)&newdata1,*(Standard_Address*)&newdata2)) {
+    if (myData1) {
+      Node** olddata = (Node**) myData1;
+      Node *p, *q;
+      Standard_Integer i,k1,k2;
+      for (i = 0; i <= NbBuckets(); i++) {
+       if (olddata[i]) {
+         p = olddata[i];
+         while (p) {
+           k1 = Index(p->hashcode,newBuck);
+           q = (Node*) p->next;
+           p->next = newdata1[k1];
+           newdata1[k1] = p;
+           if (p->index > 0) {
+             k2 = ::HashCode(p->index,newBuck);
+             p->next2 = newdata2[k2];
+             newdata2[k2] = p;
+           }
+           p = q;
+         }
+       }
+      }
+    }
+    EndResize(N,newBuck,newdata1,newdata2);
+  }
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedMap::Clear()
+{
+  if (!IsEmpty()) {
+    Standard_Integer i;
+    Node** data1 = (Node**) myData1;
+    Node *p,*q;
+    for (i = 0; i <= NbBuckets(); i++) {
+      p = data1[i];
+      while (p) {
+       q = (Node*) p->next;
+       delete p;
+       p = q;
+      }
+    }
+  }
+  WOKTools_BasicMap::Destroy();
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+
+Standard_Integer WOKTools_IndexedMap::Add(const TheKey& K1)
+{
+  if (Resizable())  ReSize(Extent());
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node* p;
+  p = data1[k1];
+  while (p) {
+    if (hashcode == p->hashcode) {
+      if (Hasher::IsEqual(p->key,K1)) 
+       return p->index;
+    }
+    p = (Node*) p->next;
+  }
+  Increment();
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+  p = new Node(K1,Extent(),hashcode,data1[k1],data2[k2]);
+  data1[k1] = p;
+  data2[k2] = p;
+  return Extent();
+}
+
+//=======================================================================
+//function : Substitute
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedMap::Substitute(const Standard_Integer I,
+                                    const TheKey& K1)
+{
+  Standard_OutOfRange_Raise_if(I < 1 || I > Extent(), 
+                              "IndexedMap::Substitute");
+  Node** data1 = (Node**)myData1;
+  Node* p;
+
+  // check if K1 is not already in the map
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  p = data1[k1];
+  while (p) {
+    if (hashcode == p->hashcode) 
+      if (Hasher::IsEqual(p->key,K1)) 
+       Standard_DomainError::Raise("IndexedMap::Substitute");
+    p = (Node*) p->next;
+  }
+
+  // Find the node for the index I
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(I,NbBuckets());
+  p = data2[k2];
+  while (p) {
+    if (p->index == I)
+      break;
+    p = (Node*) p->next2;
+  }
+
+  // remove the old key
+  Standard_Integer k = Index(Hasher::HashCode(p->key),NbBuckets());
+  Node* q = data1[k];
+  if (q == p) data1[k] = (Node*) p->next;
+  else {
+    while(q->next != p) q = (Node*) q->next;
+    q->next = p->next;
+  }
+
+  // update the node
+  p->key = K1;
+  p->next = data1[k1];
+  data1[k1] = p;
+}
+
+//=======================================================================
+//function : RemoveLast
+//purpose  : 
+//=======================================================================
+
+void WOKTools_IndexedMap::RemoveLast()
+{
+  Standard_OutOfRange_Raise_if(Extent() == 0,
+                              "IndexedMap::RemoveLast");
+  Node** data1 = (Node**)myData1;
+  Node* p;
+  Node* q;
+
+  // Find the node for the last index and remove it
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
+  p = data2[k2];
+  q = NULL;
+  while (p) {
+    if (p->index == Extent())
+      break;
+    q = p;
+    p = (Node*) p->next2;
+  }
+  if (q == NULL) 
+    data2[k2] = p->next2;
+  else 
+    q->next2 = p->next2;
+
+  // remove the key
+  Standard_Integer k = Index(Hasher::HashCode(p->key), NbBuckets());
+  q = data1[k];
+  if (q == p) data1[k] = (Node*) p->next;
+  else {
+    while(q->next != p) q = (Node*) q->next;
+    q->next = p->next;
+  }
+  Decrement();
+  delete p;
+}
+
+//=======================================================================
+//function : Contains
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_IndexedMap::Contains(const TheKey& K1) const
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if( hashcode == p1->hashcode)
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return Standard_True;
+    p1 = (Node*) p1->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : FindNodeFromIndex
+//purpose  : 
+//=======================================================================
+Standard_Address WOKTools_IndexedMap::FindNodeFromIndex(const Standard_Integer K2) const
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedMap");
+  Node** data2 = (Node**)myData2;
+  Standard_Integer k2 = ::HashCode(K2,NbBuckets());
+  Node *p2;
+  p2 = data2[k2];
+  while (p2) {
+    if (p2->index == K2) return p2;
+    p2 = p2->next2;
+  }
+  Standard_OutOfRange::Raise("IndexedMap : missing index !!!");
+  return p2;  
+}
+
+//=======================================================================
+//function : FindKey
+//purpose  : 
+//=======================================================================
+const TheKey& WOKTools_IndexedMap::FindKey(const Standard_Integer K2) const
+{
+  Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedMap");
+
+  return ((Node *)FindNodeFromIndex(K2))->key;
+}
+
+//=======================================================================
+//function : FindNodeFromKey
+//purpose  : 
+//=======================================================================
+Standard_Address WOKTools_IndexedMap::FindNodeFromKey(const TheKey& K1) const
+{
+  if (IsEmpty()) return 0;
+  Node** data1 = (Node**)myData1;
+  Standard_Integer hashcode = Hasher::HashCode(K1);
+  Standard_Integer k1 = Index(hashcode,NbBuckets());
+  Node *p1;
+  p1 = data1[k1];
+  while (p1) {
+    if(hashcode == p1->hashcode)
+      if (Hasher::IsEqual(p1->key,K1)) 
+       return p1;
+    p1 = (Node*) p1->next;
+  }
+  return NULL;
+}
+
+//=======================================================================
+//function : FindIndex
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKTools_IndexedMap::FindIndex(const TheKey& K1) const
+{
+  if (IsEmpty()) return 0;
+  
+  Node *p = (Node *)FindNodeFromKey(K1);
+
+  if(p) return p->index;
+  return 0;
+}
+
+
+#ifdef Node
+#undef Node
+#endif
+
diff --git a/src/WOKTools/WOKTools_Info.cdl b/src/WOKTools/WOKTools_Info.cdl
new file mode 100755 (executable)
index 0000000..2aba810
--- /dev/null
@@ -0,0 +1,23 @@
+-- File:       WOKTools_Info.cdl
+-- Created:    Wed Jun 28 18:26:08 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Info from WOKTools 
+inherits Message from WOKTools
+
+       ---Purpose: Information messages
+
+uses
+    AsciiString from TCollection
+is
+    
+    Create returns Info from WOKTools;
+
+    Code(me)
+       returns Character from Standard
+       is redefined;
+               
+end Info;
diff --git a/src/WOKTools/WOKTools_Info.cxx b/src/WOKTools/WOKTools_Info.cxx
new file mode 100755 (executable)
index 0000000..f37f310
--- /dev/null
@@ -0,0 +1,16 @@
+
+#include <stream.h>
+
+#include <WOKTools_Info.ixx>
+
+Standard_EXPORT WOKTools_Info InfoMsg;
+
+
+
+WOKTools_Info::WOKTools_Info() : WOKTools_Message("WOK_INFO", "Info    : ")
+{
+  Set();
+}
+
+Standard_Character WOKTools_Info::Code() const 
+{return 'I';}
diff --git a/src/WOKTools/WOKTools_InterpFileValue.cdl b/src/WOKTools/WOKTools_InterpFileValue.cdl
new file mode 100755 (executable)
index 0000000..1a0d170
--- /dev/null
@@ -0,0 +1,43 @@
+-- File:       WOKTools_InterFileValue.cdl
+-- Created:    Tue Sep 24 14:53:45 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1996
+
+
+class InterpFileValue from WOKTools 
+inherits ReturnValue from WOKTools
+
+       ---Purpose: 
+
+uses
+    InterpFileType from WOKTools,
+    HAsciiString   from TCollection
+    
+is
+
+    Create(afile : HAsciiString from TCollection; atype : InterpFileType from WOKTools = WOKTools_CShell)
+       returns InterpFileValue from WOKTools;
+       
+    InterpFormat(myclass; atype : InterpFileType from WOKTools)
+       returns HAsciiString from TCollection;
+       
+    InterpType(myclass; aformat : HAsciiString from TCollection)
+       returns InterpFileType from WOKTools;
+       
+    FileName(myclass; atype : InterpFileType from WOKTools; abasename : HAsciiString from TCollection)
+       returns HAsciiString from TCollection;
+
+    SetFile(me:mutable; afile : HAsciiString from TCollection);
+    File(me) returns HAsciiString from TCollection;
+    
+    SetInterpType(me:mutable; atype : InterpFileType from WOKTools);
+    InterpType(me) returns InterpFileType from WOKTools;
+
+
+fields
+     
+    myfile : HAsciiString   from TCollection;
+    mytype : InterpFileType from WOKTools;
+
+end InterpFileValue;
diff --git a/src/WOKTools/WOKTools_InterpFileValue.cxx b/src/WOKTools/WOKTools_InterpFileValue.cxx
new file mode 100755 (executable)
index 0000000..6a67489
--- /dev/null
@@ -0,0 +1,166 @@
+
+
+#include <WOKTools_InterpFileValue.ixx>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : WOKTools_InterpFileValue
+//purpose  : 
+//=======================================================================
+WOKTools_InterpFileValue::WOKTools_InterpFileValue(const Handle(TCollection_HAsciiString)& afile,
+                                                  const WOKTools_InterpFileType atype)
+  : myfile(afile), mytype(atype)
+{
+  SetType(WOKTools_InterpFile);
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : FileName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_InterpFileValue::FileName(const WOKTools_InterpFileType atype,
+                                                                   const Handle(TCollection_HAsciiString)& abase)
+{
+  Handle(TCollection_HAsciiString) NULLRESULT, result = new TCollection_HAsciiString(abase);
+
+  switch (atype) 
+    {
+    case WOKTools_BourneShell:
+      result->AssignCat(".sh");
+      break;
+    case WOKTools_CShell:
+      result->AssignCat(".csh");
+      break;
+    case WOKTools_KornShell:
+      result->AssignCat(".ksh");
+      break;
+    case WOKTools_TclInterp:
+      result->AssignCat(".tcl");
+      break;
+    case WOKTools_EmacsLisp:
+      result->AssignCat(".el");
+      break;
+    case WOKTools_WNTCmd:
+      result->AssignCat(".cmd");
+      break;
+    default:
+      return NULLRESULT;
+    }
+  return result;
+}
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : FileName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_InterpFileValue::InterpFormat(const WOKTools_InterpFileType atype)
+{
+  Handle(TCollection_HAsciiString) NULLRESULT;
+
+  switch (atype) 
+    {
+    case WOKTools_BourneShell:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("sh");
+       return astr;
+      }
+    case WOKTools_CShell:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("csh");
+       return astr;
+      }
+    case WOKTools_KornShell:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("ksh");
+       return astr;
+      }
+    case WOKTools_TclInterp:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("tcl");
+       return astr;
+      }
+    case WOKTools_EmacsLisp:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("emacs");
+       return astr;
+      }
+    case WOKTools_WNTCmd:
+      {
+       static Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString("cmd");
+       return astr;
+      }
+    default:
+      return NULLRESULT;
+    }
+  return NULLRESULT;
+}
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : InterpType
+//purpose  : 
+//=======================================================================
+WOKTools_InterpFileType WOKTools_InterpFileValue::InterpType(const Handle(TCollection_HAsciiString)& atype)
+{
+  WOKTools_InterpFileType result;
+
+  if(!atype.IsNull())
+    {
+      Standard_CString astr = atype->ToCString();
+
+      if(!strcmp(astr, "sh"))    return WOKTools_BourneShell;
+      if(!strcmp(astr, "csh"))   return WOKTools_CShell;
+      if(!strcmp(astr, "ksh"))   return WOKTools_KornShell;
+      if(!strcmp(astr, "tcl"))   return WOKTools_TclInterp;
+      if(!strcmp(astr, "emacs")) return WOKTools_EmacsLisp;
+      if(!strcmp(astr, "cmd"))   return WOKTools_WNTCmd;
+    }
+  return WOKTools_CShell;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetFile
+//purpose  : 
+//=======================================================================
+void WOKTools_InterpFileValue::SetFile(const Handle(TCollection_HAsciiString)& afile) 
+{
+  myfile = afile;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : File
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_InterpFileValue::File() const
+{
+  return myfile;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetInterpType
+//purpose  : 
+//=======================================================================
+void WOKTools_InterpFileValue::SetInterpType(const WOKTools_InterpFileType atype) 
+{
+  mytype = atype;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : InterpType
+//purpose  : 
+//=======================================================================
+WOKTools_InterpFileType WOKTools_InterpFileValue::InterpType() const
+{
+  return mytype;
+}
+
+
+
diff --git a/src/WOKTools/WOKTools_Map.cdl b/src/WOKTools/WOKTools_Map.cdl
new file mode 100755 (executable)
index 0000000..3c41788
--- /dev/null
@@ -0,0 +1,109 @@
+-- File:       WOKTools_Map.cdl
+-- Created:    Mon Jun 26 16:39:25 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+generic class Map from WOKTools (TheKey as any;
+                                Hasher as any) -- as MapHasher(TheKey)
+inherits BasicMap from WOKTools
+
+    ---Purpose: WOK oriented (String) Map
+
+raises
+    DomainError from Standard
+    
+    class MapIterator inherits BasicMapIterator from WOKTools
+    
+       ---Purpose: Provides iteration on  the content of  a map.  The
+       -- iteration    methods    are  inherited   from  the
+       -- BasicMapIterator.
+       ---Warning: While using an iterator on a map if the content of
+       -- the map  is   modified  during the  iteration  the
+       -- result is unpredictable.
+       
+    raises NoSuchObject from Standard
+    is
+               Create returns MapIterator from WOKTools;
+           ---Purpose: Creates an undefined Iterator (empty).
+       
+       Create (aMap : Map from WOKTools) 
+       returns MapIterator from WOKTools;
+           ---Purpose: Creates an Iterator on the map <aMap>.
+       
+       Initialize(me : in out; aMap : Map from WOKTools)
+           ---Level: Public
+           ---Purpose: Resets the Iterator in the map <aMap>.
+       is static;
+       
+       Key(me) returns any TheKey
+           ---Level: Public
+           ---Purpose: Returns the current Key. An error is raised if
+           -- the iterator is empty (More returns False).
+           ---C++: return const &
+       raises
+           NoSuchObject from Standard
+       is static;
+
+       Hashcode(me) returns Integer from Standard
+       raises
+           NoSuchObject from Standard
+       is static;
+
+    end MapIterator from WOKTools;
+
+is
+
+    Create(NbBuckets : Integer = 1) returns Map from WOKTools;
+       ---Purpose: Creates   a Map with  <NbBuckets> buckets. Without
+       -- arguments the map is automatically dimensioned.
+    
+
+    Create(Other : Map from WOKTools) returns Map from WOKTools
+       ---Purpose: As  copying  Map  is an expensive  operation it is
+       -- incorrect  to  do  it implicitly. This constructor
+       -- will raise an  error if the Map  is not  empty. To
+       -- copy the content of a  Map use the  Assign  method (operator =).
+    raises DomainError from Standard
+    is private;
+    
+    Assign(me : in out; Other : Map from WOKTools) 
+    returns Map from WOKTools
+       ---Level: Public
+       ---Purpose: Replace the content of this map by  the content of
+       -- the map <Other>.
+       ---C++: alias operator =
+       ---C++: return &
+    is static;
+    
+    ReSize(me : in out; NbBuckets : Integer)
+       ---Level: Public
+       ---Purpose: Changes the  number    of  buckets of  <me>  to be
+       -- <NbBuckets>. The keys  already  stored in  the map are kept.
+    is static;
+    
+    Clear(me : in out)
+       ---Level: Public
+       ---Purpose: Removes all keys in the map.
+       ---C++: alias ~
+    is static;
+    
+    Add(me : in out; aKey : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Adds the Key <aKey> to  the Map <me>. Returns True
+       -- if the Key was not already in the Map.
+    is static;
+
+    Contains(me; aKey : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Returns True  if the key  <aKey> is stored  in the
+       -- map <me>.
+    is static;
+    
+    Remove(me : in out; aKey : TheKey) returns Boolean
+       ---Level: Public
+       ---Purpose: Removes the Key <aKey> from the  map. Returns True
+       -- if the Key was in the Map.
+    is static;
+    
+end Map;
diff --git a/src/WOKTools/WOKTools_Map.gxx b/src/WOKTools/WOKTools_Map.gxx
new file mode 100755 (executable)
index 0000000..912b73e
--- /dev/null
@@ -0,0 +1,262 @@
+// File:       WOKTools_Map.gxx
+// Created:    Thu Jan  7 18:14:26 1993
+// Author:     Remi LEQUETTE
+//             <rle@phylox>
+
+
+#include <Standard_DomainError.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+// Node definition and nodes storage management
+
+#if (defined IRIX || defined WNT)
+
+template <class TheKey> class MapNode : public WOKTools_MapNode {
+  public :
+    MapNode(const TheKey& K, const Standard_Integer ahascode, MapNode* n) : WOKTools_MapNode(n),key(K), hashcode(ahascode) {}
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+  TheKey   key;
+  Standard_Integer hashcode;
+};
+
+#define Node MapNode<TheKey>
+
+#else
+
+class Node : public WOKTools_MapNode {
+  public :
+    Node(const TheKey& K, const Standard_Integer ahascode, Node* n) : WOKTools_MapNode(n),key(K), hashcode(ahascode) {}
+  void* operator new(size_t aSize) 
+    {return aStorageManager.Allocate(aSize);}
+  void  operator delete(void* aNode, size_t aSize) {
+    aStorageManager.Free(aNode,aSize);
+  }
+  TheKey   key;
+  Standard_Integer hashcode;
+};
+#endif
+
+//=======================================================================
+//function : WOKTools_Map
+//purpose  : 
+//=======================================================================
+
+WOKTools_Map::WOKTools_Map(const Standard_Integer NbBuckets) :
+       WOKTools_BasicMap(NbBuckets,Standard_True)
+{
+}
+
+//=======================================================================
+//function : WOKTools_Map
+//purpose  : 
+//=======================================================================
+
+WOKTools_Map::WOKTools_Map(const WOKTools_Map& Other) :
+       WOKTools_BasicMap(Other.NbBuckets(),Standard_True)
+{
+  if (Other.Extent() != 0)
+    Standard_DomainError::Raise("WOKTools:Copy of Map");
+}
+
+//=======================================================================
+//function : Assign
+//purpose  : 
+//=======================================================================
+
+WOKTools_Map& WOKTools_Map::Assign(const WOKTools_Map& Other)
+{
+  if (this == &Other) return *this;
+  Clear();
+  ReSize(Other.NbBuckets());
+  Node** data = (Node**)myData1;
+  for (WOKTools_MapIterator It(Other); It.More(); It.Next()) {
+    int hashcode = It.Hashcode();
+    int k = Index(hashcode,NbBuckets());
+    Node* p = data[k];
+    while (p) {
+      if (hashcode == p->hashcode) {
+       if (Hasher::IsEqual(p->key,It.Key())) {
+         break;
+       }
+      }
+      p = (Node*) p->next;
+    }
+    Increment();
+    data[k] = new Node(It.Key(),hashcode,data[k]);
+  }
+
+  return *this;
+}
+
+
+//=======================================================================
+//function : ReSize
+//purpose  : 
+//=======================================================================
+
+void WOKTools_Map::ReSize(const Standard_Integer N)
+{
+  Node** newdata;
+  Node** dummy;
+  Standard_Integer newBuck;
+  if (BeginResize(N,newBuck,
+                 *(Standard_Address*)&newdata,*(Standard_Address*)&dummy)) {
+    if (myData1) {
+      Node** olddata = (Node**) myData1;
+      Node *p, *q;
+      Standard_Integer i,k;
+      for (i = 0; i <= NbBuckets(); i++) {
+       if (olddata[i]) {
+         p = olddata[i];
+         while (p) {
+           k = Index(p->hashcode,newBuck);
+           q = (Node*) p->next;
+           p->next = newdata[k];
+           newdata[k] = p;
+           p = q;
+         }
+       }
+      }
+    }
+    EndResize(N,newBuck,newdata,dummy);
+  }
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+
+void WOKTools_Map::Clear()
+{
+  if (!IsEmpty()) {
+    Standard_Integer i;
+    Node** data = (Node**) myData1;
+    Node *p,*q;
+    for (i = 0; i <= NbBuckets(); i++) {
+      if (data[i]) {
+       p = data[i];
+       while (p) {
+         q = (Node*)p->next;
+         delete p;
+         p = q;
+       }
+      }
+    }
+  }
+  WOKTools_BasicMap::Destroy();
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_Map::Add(const TheKey& K)
+{
+  if (Resizable()) ReSize(Extent());
+  Node** data = (Node**)myData1;
+  int hashcode = Hasher::HashCode(K);
+  int k = Index(hashcode,NbBuckets());
+  Node* p = data[k];
+  while (p) {
+    if (hashcode == p->hashcode) {
+      if (Hasher::IsEqual(p->key,K)) {
+       return Standard_False;
+      }
+    }
+    p = (Node*) p->next;
+  }
+  Increment();
+  data[k] = new Node(K,hashcode,data[k]);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Contains
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_Map::Contains(const TheKey& K) const
+{
+  if (IsEmpty()==Standard_True) return Standard_False;
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  Node* p = data[Index(hashcode,NbBuckets())];
+  while (p) {
+    if ( hashcode == p->hashcode ) {
+      if (Hasher::IsEqual(p->key,K)) {
+       return Standard_True;
+      }
+    }
+    p = (Node*) p->next;
+  }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : Remove
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKTools_Map::Remove(const TheKey& K)
+{
+  if (IsEmpty()) return Standard_False;
+  Node** data = (Node**) myData1;
+  int hashcode = Hasher::HashCode(K);
+  int k = Index(hashcode, NbBuckets());
+  Node* p = data[k];
+  Node* q = NULL;
+  while (p) {
+    if ( hashcode == p->hashcode ) {
+      if (Hasher::IsEqual(p->key,K)) {
+       Decrement();
+       if (q) q->next = p->next;
+       else   data[k] = (Node*) p->next;
+       delete p;
+       return Standard_True;
+      }
+    }
+    q = p;
+    p = (Node*) p->next;
+  }
+  return Standard_False;
+}
+
+
+// method of the iterator
+
+//=======================================================================
+//function : Key
+//purpose  : 
+//=======================================================================
+
+const TheKey& WOKTools_MapIterator::Key() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_MapIterator::Key");  
+  return ((Node*) myNode)->key;
+}
+
+
+// method of the iterator
+
+//=======================================================================
+//function : Hashcode
+//purpose  : 
+//=======================================================================
+
+Standard_Integer WOKTools_MapIterator::Hashcode() const
+{
+  Standard_NoSuchObject_Raise_if(!More(),"WOKTools_MapIterator::HashCode");  
+  return ((Node*) myNode)->hashcode;
+}
+
+
+#ifdef Node
+#undef Node
+#endif
+
diff --git a/src/WOKTools/WOKTools_MapIterator.gxx b/src/WOKTools/WOKTools_MapIterator.gxx
new file mode 100755 (executable)
index 0000000..6378c8f
--- /dev/null
@@ -0,0 +1,31 @@
+// File:       WOKTools_MapIterator.gxx
+
+
+//=======================================================================
+//function : WOKTools_MapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_MapIterator::WOKTools_MapIterator() :
+       WOKTools_BasicMapIterator()
+{}
+
+//=======================================================================
+//function : WOKTools_MapIterator
+//purpose  : 
+//=======================================================================
+
+WOKTools_MapIterator::WOKTools_MapIterator(const WOKTools_Map& aMap) :
+       WOKTools_BasicMapIterator(aMap)
+{}
+
+//=======================================================================
+//function : WOKTools_MapIterator
+//purpose  : 
+//=======================================================================
+
+void WOKTools_MapIterator::Initialize(const WOKTools_Map& aMap)
+{
+  WOKTools_BasicMapIterator::Initialize(aMap);
+}
+
diff --git a/src/WOKTools/WOKTools_Message.cdl b/src/WOKTools/WOKTools_Message.cdl
new file mode 100755 (executable)
index 0000000..78eec2e
--- /dev/null
@@ -0,0 +1,124 @@
+-- File:       WOKTools_Message.cdl
+-- Created:    Wed Jun 28 18:23:36 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Message from WOKTools 
+
+       ---Purpose: WOK Messages Support
+
+uses
+    MsgHandler   from WOKTools,
+    MsgControl   from WOKTools,
+    MsgStreamPtr from WOKTools,
+    AsciiString  from TCollection,
+    HAsciiString from TCollection,
+    Integer      from Standard,
+    Boolean      from Standard,
+    CString      from Standard
+is
+
+    Initialize(aclass:CString from Standard; aheader : CString from Standard);
+
+    Init(me:out);
+
+    Code(me)
+       returns Character from Standard
+       is deferred;
+
+    Print(me:out; astr : CString from Standard) 
+    ---C++: return  &
+    ---C++: alias operator <<    
+       returns Message from WOKTools;
+
+    Print(me:out; astr : HAsciiString from TCollection) 
+    ---C++: return &
+    ---C++: alias operator <<    
+       returns Message from WOKTools;    
+       
+    Print(me:out; aint : Integer from Standard) 
+    ---C++: return &
+    ---C++: alias operator <<    
+       returns Message from WOKTools;
+
+    Print(me:out; achar : Character from Standard) 
+    ---C++: return &
+    ---C++: alias operator <<    
+       returns Message from WOKTools;
+
+    MsgControl(me:out; ahandler : MsgControl from WOKTools) 
+    ---C++: return &
+    ---C++: alias operator <<    
+       returns Message from WOKTools;
+
+    Set(me:out);
+    UnSet(me:out);
+    IsSet(me) returns Boolean from Standard;
+    ---C++: inline
+
+    DoPrintHeader(me:out); 
+    DontPrintHeader(me:out); 
+    PrintHeader(me)  returns Boolean from Standard; 
+    ---C++: inline
+    
+    DoPrintContext(me:out);
+    DontPrintContext(me:out);
+    PrintContext(me) returns Boolean from Standard;
+    ---C++: inline
+
+    Switcher(me)
+    ---C++: inline
+       returns CString from Standard is protected;
+       
+    SetSwitcher(me:out; aswitcher : CString from Standard) is protected; 
+    
+    SetEndMsgHandler(me : out; ahandler : MsgHandler from WOKTools);
+    EndMsgHandler(me)
+    ---C++: inline
+       returns MsgHandler from WOKTools;
+
+    SetIndex(me:out; anindex : Integer from Standard);
+    Index(me) 
+    ---C++: inline
+       returns Integer from Standard;
+       
+    Message(me) 
+    ---C++: inline
+    ---C++: return const &
+       returns HAsciiString from TCollection;
+       
+    ToPrint(me)
+    ---C++: inline
+       returns CString from Standard;
+       
+    
+    LogToFile(me : out ; afile : HAsciiString from TCollection)
+       returns Boolean from Standard;
+    
+    LogToStream(me:out; astream : MsgStreamPtr from WOKTools)
+       returns Boolean from Standard;
+    
+    EndLogging(me: out );
+    
+    LogStream(me)
+    ---C++: inline
+       returns MsgStreamPtr from WOKTools;
+    
+fields 
+
+    myheader       : CString      from Standard;
+    mymessage      : HAsciiString from TCollection;
+    myindex        : Integer      from Standard;
+    myison         : Boolean      from Standard;
+    myprintcontext : Boolean      from Standard;
+    myprintheader  : Boolean      from Standard;
+    myswitcher     : CString      from Standard;
+    myendmsghandlr : MsgHandler   from WOKTools;
+    
+    mylogflag      : Boolean      from Standard;
+    mylogfile      : HAsciiString from TCollection;
+    mylogstream    : MsgStreamPtr from WOKTools;
+    
+end Message;
diff --git a/src/WOKTools/WOKTools_Message.cxx b/src/WOKTools/WOKTools_Message.cxx
new file mode 100755 (executable)
index 0000000..69a8228
--- /dev/null
@@ -0,0 +1,398 @@
+
+
+#include <WOKTools_Message.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+WOKTools_Message& DefaultEndMsgHandler(WOKTools_Message& amsgq, const Standard_Boolean newline)
+{
+  if(amsgq.Message().IsNull() == Standard_False)
+    {
+      if(newline)
+       {
+         cerr << amsgq.ToPrint() << endl;
+       }
+      else
+       {
+         cerr << amsgq.ToPrint() << flush;
+       }
+    }
+  return amsgq;
+}
+
+//=======================================================================
+//function : FileLogEndMsgHandler
+//purpose  : 
+//=======================================================================
+WOKTools_Message& FileLogEndMsgHandler(WOKTools_Message& amsgq, const Standard_Boolean newline)
+{
+  if(amsgq.LogStream() == NULL) return amsgq;
+
+  ofstream& astream = *(amsgq.LogStream());
+  if(amsgq.Message().IsNull() == Standard_False)
+    {
+      astream << amsgq.ToPrint();
+      if(newline) {
+       astream << endl;
+      } else {
+       astream << flush;
+      }
+    }
+  return amsgq;
+}
+
+//=======================================================================
+//function : WOKTools_Message
+//purpose  : 
+//=======================================================================
+ WOKTools_Message::WOKTools_Message(const Standard_CString aclass, const Standard_CString aheader)
+   : myheader(aheader), myswitcher(aclass), myison(Standard_True), myprintcontext(Standard_False), myprintheader(Standard_True), 
+     myendmsghandlr(DefaultEndMsgHandler), myindex(1), mylogstream(NULL), mylogflag(Standard_False)
+{
+}
+
+//=======================================================================
+//function : Init
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::Init() 
+{
+  mymessage.Nullify();
+  myindex = 1;
+}
+//=======================================================================
+//function : Set
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::Set()
+{
+  myison = Standard_True;
+}
+
+//=======================================================================
+//function : UnSet
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::UnSet()
+{
+  myison = Standard_False;
+}
+
+//=======================================================================
+//function : DoPrintContext
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::DoPrintContext()
+{
+  myprintcontext = Standard_True;
+}
+
+//=======================================================================
+//function : DontPrintContext
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::DontPrintContext()
+{
+  myprintcontext = Standard_False;
+}
+
+//=======================================================================
+//function : DoPrintHeader
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::DoPrintHeader()
+{
+  myprintheader = Standard_True;
+}
+
+//=======================================================================
+//function : DontPrintHeader
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::DontPrintHeader()
+{
+  myprintheader = Standard_False;
+}
+
+
+//=======================================================================
+//function : SetSwitcher
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::SetSwitcher(const Standard_CString aswitcher)
+{
+  myswitcher = aswitcher;
+}
+
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+WOKTools_Message& WOKTools_Message::Print(const Standard_CString astr) 
+{
+  // se poser la question de savoir si un msg est commence ou non 
+  if(myison == Standard_True)
+    {
+      if(mymessage.IsNull() == Standard_True) 
+       {
+         if(myprintheader)
+           {
+             mymessage = new TCollection_HAsciiString(myheader);
+           }
+         else
+           {
+             mymessage = new TCollection_HAsciiString;
+           }
+         if(myprintcontext == Standard_True)
+           {
+             if(astr != NULL)
+               {
+                 mymessage->AssignCat(astr);
+                 mymessage->AssignCat(" : ");
+               }
+           }
+       }
+      else
+       {
+         if(astr != NULL)
+           {
+             mymessage->AssignCat(astr);
+           }
+         else
+           {
+             mymessage->AssignCat("NULL");
+           }
+       }
+    }
+  return *this;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+WOKTools_Message& WOKTools_Message::Print(const Standard_Integer astr) 
+{
+  // se poser la question de savoir si un msg est commence ou non 
+  if(myison == Standard_True)
+    {
+      if(mymessage.IsNull() == Standard_True) 
+       {
+         if(myprintheader)
+           {
+             mymessage = new TCollection_HAsciiString(myheader);
+           }
+         else
+           {
+             mymessage = new TCollection_HAsciiString;
+           }
+         if(myprintcontext == Standard_True)
+           {
+             mymessage->AssignCat(new TCollection_HAsciiString(astr));
+             mymessage->AssignCat(" : ");
+           }
+       }
+      else
+       {
+         mymessage->AssignCat(new TCollection_HAsciiString(astr));
+       }
+    }
+  return *this;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+WOKTools_Message& WOKTools_Message::Print(const Standard_Character achar) 
+{
+  // se poser la question de savoir si un msg est commence ou non 
+  if(myison == Standard_True)
+    {
+      if(mymessage.IsNull() == Standard_True) 
+       {
+         if(myprintheader)
+           {
+             mymessage = new TCollection_HAsciiString(myheader);
+           }
+         else
+           {
+             mymessage = new TCollection_HAsciiString;
+           }
+         if(myprintcontext == Standard_True)
+           {
+             mymessage->AssignCat(new TCollection_HAsciiString(achar));
+             mymessage->AssignCat(" : ");
+           }
+       }
+      else
+       {
+         mymessage->AssignCat(new TCollection_HAsciiString(achar));
+       }
+    }
+  return *this;
+}
+
+//=======================================================================
+//function : Print
+//purpose  : 
+//=======================================================================
+WOKTools_Message& WOKTools_Message::Print(const Handle(TCollection_HAsciiString)& astr) 
+{
+  // se poser la question de savoir si un msg est commence ou non 
+  if(myison == Standard_True)
+    {
+      if(mymessage.IsNull()) 
+       {
+         if(myprintheader)
+           {
+             mymessage = new TCollection_HAsciiString(myheader);
+           }
+         else
+           {
+             mymessage = new TCollection_HAsciiString;
+           }
+         if(myprintcontext == Standard_True)
+           {
+             if(astr.IsNull())
+               mymessage->AssignCat("(nil)");
+             else
+               {
+                 mymessage->AssignCat(astr);
+               }
+             mymessage->AssignCat(" : ");
+           }
+       }
+      else
+       {
+         if(astr.IsNull())
+           {
+             mymessage->AssignCat("(Null String)");
+           }
+         else
+           {
+             mymessage->AssignCat(astr);
+           }
+       }
+    }
+  return *this;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : MsgControl
+//purpose  : 
+//=======================================================================
+WOKTools_Message& WOKTools_Message::MsgControl(const WOKTools_MsgControl ahandler) 
+{
+  return (*ahandler)(*this);
+}
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetEndMsgHandler
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::SetEndMsgHandler(const WOKTools_MsgHandler& ahandler)
+{
+  myendmsghandlr = ahandler;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetIndex
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::SetIndex(const Standard_Integer anindex) 
+{
+  myindex = anindex;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : LogToFile
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Message::LogToFile(const Handle(TCollection_HAsciiString)& afile)
+{
+  if(!afile.IsNull())
+    {
+      mylogstream = new ofstream(afile->ToCString(),ios::out);
+
+      if(mylogstream->good())
+       {
+         mylogfile = afile;
+         mylogflag = Standard_True;
+         return Standard_True;
+       }
+    }
+
+  return Standard_False;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : LogToFile
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Message::LogToStream(const WOKTools_MsgStreamPtr& astream)
+{
+  if(astream != NULL)
+    {
+      EndLogging();
+      if(astream->good())
+       {
+         mylogstream = astream;
+         mylogflag = Standard_True;
+         mylogfile.Nullify();
+         return Standard_True;
+       }
+    }
+
+  return Standard_False;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : EndLogging
+//purpose  : 
+//=======================================================================
+void WOKTools_Message::EndLogging()
+{
+  if(mylogstream != NULL)
+    {
+      if(!mylogfile.IsNull())
+       {
+         mylogfile.Nullify();
+         mylogflag = Standard_False;
+         mylogstream->close();
+         delete mylogstream;
+       }
+      else
+       {
+         mylogstream = NULL;
+         mylogflag = Standard_False;
+       }
+    }
+}
+
+
+WOKTools_Message& endm(WOKTools_Message& amsgq)
+{
+   WOKTools_Message& result = (*amsgq.EndMsgHandler())(amsgq, Standard_True);
+   amsgq.Init();
+   return result;
+}
+
+WOKTools_Message& flushm(WOKTools_Message& amsgq)
+{
+  WOKTools_Message& result = (*amsgq.EndMsgHandler())(amsgq, Standard_False);
+  result.SetIndex(amsgq.Message()->Length()+1);
+  return result;
+}
+
+
diff --git a/src/WOKTools/WOKTools_Message.lxx b/src/WOKTools/WOKTools_Message.lxx
new file mode 100755 (executable)
index 0000000..999756c
--- /dev/null
@@ -0,0 +1,107 @@
+// File:       WOKTools_Message.lxx
+// Created:    Tue Dec  5 19:50:22 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+
+#include <TCollection_HAsciiString.hxx>
+
+
+extern WOKTools_Message& FileLogEndMsgHandler(WOKTools_Message& amsgq, const Standard_Boolean newline);
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : IsSet
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Message::IsSet() const
+{
+  return myison;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : PrintContext
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Message::PrintContext() const
+{
+  return myprintcontext;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : PrintContext
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Message::PrintHeader() const
+{
+  return myprintheader;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Index
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKTools_Message::Index() const
+{
+  return myindex;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : EndMsgHandler
+//purpose  : 
+//=======================================================================
+WOKTools_MsgHandler WOKTools_Message::EndMsgHandler() const
+{
+  if(!mylogflag)
+    return myendmsghandlr;
+  else
+    return FileLogEndMsgHandler;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Message
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKTools_Message::Message() const
+{
+  return mymessage;
+}
+
+//=======================================================================
+//function : Switcher
+//purpose  : 
+//=======================================================================
+Standard_CString WOKTools_Message::Switcher() const
+{
+  return myswitcher;
+}
+//=======================================================================
+//function : LogStream
+//purpose  : 
+//=======================================================================
+WOKTools_MsgStreamPtr WOKTools_Message::LogStream() const
+{
+  return mylogstream;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : ToPrint
+//purpose  : 
+//=======================================================================
+ Standard_CString WOKTools_Message::ToPrint() const
+{
+  static char EMPTY[1] = "" ;
+  if(myindex == 1)
+    return mymessage->ToCString();
+  else if(myindex < mymessage->Length()) {
+    return &(mymessage->ToCString()[myindex-1]);
+  }
+  return EMPTY;
+}
diff --git a/src/WOKTools/WOKTools_Message_proto.hxx b/src/WOKTools/WOKTools_Message_proto.hxx
new file mode 100755 (executable)
index 0000000..780b17b
--- /dev/null
@@ -0,0 +1,108 @@
+// File Modifed by JGA for Visual C++ 5.0
+
+#ifndef _WOKTools_Message_HeaderFile
+#define _WOKTools_Message_HeaderFile
+
+#include <Standard_CString.hxx>
+#include <Handle_TCollection_HAsciiString.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <WOKTools_MsgHandler.hxx>
+#include <WOKTools_MsgStreamPtr.hxx>
+#include <Standard_Character.hxx>
+#include <WOKTools_MsgControl.hxx>
+class TCollection_HAsciiString;
+
+
+#include <Standard_Macro.hxx>
+
+class WOKTools_Message  {
+
+public:
+
+  // Methods PUBLIC
+  // 
+  Standard_EXPORT   void Init() ;
+  Standard_EXPORT virtual  Standard_Character Code() const = 0;
+  Standard_EXPORT   WOKTools_Message& Print(const Standard_CString astr) ;
+  WOKTools_Message& operator <<(const Standard_CString astr) 
+    {
+      return Print(astr);
+    }
+
+  Standard_EXPORT   WOKTools_Message& Print(const Handle(TCollection_HAsciiString)& astr) ;
+  WOKTools_Message& operator <<(const Handle(TCollection_HAsciiString)& astr) 
+    {
+      return Print(astr);
+    }
+
+  Standard_EXPORT   WOKTools_Message& Print(const Standard_Integer aint) ;
+  WOKTools_Message& operator <<(const Standard_Integer aint) 
+    {
+      return Print(aint);
+    }
+
+  Standard_EXPORT   WOKTools_Message& Print(const Standard_Character achar) ;
+  WOKTools_Message& operator <<(const Standard_Character achar) 
+    {
+      return Print(achar);
+    }
+
+  Standard_EXPORT   WOKTools_Message& MsgControl(const WOKTools_MsgControl ahandler) ;
+  WOKTools_Message& operator <<(const WOKTools_MsgControl ahandler) 
+    {
+      return MsgControl(ahandler);
+    }
+
+  Standard_EXPORT   void Set() ;
+  Standard_EXPORT   void UnSet() ;
+  Standard_EXPORT   void DoPrintHeader() ;
+  Standard_EXPORT   void DontPrintHeader() ;
+  Standard_EXPORT   void DoPrintContext() ;
+  Standard_EXPORT   void DontPrintContext() ;
+  Standard_EXPORT   void SetEndMsgHandler(const WOKTools_MsgHandler& ahandler) ;
+  Standard_EXPORT   void SetIndex(const Standard_Integer anindex) ;
+  Standard_EXPORT   Standard_Boolean LogToFile(const Handle(TCollection_HAsciiString)& afile) ;
+  Standard_EXPORT   Standard_Boolean LogToStream(const WOKTools_MsgStreamPtr& astream) ;
+  Standard_EXPORT   void EndLogging() ;
+
+  // inline methods
+  inline   WOKTools_MsgStreamPtr LogStream() const;
+  inline   Standard_Boolean IsSet() const;
+  inline   Standard_Boolean PrintHeader() const;
+  inline   Standard_Boolean PrintContext() const;
+  inline   WOKTools_MsgHandler EndMsgHandler() const;
+  inline   Standard_Integer Index() const;
+  inline  const Handle(TCollection_HAsciiString)& Message() const;
+  inline   Standard_CString ToPrint() const;
+
+protected:
+
+  // Methods PROTECTED
+  // 
+  Standard_EXPORT WOKTools_Message(const Standard_CString aclass,const Standard_CString aheader);
+  inline   Standard_CString Switcher() const;
+  Standard_EXPORT   void SetSwitcher(const Standard_CString aswitcher) ;
+
+private: 
+
+  // Fields PRIVATE
+  //
+  Standard_CString myheader;
+  Handle_TCollection_HAsciiString mymessage;
+  Standard_Integer myindex;
+  Standard_Boolean myison;
+  Standard_Boolean myprintcontext;
+  Standard_Boolean myprintheader;
+  Standard_CString myswitcher;
+  WOKTools_MsgHandler myendmsghandlr;
+  Standard_Boolean mylogflag;
+  Handle_TCollection_HAsciiString mylogfile;
+  WOKTools_MsgStreamPtr mylogstream;
+
+};
+
+
+#include <WOKTools_Message.lxx>
+
+#endif
diff --git a/src/WOKTools/WOKTools_Messages.hxx b/src/WOKTools/WOKTools_Messages.hxx
new file mode 100755 (executable)
index 0000000..e775d4c
--- /dev/null
@@ -0,0 +1,46 @@
+// File:       WOKTools_Messages.hxx
+// Created:    Wed Jun 28 19:08:33 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#ifndef WOKTools_Messages_HeaderFile
+#define WOKTools_Messages_HeaderFile
+
+#include <WOKTools_Info.hxx>
+#include <WOKTools_Warning.hxx>
+#include <WOKTools_Error.hxx>
+#include <WOKTools_Verbose.hxx>
+
+#ifndef __WOKTools_API
+# ifdef WNT
+#  ifdef __WOKTools_DLL
+#   define __WOKTools_API __declspec( dllexport )
+#  else
+#   define __WOKTools_API __declspec( dllimport )
+#  endif  // __WOKTools_DLL
+# else
+#  define __WOKTools_API
+# endif  // WNT
+#endif  // __WOKTools_API
+
+extern __WOKTools_API WOKTools_Info    InfoMsg;
+extern __WOKTools_API WOKTools_Warning WarningMsg;
+extern __WOKTools_API WOKTools_Error   ErrorMsg;
+extern __WOKTools_API WOKTools_Verbose VerboseMsg;
+
+extern __WOKTools_API WOKTools_Message& endm(WOKTools_Message&);
+extern __WOKTools_API WOKTools_Message& flushm(WOKTools_Message&);
+
+#define DEB
+#ifdef  DEB
+#define WOK_VERBOSE 1
+#endif
+
+#define WOK_TRACE0(msg) if(VerboseMsg.IsSet()) { msg }
+
+#define WOK_TRACE if(VerboseMsg.IsSet())
+
+
+#define WOK_BEGIN_TRACE  if(VerboseMsg.IsSet()) {
+#define WOK_END_TRACE    }
+#endif
diff --git a/src/WOKTools/WOKTools_MsgControl.hxx b/src/WOKTools/WOKTools_MsgControl.hxx
new file mode 100755 (executable)
index 0000000..3aad7f4
--- /dev/null
@@ -0,0 +1,20 @@
+// File:       WOKTools_MsgControl.hxx
+// Created:    Thu Oct 24 14:07:52 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKTools_MsgControl_HeaderFile
+#define WOKTools_MsgControl_HeaderFile
+
+
+class WOKTools_Message;
+
+#include <Standard_Type.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKTools_MsgControl);
+
+typedef  WOKTools_Message& (*WOKTools_MsgControl)(WOKTools_Message &);
+
+
+#endif
diff --git a/src/WOKTools/WOKTools_MsgHandler.hxx b/src/WOKTools/WOKTools_MsgHandler.hxx
new file mode 100755 (executable)
index 0000000..23483af
--- /dev/null
@@ -0,0 +1,18 @@
+// File:       WOKTools_MsgHandler.hxx
+// Created:    Tue Oct 17 16:35:18 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#ifndef WOKTools_MsgHandler_HeaderFile
+#define WOKTools_MsgHandler_HeaderFile
+
+class WOKTools_Message;
+
+#include <Standard_Type.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKTools_MsgHandler);
+
+typedef  WOKTools_Message& (*WOKTools_MsgHandler)(WOKTools_Message &, const Standard_Boolean newline);
+
+#endif
diff --git a/src/WOKTools/WOKTools_MsgStreamPtr.hxx b/src/WOKTools/WOKTools_MsgStreamPtr.hxx
new file mode 100755 (executable)
index 0000000..c985299
--- /dev/null
@@ -0,0 +1,14 @@
+// File:       WOKTools_MsgStreamPtr.hxx
+// Created:    Wed Jul  2 12:02:31 1997
+// Author:     Jean GAUTIER
+//             <jga@hourax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKTools_MsgStreamPtr_HeaderFile
+#define WOKTools_MsgStreamPtr_HeaderFile
+
+#include <fstream.h>
+
+typedef ofstream* WOKTools_MsgStreamPtr;
+
+#endif
diff --git a/src/WOKTools/WOKTools_Options.cdl b/src/WOKTools/WOKTools_Options.cdl
new file mode 100755 (executable)
index 0000000..1fc01e0
--- /dev/null
@@ -0,0 +1,69 @@
+-- File:       WOKTools_Options.cdl
+-- Created:    Tue Aug  1 20:09:20 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Options from WOKTools 
+
+       ---Purpose: Manages Options of WOKTools Methods
+
+uses
+    PUsage                  from WOKTools,
+    HSequenceOfDefine       from WOKTools,
+    ArgTable                from WOKTools,
+    HAsciiString            from TCollection,
+    HSequenceOfHAsciiString from TColStd
+is
+
+    Create(argc  : Integer  from Standard; 
+          argv  : ArgTable from WOKTools; 
+           opts  : CString  from Standard;
+          usage : PUsage   from WOKTools; 
+          excl  : CString  from Standard = " ") returns Options from WOKTools; 
+    ---Purpose: Instantiates the Options Iterator
+          
+    Next(me:out);
+    ---Purpose: Advance to next option 
+    --          ( -D and -h options are treated and skipped)    
+    
+    Option(me)         returns Character from Standard;
+    ---Purpose: returns the code of currently analyzed option    
+    OptionArgument(me) returns HAsciiString from TCollection;
+    ---Purpose: returns the option argument if any    
+    OptionListArgument(me) returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: returns the option list argument if any    
+    
+    More(me) returns Boolean from Standard;
+    ---Purpose: tests if option iteration is finished    
+
+    Define(me:out; aname : HAsciiString from TCollection; avalue : HAsciiString from TCollection); 
+    
+    Defines(me) returns HSequenceOfDefine from WOKTools;
+    ---Purpose: returns the sequence of parameters defined (if any)    
+    AddPrefixToDefines(me : out; aname : HAsciiString from TCollection);
+    ---Purpose: Adds <aname>_ to defines list
+    --          Used to simplify use of API
+
+    Arguments(me) returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: returns the arguments passed to API    
+    
+    Failed(me) returns Boolean from Standard;
+    ---Purpose: Tests if argument analysis failed    
+
+fields
+    myusage      : PUsage                  from WOKTools;
+    myoptions    : HAsciiString            from TCollection;
+    myexclopt    : HAsciiString            from TCollection;
+    myexclflg    : Character               from Standard;
+    myargc       : Integer                 from Standard;
+    myargv       : ArgTable                from WOKTools;
+    mydefines    : HSequenceOfDefine       from WOKTools;
+    mymore       : Boolean                 from Standard;
+    mycuropt     : Character               from Standard;
+    mycurarg     : HAsciiString            from TCollection;
+    mycurlistarg : HSequenceOfHAsciiString from TColStd;
+    myargs       : HSequenceOfHAsciiString from TColStd;
+    myerrflg     : Boolean                 from Standard;
+end Options;
diff --git a/src/WOKTools/WOKTools_Options.cxx b/src/WOKTools/WOKTools_Options.cxx
new file mode 100755 (executable)
index 0000000..8bfbc10
--- /dev/null
@@ -0,0 +1,304 @@
+// File:       WOKTools_Options.cxx
+// Created:    Tue Aug  1 20:38:41 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <string.h>
+#include <stdlib.h>
+
+
+#include <WOKTools_Options.ixx>
+
+#include <WOKTools_Define.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+#ifndef WNT
+extern char *optarg;
+extern int  optind;
+#else
+extern "C" Standard_IMPORT char *optarg;
+extern "C" Standard_IMPORT int   optind;
+extern "C" Standard_IMPORT int   getopt ( int, char**, char* );
+#endif  // WNT
+
+//=======================================================================
+//function : WOKTools_Options
+//purpose  : 
+//=======================================================================
+WOKTools_Options::WOKTools_Options(const Standard_Integer argc, 
+                              const WOKTools_ArgTable& argv, 
+                              const Standard_CString opts, 
+                              const WOKTools_PUsage usage,
+                              const Standard_CString excl)
+
+{
+  myargc    = argc;
+  myargv    = argv;
+  myusage   = usage;
+  mymore    = Standard_True;
+  mydefines = new WOKTools_HSequenceOfDefine;
+  myargs    = new TColStd_HSequenceOfHAsciiString;
+  myerrflg  = Standard_False;
+#ifndef WNT
+  optind    = 1;
+#else
+  optind    = 0;
+#endif  // WNT
+
+  myoptions = new TCollection_HAsciiString(opts);
+  myexclopt = new TCollection_HAsciiString(excl);
+  myexclflg = '\0';
+  Next();
+
+  // s'il il n'y a qu'une option
+  if(mycuropt == EOF) 
+      mymore  = Standard_False;
+}
+
+//=======================================================================
+//function : Next
+//purpose  : 
+//=======================================================================
+void WOKTools_Options::Next()
+{
+  if (!mymore) return;
+
+  mycuropt = getopt(myargc, myargv, myoptions->ToCString());
+
+  if(mycuropt == EOF)
+    {
+      for( ; (optind < myargc) && (myargv[optind][0] != '-'); optind++)
+       {
+         myargs->Append(new TCollection_HAsciiString(myargv[optind]));
+       }
+
+      if(optind >= myargc)
+       {
+         // il n'y en a plus
+         mymore = Standard_False;
+       }
+      else 
+       {
+         if(!strcmp(myargv[optind], "-"))
+           {
+             mymore = Standard_False;
+             myerrflg = Standard_True;
+             ErrorMsg << myargv[0] << "option - is illegal" << endm;
+             ErrorMsg << myargv[0] << endm;
+             if(myusage != NULL) (*myusage)(myargv[0]);
+           }
+         else
+           Next();
+       }
+    }
+  else
+    {
+      if(myexclopt->Location(1, mycuropt, 1, myexclopt->Length()) != 0 )
+       {
+         if(myexclflg=='\0') 
+           {
+             myexclflg = mycuropt;
+           }
+         else
+           {
+             ErrorMsg << myargv[0] << "Option " << (char)mycuropt << " is exclusive with : " << (char)myexclflg << endm;
+             ErrorMsg << myargv[0] << endm;
+             if(myusage != NULL) (*myusage)(myargv[0]);
+             myerrflg = Standard_True;
+           }
+       }
+
+      switch(mycuropt)
+       {
+       case 'h':
+         if(myusage != NULL) (*myusage)(myargv[0]);
+         myerrflg = Standard_True;
+         mymore   = Standard_False;
+
+         break;
+       case 'D':
+         {
+           Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(optarg);
+           Handle(TCollection_HAsciiString) asubstr;
+           WOKTools_Define anitem;
+           Standard_Integer i=1;
+           
+           asubstr = astr->Token(",", i);
+
+           while(asubstr->IsEmpty() == Standard_False)
+             {
+               anitem.GetDefineIn(asubstr);
+               Standard_Boolean othervalue = Standard_True;
+
+               while(othervalue && !asubstr->IsEmpty())
+                 {
+                   i++;
+                   asubstr = astr->Token(",", i);
+                   
+                   Standard_Character c;
+                   Standard_Integer   j;
+                   othervalue = Standard_True;
+                   
+                   for (j=1; j<= asubstr->Length() && othervalue; j++)
+                     {
+                       c = asubstr->Value(j);
+                       if (IsEqual(c,'='))
+                         othervalue = Standard_False;
+                     }
+                   
+                   if (othervalue && !asubstr->IsEmpty())
+                     {
+                       anitem.AddValue(asubstr);
+                     }
+                 }
+               mydefines->Append(anitem);
+             }
+         }
+         if(!myerrflg) Next();
+         break;
+       case '?':
+         myerrflg = Standard_True;
+         mymore   = Standard_False;
+         if(myusage != NULL) (*myusage)(myargv[0]);
+         break;
+       default:
+         if(optarg != NULL)
+           {
+             mycurarg = new TCollection_HAsciiString(optarg);
+             Handle(TCollection_HAsciiString) asubstr;
+             Standard_Integer i=1;
+
+             asubstr = mycurarg->Token(",", i);
+             mycurlistarg = new TColStd_HSequenceOfHAsciiString;
+             while(asubstr->IsEmpty() == Standard_False)
+               {
+                 mycurlistarg->Append(asubstr);
+                 i++;
+                 asubstr = mycurarg->Token(",", i);
+               }
+           }
+       }
+    }
+  
+  if (myerrflg) // vider 
+    {
+      Standard_Character acuropt = '\0';
+      while(acuropt != EOF)
+         acuropt = getopt(myargc, myargv, myoptions->ToCString());
+    }
+
+  return;
+}
+
+//=======================================================================
+//function : Option
+//purpose  : 
+//=======================================================================
+Standard_Character WOKTools_Options::Option() const 
+{
+  return mycuropt;
+}
+
+//=======================================================================
+//function : OptionArgument
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKTools_Options::OptionArgument() const
+{
+  return mycurarg;
+}
+
+//=======================================================================
+//function : OptionListArgument
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKTools_Options::OptionListArgument() const
+{
+  return mycurlistarg;
+}
+
+//=======================================================================
+//function : More
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Options::More() const 
+{
+  return mymore;
+}
+
+//=======================================================================
+//function : Defines
+//purpose  : 
+//=======================================================================
+Handle(WOKTools_HSequenceOfDefine) WOKTools_Options::Defines() const 
+{
+  return mydefines;
+}
+
+//=======================================================================
+//function : Define
+//purpose  : 
+//=======================================================================
+void WOKTools_Options::Define(const Handle(TCollection_HAsciiString)& aname, const Handle(TCollection_HAsciiString)& avalue)
+{
+  if(aname.IsNull())
+    { 
+      ErrorMsg << "WOKTools_Options::Define"
+              << "Invalid Null name for define" << endm;
+      return;
+    }
+  if(avalue.IsNull())
+    { 
+      ErrorMsg << "WOKTools_Options::Define"
+              << "Invalid Null value for define" << endm;
+      return;
+    }
+
+  if(mydefines.IsNull()) mydefines = new WOKTools_HSequenceOfDefine;
+  
+  mydefines->Append(WOKTools_Define(aname, avalue));
+  return;
+}
+
+//=======================================================================
+//function : AddPrefixToDefines
+//purpose  : 
+//=======================================================================
+void WOKTools_Options::AddPrefixToDefines(const Handle(TCollection_HAsciiString)& aname)
+{
+  Standard_Integer i;
+  Handle(TCollection_HAsciiString) aprefix = new TCollection_HAsciiString;
+  Handle(TCollection_HAsciiString) astr;
+
+  aprefix->AssignCat("%");
+  aprefix->AssignCat(aname);
+  aprefix->AssignCat("_");
+
+  for(i=1; i<= mydefines->Length() ; i++)
+    {
+      astr = new TCollection_HAsciiString(aprefix);
+      astr->AssignCat(mydefines->Value(i).Name());
+      mydefines->ChangeValue(i).SetName(astr);
+    }
+}
+
+//=======================================================================
+//function : Arguments
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKTools_Options::Arguments() const
+{
+  return myargs;
+}
+
+//=======================================================================
+//function : Failed
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKTools_Options::Failed() const 
+{
+  return myerrflg;
+}
+                                                                                                                                              
diff --git a/src/WOKTools/WOKTools_Options_proto.hxx b/src/WOKTools/WOKTools_Options_proto.hxx
new file mode 100755 (executable)
index 0000000..4873f77
--- /dev/null
@@ -0,0 +1,66 @@
+// File modified by JGA for Visual C+++ 5.0
+
+#ifndef _WOKTools_Options_HeaderFile
+#define _WOKTools_Options_HeaderFile
+
+#include <WOKTools_PUsage.hxx>
+#include <Handle_TCollection_HAsciiString.hxx>
+#include <Standard_Character.hxx>
+#include <Standard_Integer.hxx>
+#include <WOKTools_ArgTable.hxx>
+#include <Handle_WOKTools_HSequenceOfDefine.hxx>
+#include <Standard_Boolean.hxx>
+#include <Handle_TColStd_HSequenceOfHAsciiString.hxx>
+#include <Standard_CString.hxx>
+class TCollection_HAsciiString;
+class WOKTools_HSequenceOfDefine;
+class TColStd_HSequenceOfHAsciiString;
+
+
+#include <Standard_Macro.hxx>
+
+class WOKTools_Options  {
+
+public:
+  // Methods PUBLIC
+  // 
+  Standard_EXPORT WOKTools_Options(const Standard_Integer argc,const WOKTools_ArgTable& argv,const Standard_CString opts,const WOKTools_PUsage usage,const Standard_CString excl = " ");
+  Standard_EXPORT   void Next() ;
+  Standard_EXPORT   Standard_Character Option() const;
+  Standard_EXPORT   Handle_TCollection_HAsciiString OptionArgument() const;
+  Standard_EXPORT   Handle_TColStd_HSequenceOfHAsciiString OptionListArgument() const;
+  Standard_EXPORT   Standard_Boolean More() const;
+  Standard_EXPORT   void Define(const Handle(TCollection_HAsciiString)& aname,const Handle(TCollection_HAsciiString)& avalue) ;
+  Standard_EXPORT   Handle_WOKTools_HSequenceOfDefine Defines() const;
+  Standard_EXPORT   void AddPrefixToDefines(const Handle(TCollection_HAsciiString)& aname) ;
+  Standard_EXPORT   Handle_TColStd_HSequenceOfHAsciiString Arguments() const;
+  Standard_EXPORT   Standard_Boolean Failed() const;
+
+private: 
+
+  // Fields PRIVATE
+  //
+  WOKTools_PUsage myusage;
+  Handle_TCollection_HAsciiString myoptions;
+  Handle_TCollection_HAsciiString myexclopt;
+  Standard_Character myexclflg;
+  Standard_Integer myargc;
+  WOKTools_ArgTable myargv;
+  Handle_WOKTools_HSequenceOfDefine mydefines;
+  Standard_Boolean mymore;
+  Standard_Character mycuropt;
+  Handle_TCollection_HAsciiString mycurarg;
+  Handle_TColStd_HSequenceOfHAsciiString mycurlistarg;
+  Handle_TColStd_HSequenceOfHAsciiString myargs;
+  Standard_Boolean myerrflg;
+};
+
+
+
+
+
+// other inline functions and methods (like "C++: function call" methods)
+//
+
+
+#endif
diff --git a/src/WOKTools/WOKTools_PUsage.cxx b/src/WOKTools/WOKTools_PUsage.cxx
new file mode 100755 (executable)
index 0000000..99c0475
--- /dev/null
@@ -0,0 +1,17 @@
+// File:       WOKAPI_PUsage.cxx
+// Created:    Wed Aug  2 13:49:45 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#ifndef _WOKTools_PUsage_HeaderFile
+#include <WOKTools_PUsage.hxx>
+#endif
+
+
+const Handle(Standard_Type)& TYPE(WOKTools_PUsage)
+{
+  static Handle(Standard_Type) _aType = new Standard_Type("WOKTools_PUsage",sizeof(WOKTools_PUsage));
+  
+  return _aType;
+}
diff --git a/src/WOKTools/WOKTools_PUsage.hxx b/src/WOKTools/WOKTools_PUsage.hxx
new file mode 100755 (executable)
index 0000000..7272935
--- /dev/null
@@ -0,0 +1,16 @@
+// File:       WOKTools_PUsage.hxx
+// Created:    Wed Aug  2 13:46:46 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#ifndef WOKTools_PUsage_HeaderFile
+#define WOKTools_PUsage_HeaderFile
+
+#include <Standard_Type.hxx>
+
+const Handle(Standard_Type)& STANDARD_TYPE(WOKTools_PUsage);
+
+typedef void (*WOKTools_PUsage)(char *);
+
+#endif
diff --git a/src/WOKTools/WOKTools_Replace.tcl b/src/WOKTools/WOKTools_Replace.tcl
new file mode 100755 (executable)
index 0000000..1e4aad4
--- /dev/null
@@ -0,0 +1,70 @@
+
+
+proc WOKTools_Replace::AdmFileType {} {
+    return "dbadmfile";
+}
+
+proc WOKTools_Replace::OutputDirTypeName {} {
+    return "dbtmpfile";
+}
+
+
+proc WOKTools_Replace::HandleInputFile { ID } { 
+
+    scan $ID "%\[^:\]:%\[^:\]:%\[^:\]"  unit type name
+
+    switch $name {
+       WOKTools_Message.hxx           {return 1;} 
+       WOKTools_Options.hxx           {return 1;} 
+       default {
+           return 0;
+       }
+    }
+}
+
+proc WOKTools_Replace::Execute { unit args } {
+    
+    global tcl_interactive
+
+    set tcl_interactive 1
+    package require Wokutils
+
+    msgprint -i -c "WOKTools_Replace::Execute" "Copying of WOKTools includes"
+
+    if { [wokparam -e %Station $unit] != "wnt" } {
+       set copycmd "cp -p "
+       set replstr "/"
+    } {
+       set copycmd "cmd /c copy"
+       set replstr "\\\\\\\\"
+    }
+    
+    foreach file  $args {
+       scan $file "%\[^:\]:%\[^:\]:%\[^:\]"  Unit type name
+       
+       regsub ".hxx" $name "_proto.hxx" sourcename
+
+       set source    [woklocate -p WOKTools:source:$sourcename     [wokinfo -N $unit]]
+       set vistarget [woklocate -p WOKTools:pubinclude:$name [wokinfo -N $unit]]
+       set target    [wokinfo   -p pubinclude:$name          $unit]
+
+       regsub -all "/" " $source $target" $replstr  TheArgs
+
+       set A [catch {eval "wokcmp $TheArgs"} result ]
+
+       if { [wokparam -e %Station $unit] == "wnt" && $result != "" } {
+           set result 0
+       }
+       
+       if { ! $result } {
+           msgprint -i -c "WOKTools_Replace::Execute" "Copy $source to $target"
+           if { [wokparam -e %Station $unit] != "wnt" } {
+               eval exec "chmod u+w $target"
+           }
+           eval exec "$copycmd $TheArgs"
+       } else {
+           msgprint -i -c "WOKTools_Replace::Execute" "No change in $source"
+       }
+    }
+    return 0;
+}
diff --git a/src/WOKTools/WOKTools_Return.cdl b/src/WOKTools/WOKTools_Return.cdl
new file mode 100755 (executable)
index 0000000..b4dbc78
--- /dev/null
@@ -0,0 +1,51 @@
+-- File:       WOKTools_Return.cdl
+-- Created:    Wed Aug  2 15:56:07 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Return from WOKTools 
+
+       ---Purpose: Manages API return Statements
+
+uses
+    ArgTable                from WOKTools,
+    HSequenceOfReturnValue  from WOKTools,
+    ReturnValue             from WOKTools,
+    InterpFileType          from WOKTools,
+    HAsciiString            from TCollection
+is
+    Create returns Return from WOKTools;
+    
+    Clear(me:out);
+    
+    AddStringValue(me:out;     arg : CString from Standard);
+    AddStringValue(me:out;     arg : HAsciiString from TCollection);
+    AddStringParameter(me:out; aname, avalue : HAsciiString from TCollection);
+    AddIntegerValue(me:out;    anint : Integer from Standard);
+    AddBooleanValue(me:out;    abool : Boolean from Standard);
+    
+    AddSetEnvironment(me:out; name,value : HAsciiString from TCollection);
+    AddSetEnvironment(me:out; name,value : CString from Standard);
+    AddUnSetEnvironment(me:out; name : HAsciiString from TCollection);
+    AddUnSetEnvironment(me:out; name : CString from Standard);
+    
+    AddChDir(me:out; path : HAsciiString from TCollection);
+    AddChDir(me:out; path : CString from Standard);
+    
+    AddInterpFile(me:out; file : HAsciiString from TCollection; type : InterpFileType from WOKTools = WOKTools_CShell);
+    AddInterpFile(me:out; file : CString      from Standard;    type : InterpFileType from WOKTools = WOKTools_CShell);
+    
+
+    Value(me; anidx : Integer from Standard)
+       returns ReturnValue from WOKTools;
+       
+    Values(me)
+       returns HSequenceOfReturnValue from WOKTools;
+       
+    Length(me) returns Integer from Standard;
+
+fields
+    myargs   : HSequenceOfReturnValue from WOKTools;
+end Return;
diff --git a/src/WOKTools/WOKTools_Return.cxx b/src/WOKTools/WOKTools_Return.cxx
new file mode 100755 (executable)
index 0000000..0220d82
--- /dev/null
@@ -0,0 +1,218 @@
+// File:       WOKTools_Return.cxx
+// Created:    Wed Aug  2 16:12:17 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_Return.ixx>
+
+#include <WOKTools_StringValue.hxx>
+#include <WOKTools_EnvValue.hxx>
+#include <WOKTools_ChDirValue.hxx>
+#include <WOKTools_InterpFileValue.hxx>
+
+#include <string.h>
+
+//=======================================================================
+//function : WOKTools_Return
+//purpose  : 
+//=======================================================================
+WOKTools_Return::WOKTools_Return()
+{
+}
+
+//=======================================================================
+//function : Clear
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::Clear()  
+{
+  myargs.Nullify();
+}
+
+//=======================================================================
+//function : AddStringValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddStringValue(const Standard_CString arg)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_StringValue(new TCollection_HAsciiString(arg)));
+}
+
+//=======================================================================
+//function : AddStringValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddStringValue(const Handle(TCollection_HAsciiString)& arg)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_StringValue(arg));
+}
+
+//=======================================================================
+//function : AddStringParameter
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddStringParameter(const Handle(TCollection_HAsciiString)& aname, 
+                                        const Handle(TCollection_HAsciiString)& avalue) 
+{
+  Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString;
+
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+
+  astr->AssignCat(aname);
+  astr->AssignCat("=");
+  if(avalue.IsNull() == Standard_True)
+    {
+      astr->AssignCat("Undefined!!!");
+    }
+  else
+    {
+      astr->AssignCat(avalue);
+    }
+  
+  myargs->Append(new WOKTools_StringValue(astr));
+}
+
+
+//=======================================================================
+//function : AddBooleanValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddBooleanValue(const Standard_Boolean abool)
+{
+  if(abool)
+    {
+      AddStringValue("1");
+    }
+  else
+    {
+      AddStringValue("0");
+    }
+}
+
+//=======================================================================
+//function : AddIntegerValue
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddIntegerValue(const Standard_Integer anint)
+{
+  AddStringValue(new TCollection_HAsciiString(anint));
+}
+
+//=======================================================================
+//function : AddEnvironment
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddSetEnvironment(const Handle(TCollection_HAsciiString)& name, 
+                                    const Handle(TCollection_HAsciiString)& value)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+
+  myargs->Append(new WOKTools_EnvValue(name, value));
+}
+
+
+//=======================================================================
+//function : AddSetEnvironment
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddSetEnvironment(const Standard_CString name, const Standard_CString value)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+
+  myargs->Append(new WOKTools_EnvValue(new TCollection_HAsciiString(name),
+                                      new TCollection_HAsciiString(value)));
+}
+
+//=======================================================================
+//function : AddUnSetEnvironment
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddUnSetEnvironment(const Handle(TCollection_HAsciiString)& name)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_EnvValue(name));
+}
+
+
+//=======================================================================
+//function : AddUnSetEnvironment
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddUnSetEnvironment(const Standard_CString name)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_EnvValue(new TCollection_HAsciiString(name)));
+}
+
+//=======================================================================
+//function : AddChDir
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddChDir(const Handle(TCollection_HAsciiString)& path)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_ChDirValue(path));
+}
+
+//=======================================================================
+//function : AddChDir
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddChDir(const Standard_CString path)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_ChDirValue(new TCollection_HAsciiString(path)));
+}
+
+//=======================================================================
+//function : AddInterpFile
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddInterpFile(const Handle(TCollection_HAsciiString)& apath, const WOKTools_InterpFileType atype)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_InterpFileValue(apath, atype));
+}
+
+//=======================================================================
+//function : AddInterpFile
+//purpose  : 
+//=======================================================================
+void WOKTools_Return::AddInterpFile(const Standard_CString apath, const WOKTools_InterpFileType atype)
+{
+  if(myargs.IsNull() == Standard_True) myargs = new WOKTools_HSequenceOfReturnValue;
+  myargs->Append(new WOKTools_InterpFileValue(new TCollection_HAsciiString(apath), atype));
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+Handle(WOKTools_ReturnValue) WOKTools_Return::Value(const Standard_Integer idx) const
+{
+  return myargs->Value(idx);
+}
+
+
+//=======================================================================
+//function : Values
+//purpose  : 
+//=======================================================================
+Handle(WOKTools_HSequenceOfReturnValue) WOKTools_Return::Values() const
+{
+  return myargs;
+}
+
+//=======================================================================
+//function : Length
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKTools_Return::Length() const
+{
+  if(myargs.IsNull() == Standard_True) return 0;
+  return myargs->Length();
+}
diff --git a/src/WOKTools/WOKTools_ReturnValue.cdl b/src/WOKTools/WOKTools_ReturnValue.cdl
new file mode 100755 (executable)
index 0000000..b0ef497
--- /dev/null
@@ -0,0 +1,22 @@
+-- File:       WOKTools_ReturnValue.cdl
+-- Created:    Wed Sep 27 17:34:54 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class ReturnValue from WOKTools 
+inherits TShared from MMgt
+
+       ---Purpose: 
+uses
+    ReturnType from WOKTools
+is
+    Initialize;
+
+    Type(me) returns ReturnType from WOKTools;
+    SetType(me:mutable; atype : ReturnType from WOKTools);
+
+fields
+    mytype : ReturnType from WOKTools;
+end ReturnValue;
diff --git a/src/WOKTools/WOKTools_ReturnValue.cxx b/src/WOKTools/WOKTools_ReturnValue.cxx
new file mode 100755 (executable)
index 0000000..66e57e9
--- /dev/null
@@ -0,0 +1,22 @@
+// File:       WOKTools_ReturnValue.cxx
+// Created:    Wed Sep 27 18:26:20 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_ReturnValue.ixx>
+
+ WOKTools_ReturnValue::WOKTools_ReturnValue()
+{
+}
+
+WOKTools_ReturnType WOKTools_ReturnValue::Type() const 
+{
+  return mytype;
+}
+
+void WOKTools_ReturnValue::SetType(const WOKTools_ReturnType atype)
+{
+  mytype = atype;
+}
+
diff --git a/src/WOKTools/WOKTools_StringValue.cdl b/src/WOKTools/WOKTools_StringValue.cdl
new file mode 100755 (executable)
index 0000000..5ec44eb
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKTools_StringValue.cdl
+-- Created:    Wed Sep 27 17:45:10 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class StringValue    from WOKTools 
+inherits ReturnValue from WOKTools
+
+       ---Purpose: 
+
+uses
+    HAsciiString from TCollection
+is
+
+    Create(astr : HAsciiString from TCollection) returns mutable StringValue from WOKTools;
+    
+    Value(me) returns HAsciiString from TCollection;
+    SetValue(me:mutable; avalue : HAsciiString from TCollection);
+
+fields
+    myvalue : HAsciiString from TCollection;
+end StringValue;
diff --git a/src/WOKTools/WOKTools_StringValue.cxx b/src/WOKTools/WOKTools_StringValue.cxx
new file mode 100755 (executable)
index 0000000..227af0b
--- /dev/null
@@ -0,0 +1,24 @@
+// File:       WOKTools_StringValue.cxx
+// Created:    Wed Sep 27 18:30:07 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKTools_StringValue.ixx>
+
+ WOKTools_StringValue::WOKTools_StringValue(const Handle(TCollection_HAsciiString)& astr)
+{
+  SetType(WOKTools_String);
+  myvalue = astr;
+}
+
+Handle(TCollection_HAsciiString) WOKTools_StringValue::Value() const 
+{
+  return myvalue;
+}
+
+void WOKTools_StringValue::SetValue(const Handle(TCollection_HAsciiString)& avalue)
+{
+  myvalue = avalue;
+}
+
diff --git a/src/WOKTools/WOKTools_Verbose.cdl b/src/WOKTools/WOKTools_Verbose.cdl
new file mode 100755 (executable)
index 0000000..4f76e01
--- /dev/null
@@ -0,0 +1,28 @@
+-- File:       WOKTools_Verbose.cdl
+-- Created:    Wed Jun 28 20:14:46 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+class Verbose from WOKTools 
+inherits Message from WOKTools
+
+       ---Purpose: Verbose Information messages
+
+uses
+    AsciiString from TCollection,
+    CString     from Standard
+is
+
+    Create(aclass: CString from Standard = "WOK_VERBOSE") returns Verbose from WOKTools;
+    
+    LocalSwitcher(me; aswitch : CString from Standard) 
+    ---C++: return &
+    ---C++: alias operator ()
+       returns Verbose from WOKTools;
+       
+    Code(me)
+       returns Character from Standard
+       is redefined;
+       
+end Verbose;
diff --git a/src/WOKTools/WOKTools_Verbose.cxx b/src/WOKTools/WOKTools_Verbose.cxx
new file mode 100755 (executable)
index 0000000..939d829
--- /dev/null
@@ -0,0 +1,39 @@
+// File:       WOKTools_Verbose.cxx
+// Created:    Wed Jun 28 20:16:30 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <stream.h>
+#include <unistd.h>
+
+#include <WOKTools_Verbose.ixx>
+
+Standard_EXPORT WOKTools_Verbose VerboseMsg;
+
+WOKTools_Verbose::WOKTools_Verbose(const Standard_CString astr) : WOKTools_Message(astr, "Verbose : ")
+{
+  if(getenv(Switcher())) Set();
+  else                   UnSet();
+  DoPrintContext();
+}
+
+WOKTools_Verbose& WOKTools_Verbose::LocalSwitcher(const Standard_CString aswitcher) const 
+{
+  static WOKTools_Verbose averb;
+
+  averb = *this;
+  averb.SetSwitcher(aswitcher);
+
+  if(IsSet())
+    {
+      if(getenv(averb.Switcher())) averb.Set();
+      else                         averb.UnSet();
+    }
+
+  return averb;
+}
+
+
+Standard_Character WOKTools_Verbose::Code() const 
+{return 'V';}
+
diff --git a/src/WOKTools/WOKTools_WOKSteps.edl b/src/WOKTools/WOKTools_WOKSteps.edl
new file mode 100755 (executable)
index 0000000..580f46b
--- /dev/null
@@ -0,0 +1,13 @@
+-- File:       WOKTools_WOKSteps.edl
+-- Author:     Jean GAUTIER
+-- History:    Tue Aug 12 17:12:59 1997        Jean GAUTIER    Creation
+-- Copyright:   Matra Datavision 1997
+
+@ifnotdefined ( %WOKTools_WOKSteps_EDL) then
+@set %WOKTools_WOKSteps_EDL = "";
+
+
+@string %WOKSteps_XcppGroup += "xcpp.repl";
+@set %WOKSteps_xcpp_repl = "*WOKTools_Replace(xcpp.header)";
+
+@endif;
diff --git a/src/WOKTools/WOKTools_Warning.cdl b/src/WOKTools/WOKTools_Warning.cdl
new file mode 100755 (executable)
index 0000000..c3fc5ec
--- /dev/null
@@ -0,0 +1,21 @@
+-- File:       WOKTools_Warning.cdl
+-- Created:    Wed Jun 28 20:20:22 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+class Warning from WOKTools 
+inherits Message from WOKTools
+
+       ---Purpose: Warning messages
+
+uses
+    AsciiString from TCollection
+is
+    Create returns Warning from WOKTools;
+    
+    Code(me)
+       returns Character from Standard
+       is redefined;
+           
+end Warning;
diff --git a/src/WOKTools/WOKTools_Warning.cxx b/src/WOKTools/WOKTools_Warning.cxx
new file mode 100755 (executable)
index 0000000..d420158
--- /dev/null
@@ -0,0 +1,19 @@
+// File:       WOKTools_Warning.cxx
+// Created:    Wed Jun 28 20:21:03 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <stream.h>
+
+#include <WOKTools_Warning.ixx>
+
+Standard_EXPORT WOKTools_Warning WarningMsg;
+
+WOKTools_Warning::WOKTools_Warning() : WOKTools_Message("WOK_WARNING", "Warning : ")
+{
+  Set();
+}
+
+
+Standard_Character WOKTools_Warning::Code() const 
+{return 'W';}