Added type checking for __custom functions
[supertux.git] / tools / miniswig / tree.hpp
index 4dfcf1b..5c7927f 100644 (file)
@@ -40,14 +40,14 @@ public:
 
 private:
     BasicType(const std::string& name)
-    { 
+    {
         this->name = name;
-    }                                     
+    }
 };
 
 class Type {
 public:
-    Type() 
+    Type()
         : atomic_type(0), _unsigned(false), _const(false), _static(false),
         pointer(0), ref(0)
     { }
@@ -55,7 +55,7 @@ public:
     void write_c_type(std::ostream& out)
     {
         if(_static)
-            out << "static ";        
+            out << "static ";
         if(_const)
             out << "const ";
         atomic_type->write_c(out);
@@ -84,6 +84,28 @@ public:
     int ref;
 };
 
+class SQIntegerType : public AtomicType {
+public:
+    SQIntegerType()
+    {
+        this->name = "SQInteger";
+        assert(_instance == 0);
+        _instance = this;
+    }
+    virtual ~SQIntegerType()
+    {
+        assert(_instance == this);
+        _instance = NULL;
+    }
+
+    static SQIntegerType* instance()
+    {
+        return _instance;
+    }
+private:
+    static SQIntegerType* _instance;
+};
+
 class HSQUIRRELVMType : public AtomicType {
 public:
     HSQUIRRELVMType()
@@ -95,7 +117,7 @@ public:
     virtual ~HSQUIRRELVMType()
     {
         assert(_instance == this);
-        _instance = 0;
+        _instance = NULL;
     }
 
     static HSQUIRRELVMType* instance()
@@ -131,7 +153,7 @@ public:
     }
 
 private:
-    static StringType* _instance;   
+    static StringType* _instance;
 };
 
 class Parameter {
@@ -145,12 +167,12 @@ public:
     virtual ~ClassMember()
     { }
 
-    enum Visbility {
+    enum Visibility {
         PUBLIC,
         PROTECTED,
         PRIVATE
     };
-    Visbility visibility;
+    Visibility visibility;
 };
 
 class Function : public ClassMember {
@@ -160,7 +182,7 @@ public:
       suspend = false;
       custom = false;
     }
-  
+
     enum FuncType {
         FUNCTION,
         CONSTRUCTOR,
@@ -171,6 +193,7 @@ public:
     bool suspend;
     /// a custom wrapper (just pass along HSQUIRRELVM)
     bool custom;
+    std::string parameter_spec;
     std::string docu_comment;
     std::string name;
     Type return_type;
@@ -183,7 +206,7 @@ public:
     {
         has_const_value = false;
     }
-    
+
     Type* type;
     std::string docu_comment;
     std::string name;
@@ -203,7 +226,7 @@ public:
                 i != members.end(); ++i)
             delete *i;
     }
-    
+
     std::vector<ClassMember*> members;
     std::vector<Class*> super_classes;
     std::vector<Class*> sub_classes;
@@ -272,7 +295,7 @@ public:
 
         return ret;
     }
-                                                                             
+
     std::vector<Function*> functions;
     std::vector<Field*> fields;
     std::vector<AtomicType*> types;
@@ -287,4 +310,3 @@ public:
 };
 
 #endif
-