Class: GeneratorPartials
- Defined in:
- lib/ceedling/generators/generator_partials.rb
Instance Method Summary collapse
- #generate_implementation(test:, name:, function_definitions:, source_includes:, header_includes:, c_module:, output_path:) ⇒ Object
- #generate_interface(test:, name:, function_declarations:, includes:, c_module:, output_path:) ⇒ Object
Instance Method Details
#generate_implementation(test:, name:, function_definitions:, source_includes:, header_includes:, c_module:, output_path:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ceedling/generators/generator_partials.rb', line 16 def generate_implementation( test:, name:, function_definitions:, source_includes:, header_includes:, c_module:, output_path: ) source = @file_path_utils.form_partial_implementation_source_filename(name) header = @file_path_utils.form_partial_implementation_header_filename(name) header_filepath = File.join(output_path, header) source_filepath = File.join(output_path, source) # Binary mode: the function bodies written below may already contain their # own line endings verbatim. Windows text mode rewrites every "\n" on # write, which would alter any line ending already present in that # content instead of passing it through unchanged. @file_wrapper.open(header_filepath, 'wb') do |file| generate_header(file, header, header_includes, function_definitions, c_module, true) end @file_wrapper.open(source_filepath, 'wb') do |file| generate_source(file, source_includes, function_definitions, c_module) end return source_filepath end |
#generate_interface(test:, name:, function_declarations:, includes:, c_module:, output_path:) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ceedling/generators/generator_partials.rb', line 46 def generate_interface(test:, name:, function_declarations:, includes:, c_module:, output_path:) header = @file_path_utils.form_partial_interface_header_filename(name) filepath = File.join(output_path, header) # Binary mode: see generate_implementation above. @file_wrapper.open(filepath, 'wb') do |file| generate_header(file, header, includes, function_declarations, c_module, false) end return filepath end |