]> git.tdb.fi Git - gldbg.git/blobdiff - genwrap.py
Allow tagging funtions for handcoding in templates
[gldbg.git] / genwrap.py
index ec239853875a386fdca9a4961b733a77622177c5..e614ab71ac34f2c237ad4f1571572490577ba602 100755 (executable)
@@ -138,8 +138,6 @@ class Function:
                                        self.csize = "%d*sizeof(%s)"%(self.size, self.base_ctype)
                                elif self.size.startswith("COMPSIZE("):
                                        self.csize = self.func.compsize(self.size[9:-1], self.base_ctype)
-                               elif self.size=="" and (self.type=="charARB" or self.type=="Char"):
-                                       self.csize = "strlen"
                                else:
                                        s = self.func.get_param(self.size.split('*')[0])
                                        if (s.type=="SizeI" or s.type.endswith("Int32") or s.type.startswith("BufferSize")) and s.kind=="value":
@@ -197,7 +195,7 @@ class Function:
                                sys.stderr.write("Compsize '%s' for function '%s' failed: Parameter '%s' has unknown type '%s'\n"%(size, self.name, param.name, param.type))
                                return
                if not have_type:
-                       res += "*sizeof(%s)"%param.ctype
+                       res += "*sizeof(%s)"%btype
                return res
 
        def finalize(self):
@@ -211,6 +209,7 @@ class Function:
 class Template:
        def __init__(self, fn):
                self.sections = []
+               self.handcode = []
 
                literal = True
                text = ""
@@ -221,6 +220,10 @@ class Template:
                                        text = ""
                                text += line[1:]+"\n"
                                literal = True
+                       elif line[0]=='!':
+                               parts = line[1:].split()
+                               if parts[0]=="handcode":
+                                       self.handcode.append(parts[1])
                        else:
                                if literal and text:
                                        self.add_section(text, literal)
@@ -248,6 +251,8 @@ class Template:
                                print sect
                        else:
                                for func in functions:
+                                       if func.name in self.handcode:
+                                               continue
                                        globals = {
                                                "w": self.write,
                                                "wl": self.writeln,