예제 #1
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self, "ArrayReadFunction.tpl.c")

        reqtags = self.requireTags(dsk_type,
                                   {"tag": tags.dsk.GenerateArrayReadFunction})

        tag = dsk_type.getTag(tags.dsk.GenerateArrayReadFunction)

        if not isinstance(tag.getNumElementsField().getType(),
                          aftermath.types.FixedWidthIntegerType):
            raise Exception("Field with number of elements must be an integer "
                            "with a fixed number of bits")

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="dsk", field_type=dsk_type, is_pointer=True)
            ]))
        self.addDefaultArguments(dsk_type=dsk_type, **reqtags)
예제 #2
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(
            self, "WriteToBufferWithDefaultIDFunction.tpl.c")

        reqtags = self.requireTags(
            dsk_type, {
                "gen_tag": tags.dsk.GenerateWriteToBufferWithDefaultIDFunction,
                "wtb_tag": tags.dsk.WriteToBufferFunction
            })

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["gen_tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="wb",
                      field_type=aftermath.types.aux.am_write_buffer,
                      is_pointer=True),
                Field(name="e",
                      field_type=dsk_type,
                      is_pointer=True,
                      is_const=True)
            ]))

        self.addDefaultArguments(dsk_type=dsk_type, **reqtags)
예제 #3
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self, "PerTraceArrayFunction.tpl.c")

        reqtags_dsk = self.requireTags(
            dsk_type, {
                "gen_tag": tags.dsk.tomem.GeneratePerTraceArrayFunction,
                "tomem_tag": aftermath.tags.dsk.tomem.ConversionFunction
            })

        gen_tag = reqtags_dsk["gen_tag"]
        tomem_tag = reqtags_dsk["tomem_tag"]

        reqtags_mem = self.requireTags(tomem_tag.getMemType(), {
            "store_tag":
            aftermath.tags.mem.store.pertracearray.AppendFunction
        })

        FunctionTemplate.__init__(
            self,
            function_name=gen_tag.getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="dsk", field_type=dsk_type, is_pointer=True)
            ]))

        self.addDefaultArguments(dsk_type=dsk_type)
        self.addDefaultArguments(**reqtags_dsk)
        self.addDefaultArguments(**reqtags_mem)
예제 #4
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self, "WriteFunction.tpl.c")

        reqtags = self.requireTags(dsk_type,
                                   {"gen_tag": tags.dsk.GenerateWriteFunction})

        if reqtags["gen_tag"].hasTypeParam():
            tp = [
                Field(name="type_id",
                      field_type=aftermath.types.builtin.uint32_t)
            ]
        else:
            tp = []

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["gen_tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True)
            ] + tp + [
                Field(name="dsk",
                      field_type=dsk_type,
                      is_pointer=True,
                      is_const=True)
            ]))

        self.addDefaultArguments(dsk_type=dsk_type, **reqtags)
예제 #5
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self, "PostConversionFunction.tpl.c")

        reqtags = self.requireTags(
            dsk_type, {
                "gen_tag": tags.dsk.tomem.GeneratePostConversionFunction,
                "conversion_tag": tags.dsk.tomem.ConversionFunction
            })

        tag = reqtags["gen_tag"]
        conversion_tag = reqtags["conversion_tag"]
        mem_type = conversion_tag.getMemType()

        FunctionTemplate.__init__(
            self,
            function_name=tag.getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="dsk", field_type=dsk_type, is_pointer=True),
                Field(name="mem",
                      field_type=conversion_tag.getMemType(),
                      is_pointer=True)
            ]))

        self.addDefaultArguments(mem_type = mem_type, \
                                 dsk_type = dsk_type, \
                                 **reqtags)
예제 #6
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self,
                                    "AddToAllMetaStructArraysFunction.tpl.c")

        reqtags = self.requireTags(
            dsk_type, {
                "gen_tag":
                tags.dsk.tomem.GenerateAddToAllMetaStructArraysFunction,
                "dsktometa_tag": tags.dsk.tomem.join.DskToMetaSources
            })

        gen_tag = reqtags["gen_tag"]

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["gen_tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="dsk",
                      field_type=gen_tag.getDskType(),
                      is_pointer=True),
                Field(name="mem",
                      field_type=gen_tag.getMemType(),
                      is_pointer=True)
            ]))
        self.addDefaultArguments(**reqtags)
