#NEWLINE# def Generate( self , project_configuration , output_writer ) : #NEWLINE# #INDENT# 'Generates a library man page file (libyal.3).\n\n    Args:\n      project_configuration: the project configuration (instance of\n                             ProjectConfiguration).\n      output_writer: an output writer object (instance of OutputWriter).\n    ' #NEWLINE# include_header_path = os . path . join ( self . _projects_directory , project_configuration . library_name , 'include' , '{0:s}.h.in' . format ( project_configuration . library_name ) ) #NEWLINE# stat_object = os . stat ( include_header_path ) #NEWLINE# modification_time = time . gmtime ( stat_object . st_mtime ) #NEWLINE# include_header_file = LibraryIncludeHeaderFile ( include_header_path ) #NEWLINE# include_header_file . ReadFunctions ( project_configuration ) #NEWLINE# output_filename = '{0:s}.3' . format ( project_configuration . library_name ) #NEWLINE# output_filename = os . path . join ( 'manuals' , output_filename ) #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'header.txt' ) #NEWLINE# template_mappings = project_configuration . GetTemplateMappings ( ) #NEWLINE# template_mappings [ 'date' ] = time . strftime ( '%B %d, %Y' , modification_time ) . replace ( ' 0' , '  ' ) #NEWLINE# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename ) #NEWLINE# have_wide_character_type_functions = False #NEWLINE# for section_name in include_header_file . section_names : #NEWLINE# #INDENT# functions_per_section = include_header_file . functions_per_section . get ( section_name , [ ] ) #NEWLINE# if ( not functions_per_section ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# section_template_mappings = { #NEWLINE# #INDENT# 'section_name' : section_name , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'section.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , section_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# bfio_functions = [ ] #NEWLINE# debug_output_functions = [ ] #NEWLINE# functions = [ ] #NEWLINE# wide_character_type_functions = [ ] #NEWLINE# for function_prototype in functions_per_section : #NEWLINE# #INDENT# if function_prototype . have_bfio : #NEWLINE# #INDENT# bfio_functions . append ( function_prototype ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if function_prototype . have_debug_output : #NEWLINE# #INDENT# debug_output_functions . append ( function_prototype ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if function_prototype . have_wide_character_type : #NEWLINE# #INDENT# wide_character_type_functions . append ( function_prototype ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# functions . append ( function_prototype ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for function_prototype in functions : #NEWLINE# #INDENT# function_arguments_string = function_prototype . CopyToString ( ) #NEWLINE# function_template_mappings = { #NEWLINE# #INDENT# 'function_arguments' : function_arguments_string , #NEWLINE# 'function_name' : function_prototype . name , #NEWLINE# 'function_return_type' : function_prototype . return_type , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'function.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , function_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# if wide_character_type_functions : #NEWLINE# #INDENT# have_wide_character_type_functions = True #NEWLINE# if ( project_configuration . library_name != 'libcsplit' ) : #NEWLINE# #INDENT# section_template_mappings = { #NEWLINE# #INDENT# 'section_name' : 'Available when compiled with wide character string support:' , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'section.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , section_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# for function_prototype in wide_character_type_functions : #NEWLINE# #INDENT# function_arguments_string = function_prototype . CopyToString ( ) #NEWLINE# function_template_mappings = { #NEWLINE# #INDENT# 'function_arguments' : function_arguments_string , #NEWLINE# 'function_name' : function_prototype . name , #NEWLINE# 'function_return_type' : function_prototype . return_type , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'function.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , function_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# #UNINDENT# if bfio_functions : #NEWLINE# #INDENT# section_template_mappings = { #NEWLINE# #INDENT# 'section_name' : 'Available when compiled with libbfio support:' , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'section.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , section_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# for function_prototype in bfio_functions : #NEWLINE# #INDENT# function_arguments_string = function_prototype . CopyToString ( ) #NEWLINE# function_template_mappings = { #NEWLINE# #INDENT# 'function_arguments' : function_arguments_string , #NEWLINE# 'function_name' : function_prototype . name , #NEWLINE# 'function_return_type' : function_prototype . return_type , #NEWLINE# #UNINDENT# } #NEWLINE# template_filename = os . path . join ( self . _template_directory , 'function.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , function_template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# template_filename = os . path . join ( self . _template_directory , 'description.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# if have_wide_character_type_functions : #NEWLINE# #INDENT# template_filename = os . path . join ( self . _template_directory , 'notes.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# if have_wide_character_type_functions : #NEWLINE# #INDENT# template_filename = os . path . join ( self . _template_directory , 'notes_wchar.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename , access_mode = 'ab' ) #NEWLINE# #UNINDENT# template_filename = os . path . join ( self . _template_directory , 'footer.txt' ) #NEWLINE# self . _GenerateSection ( template_filename , template_mappings , output_writer , output_filename , access_mode = 'ab' )