wip: more comfpile work
This commit is contained in:
parent
ac969681e6
commit
cdb5492bfe
3 changed files with 57 additions and 31 deletions
|
@ -145,13 +145,6 @@ $core.add_artefact_engine do |engine|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
t_start = Time.now()
|
|
||||||
dep_art = $core.craft_and_complete(:gtkwave_output, "spi_master_tb.vhd")
|
|
||||||
t_end = Time.now()
|
|
||||||
|
|
||||||
puts "Full dependency list is: #{dep_art.dependencies.map(&:target)} (took #{t_end - t_start})"
|
|
||||||
puts "Includes of all source files:"
|
|
||||||
|
|
||||||
# (If you use this, don't forget to add pry to your Gemfile!)
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||||
require "pry"
|
require "pry"
|
||||||
Pry.start
|
Pry.start
|
||||||
|
|
|
@ -2,37 +2,68 @@
|
||||||
|
|
||||||
module Comfpile
|
module Comfpile
|
||||||
class ContextTag
|
class ContextTag
|
||||||
def initialize(tag)
|
attr_reader :tag, :taglist
|
||||||
@@known_tags ||= {}
|
|
||||||
|
def self.form_context(tag)
|
||||||
|
@known_tags ||= {}
|
||||||
|
|
||||||
case tag
|
case tag
|
||||||
when Symbol, String
|
when Symbol
|
||||||
precompiled = @@known_tags[tag.to_sym]
|
tag_instance = @known_tags[tag]
|
||||||
|
|
||||||
if not precompiled.nil?
|
return tag_instance unless tag_instance.nil?
|
||||||
@tag = precompiled[:tag]
|
|
||||||
@tag_array = precompiled[:array]
|
tag_instance = ContextTag.new(tag)
|
||||||
else
|
tag_instance = (@known_tags[tag_instance] ||= tag_instance)
|
||||||
@tag_array = tag.to_s.split('_').uniq.sort
|
|
||||||
|
@known_tags[tag] ||= tag_instance
|
||||||
end
|
@known_tags[tag_instance.tag] ||= tag_instance
|
||||||
when Array
|
|
||||||
@tag_array = tag.map(&:to_s).uniq.sort
|
|
||||||
@tag = @tag_array
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@tag ||= @tag_array.join('_').to_sym
|
|
||||||
|
|
||||||
tag_data = {
|
|
||||||
tag: @tag,
|
|
||||||
array: @ŧag_array
|
|
||||||
}
|
|
||||||
|
|
||||||
@@known_tags[@tag] ||= tag_data
|
|
||||||
@@known_tags[tag] ||= tag_data
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize(tag)
|
||||||
|
process_tag(tag)
|
||||||
|
end
|
||||||
|
|
||||||
|
private def process_tag(tag)
|
||||||
|
case tag
|
||||||
|
when Symbol, String
|
||||||
|
@taglist = tag.to_s.split('_').uniq.sort
|
||||||
|
when Array
|
||||||
|
@taglist = tag.map(&:to_s).uniq.sort
|
||||||
|
end
|
||||||
|
|
||||||
|
@tag = @taglist.join('_').to_sym
|
||||||
|
@taghash = {}
|
||||||
|
@taglist.each do |tag|
|
||||||
|
@taghash[tag] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def include?(*tags)
|
||||||
|
tags = tags - @tag_array
|
||||||
|
|
||||||
|
tags.empy?
|
||||||
|
end
|
||||||
|
alias include_all? include?
|
||||||
|
|
||||||
|
def include_any?(*tags)
|
||||||
|
tags = tags & @tag_array
|
||||||
|
|
||||||
|
tags.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
def hash
|
||||||
|
@tag.hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def eql?(other)
|
||||||
|
if(other.is_a? Symbol)
|
||||||
|
@tag.eql? other
|
||||||
|
elsif(other.is_a? ContextTag)
|
||||||
|
@tag.eql? other.tag
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
require_relative 'artefact_engine.rb'
|
require_relative 'artefact_engine.rb'
|
||||||
|
|
||||||
|
require_relative 'context.rb'
|
||||||
|
|
||||||
module Comfpile
|
module Comfpile
|
||||||
class Core
|
class Core
|
||||||
attr_reader :processing_stack
|
attr_reader :processing_stack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue