Beispiel #1
0
 def pre(self, formatter):
     super().pre(formatter)
     formatter.write("""
         int %(u)s = 0;
         auto %(cc)s = &%(u)s;
     """ % {
         'cc': cc_name_of(self._context),
         'u': self._cc_array_length_name
     })
Beispiel #2
0
 def pre(self, formatter):
     super().pre(formatter)
     formatter.write("""
         int %(u)s = 0;
         auto %(cc)s = &%(u)s;
     """ % {
         'cc': cc_name_of(self._context),
         'u': self._cc_array_length_name
     })
Beispiel #3
0
 def pre(self, formatter):
     formatter.write("""
         std::vector<std::remove_cv<{t}>::type> {u};
         ozListForEach(vm, {oz}, [vm, &{u}](UnstableNode& node) {{
             std::remove_cv<{t}>::type content;
             unbuild(vm, node, content);
             {u}.push_back(std::move(content));
         }}, MOZART_STR("{t}"));
         {cc} = {u}.data();
         auto {l} = {u}.size();
     """.format(
         u=unique_str(), t=to_cc(self._type.get_pointee()),
         oz=self.oz_in_name, cc=self.cc_prefix, l=cc_name_of(self._context)
     ))
Beispiel #4
0
 def pre(self, formatter):
     formatter.write("""
         std::vector<std::remove_cv<%(t)s>::type> %(u)s;
         ozListForEach(vm, %(oz)s, [vm, &%(u)s](UnstableNode& node) {
             std::remove_cv<%(t)s>::type content;
             unbuild(vm, node, content);
             %(u)s.push_back(std::move(content));
         }, MOZART_STR("%(t)s"));
         %(cc)s = %(u)s.data();
         auto %(len)s = %(u)s.size();
     """ % {
         'u': unique_str(),
         't': to_cc(self._type.get_pointee()),
         'oz': self.oz_in_name,
         'cc': self.cc_prefix,
         'len': cc_name_of(self._context),
     })
Beispiel #5
0
 def pre(self, formatter):
     formatter.write(
         """
         std::vector<std::remove_cv<%(t)s>::type> %(u)s;
         ozListForEach(vm, %(oz)s, [vm, &%(u)s](UnstableNode& node) {
             std::remove_cv<%(t)s>::type content;
             unbuild(vm, node, content);
             %(u)s.push_back(std::move(content));
         }, MOZART_STR("%(t)s"));
         %(cc)s = %(u)s.data();
         auto %(len)s = %(u)s.size();
     """ % {
             'u': unique_str(),
             't': to_cc(self._type.get_pointee()),
             'oz': self.oz_in_name,
             'cc': self.cc_prefix,
             'len': cc_name_of(self._context),
         })
Beispiel #6
0
FUNCTION_POST_SETUP = {}

FUNCTION_PRE_TEARDOWN = {}

FUNCTION_POST_TEARDOWN = {
    'cairo_copy_clip_rectangle_list':
    'cairo_rectangle_list_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_copy_path':
    'cairo_path_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_copy_path_flat':
    'cairo_path_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_scaled_font_text_to_glyphs':
    """
        cairo_text_cluster_free(*%s);
        cairo_glyph_free(*%s);
    """ % (cc_name_of('clusters'), cc_name_of('glyphs')),
}

SPECIAL_INOUTS_FOR_TYPES = {
    'cairo_destroy_func_t': ('NodeDeleter', 0),
    'cairo_user_data_key_t const *': 'AddressIn',
}

SPECIAL_TYPES = {
    'cairo_path': ("""
        OzListBuilder nodes (vm);
        int i = 0;
        while (i < cc.num_data) {
            auto data = &cc.data[i];
            switch (data->header.type) {
                case CAIRO_PATH_MOVE_TO:
Beispiel #7
0
 def cc_name(self):
     return cc_name_of(self._name)
Beispiel #8
0
 def pre(self, formatter):
     super().pre(formatter)
     formatter.write("""
         int {u} = 0;
         auto {cc} = &{u};
     """.format(cc=cc_name_of(self._context), u=self._cc_array_length_name))
Beispiel #9
0
FUNCTION_POST_SETUP = {}

FUNCTION_PRE_TEARDOWN = {}

FUNCTION_POST_TEARDOWN = {
    'cairo_copy_clip_rectangle_list':
        'cairo_rectangle_list_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_copy_path':
        'cairo_path_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_copy_path_flat':
        'cairo_path_destroy(*' + CC_NAME_OF_RETURN + ');',
    'cairo_scaled_font_text_to_glyphs': """
        cairo_text_cluster_free(*%s);
        cairo_glyph_free(*%s);
    """ % (cc_name_of('clusters'), cc_name_of('glyphs')),
}

SPECIAL_INOUTS_FOR_TYPES = {
    'cairo_destroy_func_t': ('NodeDeleter', 0),
    'cairo_user_data_key_t const *': 'AddressIn',
}

SPECIAL_TYPES = {
    'cairo_path': ("""
        OzListBuilder nodes (vm);
        int i = 0;
        while (i < cc.num_data) {
            auto data = &cc.data[i];
            switch (data->header.type) {
                case CAIRO_PATH_MOVE_TO:
Beispiel #10
0
 def cc_name(self):
     return cc_name_of(self._name)