--- a
+++ b/trunk/Cm/Cm.Core/Util.cpp
@@ -0,0 +1,116 @@
+#include <Cm.Core/Util.hpp>
+#include <Cm.Core/Pointer.hpp>
+#include <Cm.Core/Namespace.hpp>
+#include <Cm.Core/BasicType.hpp>
+#include <Cm.Core/Assert.hpp>
+
+namespace Cm { namespace Core {
+
+class TypeIdFactory;
+typedef boost::shared_ptr<TypeIdFactory> TypeIdFactoryPtr;
+
+class TypeIdFactory
+{
+public:
+    static void Init();
+    static void Done();
+    static TypeIdFactoryPtr Instance();
+    int GetNextTypeId() { return nextTypeId++; }
+private:
+    static TypeIdFactoryPtr instance;
+    TypeIdFactory(): nextTypeId(FIRST_USER_TYPEID) {}
+    int nextTypeId;
+};
+
+TypeIdFactoryPtr TypeIdFactory::instance;
+
+void TypeIdFactory::Init()
+{
+    instance = TypeIdFactoryPtr(new TypeIdFactory());
+}
+
+void TypeIdFactory::Done()
+{
+    instance.reset();
+}
+
+TypeIdFactoryPtr TypeIdFactory::Instance()
+{
+    CM_CORE_ASSERT(instance);
+    return instance;
+}
+
+int GetNextTypeId()
+{
+    return TypeIdFactory::Instance()->GetNextTypeId();
+}
+
+String GetConstructorFunctionSetName()
+{
+    return ".constructor";
+}
+
+String GetAssignmentFunctionSetName()
+{
+    return ".assign";
+}
+
+void AppendParameterTypeNames(String& name, const ParameterList& parameters)
+{
+    int n = parameters.Count();
+    for (int i = 0; i < n; ++i)
+    {
+        if (i > 0)
+        {
+            name.append(", ");
+        }
+        EntityPtr typeExpr = parameters[i]->TypeExpr();
+        TypePtr type = typeExpr->GetType();
+        String typeName = type ? type->FullName() : typeExpr->FullName();
+        name.append(typeName);
+    }
+}
+
+String MakeOverloadName(const String& functionSetName, const ParameterListPtr& parameters)
+{
+    String name(functionSetName);
+    name.append("(");
+    AppendParameterTypeNames(name, *parameters);
+    name.append(")");
+    return name;
+}
+
+String MakeOverloadName(const String& functionSetName, const ArgumentVector& arguments)
+{
+    String name(functionSetName);
+    name.append("(");
+    int n = arguments.size();
+    for (int i = 0; i < n; ++i)
+    {
+        if (i > 0)
+        {
+            name.append(", ");
+        }
+        name.append(arguments[i].Type()->FullName());
+    }
+    name.append(")");
+    return name;
+
+}
+
+String MakeConversionName(const String& sourceTypeName, const String& targetTypeName)
+{
+    return sourceTypeName + " -> " + targetTypeName;
+}
+
+void UtilInit()
+{
+    TypeIdFactory::Init();
+}
+
+void UtilDone()
+{
+    TypeIdFactory::Done();
+}
+
+} } // namespoace Cm::Core