Class: SFRP::Compiler
- Inherits:
-
Object
- Object
- SFRP::Compiler
- Defined in:
- lib/sfrp/compiler.rb
Instance Method Summary collapse
- #compile(output_dir_path = nil) ⇒ Object
-
#initialize(main_fmodule_uri, include_paths) ⇒ Compiler
constructor
A new instance of Compiler.
- #make_input_set ⇒ Object
- #make_output_set ⇒ Object
- #output_file_names ⇒ Object
Constructor Details
#initialize(main_fmodule_uri, include_paths) ⇒ Compiler
Returns a new instance of Compiler.
13 14 15 16 |
# File 'lib/sfrp/compiler.rb', line 13 def initialize(main_fmodule_uri, include_paths) @main_fmodule_uri = main_fmodule_uri @include_paths = include_paths end |
Instance Method Details
#compile(output_dir_path = nil) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/sfrp/compiler.rb', line 37 def compile(output_dir_path = nil) virtual_files = collect_virtual_files(@main_fmodule_uri) output_set = make_output_set output_set.generate!(output_dir_path, virtual_files) if output_dir_path output_file_names end |
#make_input_set ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/sfrp/compiler.rb', line 18 def make_input_set Input::Set.new do |s| collect_fmodule_uris(@main_fmodule_uri).each do |uri| content = File.read(to_full_path(uri)) s.append_source_file(uri, content) end end end |
#make_output_set ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/sfrp/compiler.rb', line 27 def make_output_set make_input_set .to_raw .to_flat .to_poly .to_mono .to_low(collect_include_strs(@main_fmodule_uri)) .to_output end |
#output_file_names ⇒ Object
44 45 46 47 48 |
# File 'lib/sfrp/compiler.rb', line 44 def output_file_names ['main'] + collect_virtual_files(@main_fmodule_uri).flat_map do |vf| vf.file_ext == 'c' ? [vf.fmodule_uri.gsub('.', '/')] : [] end end |