Beispiel #1
0
def init_output_var(test_case):    
    global_var_data_type = "Struct_Uint8Data_Typedef"
    return_obj_data_type = "Struct_Uint8Data_Typedef"        
        
    # Initialize return object   
    for obj in test_case.return_objs:
        if "True" == obj.is_pointer:
            if 8 == Config.system_register_size:
                return_obj_data_type = "Struct_Uint8PtrData_Typedef"
            if 16 == Config.system_register_size:
                return_obj_data_type = "Struct_Uint16PtrData_Typedef"
            if 32 == Config.system_register_size:
                return_obj_data_type = "Struct_Uint64PtrData_Typedef"

        GenUtils.gen_comment_line(gen_source_file, "Declare object to store returning value")
        GenUtils.gen_var_declaration(gen_source_file, return_obj_data_type, obj.gen_name)
        # Declare a temporary pointer to stored the returning address.
        if "True" == obj.is_pointer:
            GenUtils.source_file("uint8_t *result_ptr;")


    # Initialize global variables   
    for var in test_case.global_vars:
        GenUtils.gen_comment_line(gen_source_file, "Declare object to check value of " + var.actual_mem)
        GenUtils.gen_var_declaration(gen_source_file, global_var_data_type, var.gen_name)
    GenUtils.gen_break_line(gen_source_file)
Beispiel #2
0
def init_param(test_case):
    for param in test_case.params:
        GenUtils.gen_comment_line(gen_source_file, "Initialize " + param.gen_name)
        if param.is_struct_type == "False":
            GenUtils.gen_var_definition(gen_source_file, param.type, param.param_name, param.init_value)
        else:
            GenUtils.gen_var_declaration(gen_source_file, param.type, param.param_name)
            # Split the structure init contents into lines and store in an array
            struct_member_init = param.init_value.split("\n") 
            for statement in struct_member_init:
                GenUtils.source_file(param.param_name + "." + statement + ";")
    GenUtils.gen_break_line(gen_source_file)