Esempio n. 1
0
    def __init__(self, *args, **kwargs):
        JinjaGenerator.__init__(self, *args, **kwargs)

        self._headers = dict()

        self.environment.globals.update(
            get_debug_impl=get_debug_impl,
            loadable=loadable,
            enum_member=enum_member,
            chain=itertools.chain
        )

        self.environment.filters.update(
            defined=lambda x: 'defined({})'.format(x),
            type_to_c=type_to_c,
            params_to_c=params_to_c,
            param_names=param_names,
            pfn=pfn,
            ctx=ctx,
            no_prefix=jinja2.contextfilter(lambda ctx, value: strip_specification_prefix(value, ctx['spec'])),
            c_commands=c_commands
        )

        self.environment.tests.update(
            supports=lambda x, arg: x.supports(arg),
            void=is_void,
        )
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        JinjaGenerator.__init__(self, *args, **kwargs)

        self.environment.globals.update(type_to_volt=type_to_volt,
                                        params_to_volt=params_to_volt,
                                        enum_to_volt=enum_to_volt,
                                        chain=itertools.chain)
Esempio n. 3
0
    def __init__(self, *args, **kwargs):
        JinjaGenerator.__init__(self, *args, **kwargs)

        self.environment.filters.update(
            feature=lambda x: 'feature = "{}"'.format(x),
            enum_type=jinja2.contextfilter(lambda ctx, enum: enum_type(enum, ctx['feature_set'])),
            enum_value=jinja2.contextfilter(lambda ctx, enum: enum_value(enum, ctx['feature_set'])),
            type=to_rust_type,
            params=to_rust_params,
            identifier=identifier,
            no_prefix=jinja2.contextfilter(lambda ctx, value: strip_specification_prefix(value, ctx['spec']))
        )