Ejemplo n.º 1
0
  def __init__(self, parameter, as_template=False):
    super(ParameterSerializer, self).__init__()
    gu.inherit(self, parameter)

    self.as_template = as_template

    self.uncamelname = gu.uncamel(self.name)
    self.name = self.uncamelname
Ejemplo n.º 2
0
 def declarations(self, command):
   self.functions = '\n'.join([ s.declaration() for s in self.serializers ])
   self.contents = LibrarySerializer.functions % self.__dict__
   self.command = command
   self.upper_name = gu.uncamel(self.name).upper()
   self.include = ''
   self.type = 'FUNCTIONS'
   self.contents = LibrarySerializer.namespace % self.__dict__
   return LibrarySerializer.header % self.__dict__
Ejemplo n.º 3
0
  def definitions(self, command):
    self.functions = '\n'.join([ s.definition() for s in self.serializers ])
    self.contents = LibrarySerializer.functions % self.__dict__
    self.command = command
    self.upper_name = gu.uncamel(self.name).upper()

    self.include = '''#include "gtulu/opengl.hpp"
#include "gtulu/internal/functions.hpp"

#include "gtulu/utils/array.hpp"''' % self.__dict__
    self.type = ''
    return LibrarySerializer.namespace % self.__dict__
Ejemplo n.º 4
0
    def __init__(self, library, node, is_output=False):
        gu.inherit(self, node)

        self.name = gu.uncamel(self.name)
        self.is_template, self.tpl_name = library.template(self, is_output)
        self.hardcoded = None

        if self.typename.endswith("boolean"):
            self.type = "bool"

        self.typename = self.type
        self.typename = re.sub(r"(u?)int(\d+)", r"gtulu::\1int\2_t", self.typename)
        self.typename = re.sub(r"(u?)float(\d+)", r"gtulu::\1float\2_t", self.typename)
        # self.typename = re.sub(r'char const\* const\*', r'std::vector< std::string > const&', self.typename)
        # self.typename = re.sub(r'char const\*', r'std::string const&', self.typename)

        if self.typename == "char const*":
            self.typename = "std::string const&"

        if "const" not in self.typename and "*" not in self.typename and not is_output:
            self.typename = "%s const" % self.typename

        if self.is_template:
            self.typename = "gtulu::constant_base const&"
Ejemplo n.º 5
0
  def __init__(self, parameter):
    super(ParameterSerializer, self).__init__()
    gu.inherit(self, parameter)

    self.uncamelname = gu.uncamel(self.name)
    self.name = self.uncamelname
Ejemplo n.º 6
0
            self.constants[name] = Constant(name)
        return self.constants[name]

    def declaration(self, node):
        d = Declaration(self, node)

        if d.suffix is None and "packed" not in d.new_name:
            d.function = self.function(d.function, d.has_cardinality)
            d.function.declarations.append(d)

        return d


glx_template = (
    lambda p, o: (not o and p.typename == "GLXenum")
    and (True, gu.uncamel(p.name) + "_t")
    or (not o and p.name == "internalformat" and p.typename == "GLXint")
    and (True, "internal_format_t")
    or (not o and p.name == "internal_format" and p.typename == "GLXint")
    and (True, "internal_format_t")
    or (False, p.name)
)

GLX = Library(
    name="glx",
    prefixes=["glX", "GLX_"],
    suffixes=["ARB", "MESA"],
    files=["lib/registry/include/GL/glx.h"],
    template=glx_template,
    defines=["GLX_PROTOTYPES"],
)