def generate_source(tgtApp): global g_OutDir # Construct file path name = tgtApp.lower() + "_app.c" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "src", name) fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_source_head_content(tgtApp)) fileHdl.write(construct_source_init_event_content(tgtApp)) fileHdl.write(construct_source_init_pipe_content(tgtApp)) fileHdl.write(construct_source_init_data_content(tgtApp)) fileHdl.write(construct_source_init_app_content(tgtApp)) fileHdl.write(construct_source_cleanup_content(tgtApp)) fileHdl.write(construct_source_recv_msg_content(tgtApp)) fileHdl.write(construct_source_process_new_data_content(tgtApp)) fileHdl.write(construct_source_process_new_cmds_content(tgtApp)) fileHdl.write(construct_source_process_new_app_cmds_content(tgtApp)) fileHdl.write(construct_source_report_hk_content(tgtApp)) fileHdl.write(construct_source_send_out_data_content(tgtApp)) fileHdl.write(construct_source_verify_cmd_len_content(tgtApp)) fileHdl.write(construct_source_main_content(tgtApp)) fileHdl.write(construct_source_tail_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_readme(tgtApp): global g_OutDir # Open file filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "src", "ReadMe.txt") file_exist_flg = os.path.exists(filePath) fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_readme_content()) # Close file app_utils.close_file_from_writing(fileHdl, filePath, file_exist_flg)
def generate_screen_file(tgtApp): global g_OutDir # Open file filePath = os.path.join(g_OutDir, tgtApp.upper(), "screens", tgtApp.lower()+"_screen.txt") file_exist_flg = os.path.exists(filePath) fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_screen_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, file_exist_flg)
def generate_ut_main(tgtApp): global g_OutDir # Open file name = "ut_" + tgtApp.lower() + ".c" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "unit_test", name) fileExist_p = os.path.exists(filePath) fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_ut_main_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_makefile(tgtApp): global g_OutDir # Construct file path filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "unit_test", "Makefile") fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_makefile_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_makefile(tgtApp): global g_OutDir # Construct file path filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "for_build", "Makefile") fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_makefile_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_header(tgtApp): global g_OutDir # Construct file path name = tgtApp.lower() + "_app.h" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "src", name) fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_header_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_global_types(tgtApp): global g_OutDir, g_Mission # Construct file path name = g_Mission.upper() + "_" + tgtApp.lower() + "_types.h" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", name) fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_global_types_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p)
def generate_cds_utils_header(tgtApp): global g_OutDir, g_Tbls # Construct file path name = tgtApp.lower() + "_cds_utils.h" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "tables", name) fileExist_p = os.path.exists(filePath) if "none" in g_Tbls or "cds" not in g_Tbls: # Remove file app_utils.remove_file(filePath) elif "cds" in g_Tbls: # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_cds_util_header_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p) else: pass
def generate_table_makefile(tgtApp): global g_OutDir, g_Tbls # Construct file path name = tgtApp.lower() + "_tables.mak" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "for_build", name) if not g_Tbls: # Remove existing file, if exists app_utils.remove_file(filePath) elif "iload" in g_Tbls or "cds" in g_Tbls: fileExist_p = os.path.exists(filePath) # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_table_makefile_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p) else: pass
def generate_iload_utils_source(tgtApp): global g_OutDir, g_Tbls # Construct file path name = tgtApp.lower() + "_iload_utils.c" filePath = os.path.join(g_OutDir, tgtApp.lower(), "fsw", "tables", name) fileExist_p = os.path.exists(filePath) if "none" in g_Tbls or "iload" not in g_Tbls: # Remove file app_utils.remove_file(filePath) elif "iload" in g_Tbls: # Open file fileHdl = app_utils.open_file_for_writing(filePath, False) # Write to file fileHdl.write(construct_source_iload_util_head_content(tgtApp)) fileHdl.write(construct_source_iload_util_init_content(tgtApp)) fileHdl.write(construct_source_iload_util_validate_content(tgtApp)) fileHdl.write(construct_source_iload_util_process_content(tgtApp)) fileHdl.write(construct_source_iload_util_tail_content(tgtApp)) # Close file app_utils.close_file_from_writing(fileHdl, filePath, fileExist_p) else: pass