Top Level Namespace
Defined Under Namespace
Modules: C99, Enumerable, Origen
Classes: Array, Bignum, Fixnum, Hash, Module, Numeric, Object, OptionParser, Range, String
Constant Summary
collapse
- ORIGEN_COMMAND_ALIASES =
{
'g' => 'generate',
'p' => 'program',
't' => 'target',
'-t' => 'target', 'e' => 'environment',
'-e' => 'environment',
'mods' => 'modifications',
'-o' => 'modifications', 'l' => 'lsf',
'i' => 'interactive',
'c' => 'compile',
'pl' => 'plugin',
'-v' => 'version',
'--version' => 'version'
}
Origen::GlobalMethods::Flow, Origen::GlobalMethods::Pattern, Origen::GlobalMethods::Resources, Origen::GlobalMethods::User
Class Method Summary
collapse
Instance Method Summary
collapse
#find_space, #get_text, #split_long_line
#annotate, #c1, #c2, #debug, #encoding_search, #encodings, #get_excel_column, #get_full_class, #global_binding, #options, #pp, #render, #require_gem, #snip, #ss
Class Method Details
._with_doc_tester(options) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/origen/commands/program.rb', line 44
def self._with_doc_tester(options)
if options[:doc]
Origen.app.with_doc_tester do
yield
end
else
yield
end
end
|
Instance Method Details
#_unmanaged_dirs ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/origen/commands/rc.rb', line 21
def _unmanaged_dirs
unmanaged_dirs = Origen::RevisionControl::IGNORE_DIRS
unmanaged_dirs += config.unmanaged_dirs || []
unmanaged_dirs.map do |d|
if Pathname.new(d).absolute?
d
else
"#{Origen.root}/#{d}"
end
end
end
|
#_unmanaged_files ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/origen/commands/rc.rb', line 5
def _unmanaged_files
unmanaged_files = Origen::RevisionControl::IGNORE_FILES
unmanaged_files += config.unmanaged_files || []
unmanaged_files += Origen.import_manager.all_symlinks || []
unmanaged_files.map do |f|
if f =~ /\*/ || Pathname.new(f).absolute?
f
else
"#{Origen.root}/#{f}"
end
end
end
|
110
111
112
113
|
# File 'lib/origen/commands.rb', line 110
def debugger
caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
puts "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} - debugger statement ignored, run again with '-d' to enable it"
end
|
#evaluate_limit(limit) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/origen/specs/checkers.rb', line 69
def evaluate_limit(limit)
return limit if limit.is_a?(Numeric) || limit.is_a?(Symbol)
return nil if limit.nil?
limit.gsub!("\n", ' ')
limit.scrub!
result = false
if !!(limit.match(/^\d+\.\d+$/)) || !!(limit.match(/^-\d+\.\d+$/))
result = Float(limit).round(4) rescue false elsif !!(limit.match(/\d+\.\d+\s+\d+\.\d+/)) Origen.log.debug "Found two numbers without an operator in the limit string '#{limit}', choosing the first..."
first_number = limit.match(/(\d+\.\d+)\s+\d+\.\d+/).captures.first
result = Float(first_number).round(4) rescue false else
result = Integer(limit) rescue false
end
if result == false
begin
result = eval(limit)
return result.round(4) if result.is_a? Numeric
rescue SyntaxError, NameError, TypeError
Origen.log.debug "Limit '#{limit}' had to be rescued, storing it as a #{limit.class}"
if limit.is_a? Symbol
return limit
else
return "#{limit}"
end
end
else
return result
end
end
|
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/origen/specs/checkers.rb', line 55
def get_mode
spec_mode = nil
if current_mode.nil?
if self == Origen.top_level
spec_mode = :global
else
spec_mode = :local
end
else
spec_mode = current_mode.name
end
spec_mode
end
|
#limits_ok? ⇒ Boolean
Check that min, max are not mixed with typ. If a user wants a baseline value for a spec use target as it will not be checked against pass/fail
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/origen/specs/checkers.rb', line 23
def limits_ok?
status = true
if (@min.exp.to_s.include? '/') || (@max.exp.to_s.include? '/')
return status
end
if @min.exp.nil? ^ @max.exp.nil?
@limit_type = :single_sided
if @typ.exp
Origen.log.debug "Spec #{@name} has a typical limit defined with either min or max. They are mutually exclusive, use 'target' when using min or max"
end
elsif @min.exp && @max.exp
@limit_type = :double_sided
if @min.value.is_a?(Numeric) && @max.value.is_a?(Numeric)
if @max.value <= @min.value || @min.value >= @max.value
status = false
Origen.log.debug "Spec #{@name} has min (#{@min.value}) and max (#{@max.value}) reversed"
end
unless @target.nil?
if @target.value <= @min.value || @target.value >= @max.value
status = false
Origen.log.debug "Spec #{@name} has a target (#{@target.value}) that is not within the min (#{@min.value}) and max #{@max.value}) values"
end
end
end
end
status
end
|
#min_ruby_version ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/origen/ruby_version_check.rb', line 7
def min_ruby_version
if Origen.os.windows?
'1.9.3'
else
'2.1.0'
end
end
|
#name_audit(name) ⇒ Object
rubocop:disable Style/RescueModifier:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/origen/specs/checkers.rb', line 2
def name_audit(name)
return name if name.nil?
return nil unless name.is_a?(Symbol) || name.is_a?(String)
if name == :inspect
Origen.log.debug ':inspect is a reserved spec name'
return nil
end
if name.match(/^\d/)
Origen.log.debug "Spec #{name} starts with a number"
return nil
end
if name.match(/\s+/)
Origen.log.debug "Spec #{name} contains white space, removing it"
name.delete!(/\s+/)
end
name.is_a?(String) ? name.downcase.to_sym : name
end
|
#require_type_or_id(options) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/origen/commands/lsf.rb', line 5
def require_type_or_id(options)
unless options[:id] || options[:type]
puts 'You must supply a job type or ID'
exit 1
end
end
|
#ruby_acceptable_to_run? ⇒ Boolean
3
4
5
|
# File 'lib/origen/ruby_version_check.rb', line 3
def ruby_acceptable_to_run?
RUBY_VERSION >= min_ruby_version
end
|
#workspace_dirs ⇒ Object
36
37
38
|
# File 'lib/origen/commands/rc.rb', line 36
def workspace_dirs
"#{Origen.root} " + Origen.app.config.external_app_dirs.join(' ')
end
|