예제 #7
0
    def __init__(self, tpl_file, reqtags, mem_type):
        Jinja2FileTemplate.__init__(self, tpl_file)

        tag = reqtags["tag"]
        gen_tag = reqtags["gen_tag"]

        FunctionTemplate.__init__(
            self,
            function_name=tag.getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="e", field_type=mem_type, is_pointer=True)
            ]))

        if gen_tag.getTraceArrayIdent():
            trace_array_ident = gen_tag.getTraceArrayIdent()
        else:
            trace_array_ident = mem_type.getIdent()

        if gen_tag.getTraceArrayStructName():
            trace_array_struct_name = gen_tag.getEventArrayStructName()
        else:
            trace_array_struct_name = mem_type.getName() + "_array"

        self.addDefaultArguments( \
            mem_type = mem_type, \
            trace_array_ident = trace_array_ident, \
            trace_array_struct_name = trace_array_struct_name, \
            **reqtags)
예제 #8
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(self, "ReadFunction.tpl.c")

        reqtags = self.requireTags(dsk_type,
                                   {"tag": tags.dsk.GenerateReadFunction})

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="dsk", field_type=dsk_type, is_pointer=True)
            ]))
        self.addDefaultArguments(dsk_type=dsk_type, **reqtags)
예제 #9
0
    def __init__(self, tpl_file, reqtags, mem_type):
        Jinja2FileTemplate.__init__(self, tpl_file)

        tag = reqtags["tag"]
        gen_tag = reqtags["gen_tag"]

        FunctionTemplate.__init__(
            self,
            function_name=tag.getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(
                    name="ecoll_id",
                    field_type=aftermath.types.base.am_event_collection_id_t),
                Field(name="sub_id", field_type=gen_tag.getSubArrayIDType()),
                Field(name="e", field_type=mem_type, is_pointer=True)
            ]))

        if gen_tag.getEventCollectionArrayStructName():
            ecoll_array_struct_name = gen_tag.getEventCollectionArrayStructName(
            )
        else:
            ecoll_array_struct_name = mem_type.getName() + "_array"

        if gen_tag.getEventArrayStructName():
            event_array_struct_name = gen_tag.getEventArrayStructName()
        else:
            event_array_struct_name = mem_type.getName() + "_array"

        if gen_tag.getEventArrayIdent():
            event_array_ident = gen_tag.getEventArrayIdent()
        else:
            event_array_ident = mem_type.getIdent()

        self.addDefaultArguments(
            mem_type=mem_type,
            ecoll_array_struct_name=ecoll_array_struct_name,
            event_array_struct_name=event_array_struct_name,
            event_array_ident=event_array_ident,
            **reqtags)
예제 #10
0
    def __init__(self, dsk_type):
        Jinja2FileTemplate.__init__(
            self, "GenerateProcessCollectSourcesFunction.tpl.c")

        reqtags = self.requireTags(dsk_type, {
            "gen_tag":
            tags.mem.collect.GenerateProcessCollectSourcesFunction,
        })

        gen_tag = reqtags["gen_tag"]

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["gen_tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True)
            ]))
        self.addDefaultArguments(**reqtags)
예제 #11
0
    def __init__(self, t):
        Jinja2FileTemplate.__init__(self, "AssertFunction.tpl.c")

        reqtags = self.requireTags(t, {
            "gen_tag" : tags.assertion.GenerateAssertFunction,
        })

        FunctionTemplate.__init__(
            self,
            function_name = reqtags["gen_tag"].getFunctionName(),
            return_type = aftermath.types.builtin.int,
            inline = True,
            arglist = FieldList([
                Field(name = "ctx",
                      field_type = aftermath.types.aux.am_io_context,
                      is_pointer = True),
                Field(name = "e",
                      field_type = t,
                      is_pointer = True,
                      is_const = True)
            ]))
        self.addDefaultArguments(t = t, **reqtags)
예제 #12
0
    def __init__(self, t):
        Jinja2FileTemplate.__init__(self,
                                    "TraceMinMaxTimestampCompoundScan.tpl.c")

        enforce_type(t, aftermath.types.CompoundType)

        reqtags = self.requireTags(
            t,
            {"gen_tag": tags.process.GenerateTraceMinMaxTimestampCompoundScan})

        FunctionTemplate.__init__(
            self,
            function_name=reqtags["gen_tag"].getFunctionName(),
            return_type=aftermath.types.builtin.int,
            inline=True,
            arglist=FieldList([
                Field(name="ctx",
                      field_type=aftermath.types.aux.am_io_context,
                      is_pointer=True),
                Field(name="e", field_type=t, is_pointer=True)
            ]))

        self.addDefaultArguments(t=t, **reqtags)