Beispiel #1
0
    def records(self):
        """Returns the list of record types, as a list of tuples:
               [ (ctype name,  corresponding CType, ada name, [fields],
                 [union], [private=False]) ...]
           Where fields is a dict for each field whose type is
           overridden:
               { name: CType, ... }
           and union is a list of tuples (value, field) associating
           a field of a <union> with the corresponding value of the
           discriminant.

           The returned list includes records added via add_record_type
        """

        result = []
        if self.node:
            for rec in self.node.findall("record"):
                override_fields = {}

                for field in rec.findall("field"):
                    override_fields[field.get("name")] = \
                        naming.type(name="", cname=field.get("ctype"))

                unions = []
                for field in rec.findall("union"):
                    unions.append((field.get("value"), field.get("field")))

                result.append((rec.get("ctype"),
                               naming.type(name="", cname=rec.get("ctype")),
                               rec.get("ada"), override_fields, unions,
                               rec.get("private", "false").lower() == "true"))

        return result
Beispiel #2
0
    def records(self):
        """Returns the list of record types, as a list of tuples:
               [ (ctype name,  corresponding CType, ada name, [fields],
                 [union], [private=False]) ...]
           Where fields is a dict for each field whose type is
           overridden:
               { name: CType, ... }
           and union is a list of tuples (value, field) associating
           a field of a <union> with the corresponding value of the
           discriminant.

           The returned list includes records added via add_record_type
        """

        result = []
        if self.node:
            for rec in self.node.findall("record"):
                override_fields = {}

                for field in rec.findall("field"):
                    override_fields[field.get("name")] = \
                        naming.type(name="", cname=field.get("ctype"))

                unions = []
                for field in rec.findall("union"):
                    unions.append((field.get("value"), field.get("field")))

                result.append((rec.get("ctype"),
                               naming.type(name="",
                                           cname=rec.get("ctype")),
                               rec.get("ada"),
                               override_fields, unions,
                               rec.get("private", "false").lower() == "true"))

        return result
Beispiel #3
0
    def lists(self):
        """Return the list of list instantiations we need to add to the
           package. Returns a list of tuples:
              [(adaname, CType for element,
                  true for a single-linked list, section),
                ...]
        """
        result = []
        if self.node:
            for l in self.node.findall("list"):
                result.append(
                    (l.get("ada"), naming.type(name="",
                                               cname=l.get("ctype")), False,
                     l.get("section", "")))
            for l in self.node.findall("slist"):
                result.append(
                    (l.get("ada"), naming.type(name="",
                                               cname=l.get("ctype")), True,
                     l.get("section", "")))

        return result
Beispiel #4
0
    def lists(self):
        """Return the list of list instantiations we need to add to the
           package. Returns a list of tuples:
              [(adaname, CType for element,
                  true for a single-linked list, section),
                ...]
        """
        result = []
        if self.node:
            for l in self.node.findall("list"):
                result.append((l.get("ada"),
                               naming.type(name="", cname=l.get("ctype")),
                               False,
                               l.get("section", "")))
            for l in self.node.findall("slist"):
                result.append((l.get("ada"),
                               naming.type(name="", cname=l.get("ctype")),
                               True,
                               l.get("section", "")))

        return result
Beispiel #5
0
 def enumerations(self):
     """List of all enumeration types that need to be declared in the
        package. The result is a list of tuples.
     """
     result = []
     if self.node:
         for enum in self.node.findall("enum"):
             result.append((enum.get("ctype"),
                            naming.type(name="", cname=enum.get("ctype")),
                            enum.get("prefix", "GTK_"),
                            enum.get("asbitfield", "false").lower() == "true",
                            enum.get("ignore", "")
                            ))
     return result
Beispiel #6
0
 def enumerations(self):
     """List of all enumeration types that need to be declared in the
        package. The result is a list of tuples.
     """
     result = []
     if self.node:
         for enum in self.node.findall("enum"):
             result.append(
                 (enum.get("ctype"),
                  naming.type(name="", cname=enum.get("ctype")),
                  enum.get("prefix",
                           "GTK_"), enum.get("asbitfield",
                                             "false").lower() == "true",
                  enum.get("ignore", "")))
     return result