Class: AutoC::Module::Source
Instance Attribute Summary (collapse)
-
- (Object) file_name
readonly
Returns the value of attribute file_name.
-
- (Object) index
readonly
Returns the value of attribute index.
Attributes inherited from File
Instance Method Summary (collapse)
-
- (Source) initialize(m, i)
constructor
A new instance of Source.
- - (Boolean) main?
- - (Object) new_stream
- - (Object) size
- - (Boolean) smallest?
- - (Object) write(stream)
Methods inherited from File
Constructor Details
- (Source) initialize(m, i)
Returns a new instance of Source
193 194 195 196 197 |
# File 'lib/autoc/code.rb', line 193 def initialize(m, i) super(m) @index = i @file_name = @module.source_count > 1 ? "#{@module.name.downcase}_auto#{index}.c" : "#{@module.name.downcase}_auto.c" end |
Instance Attribute Details
- (Object) file_name (readonly)
Returns the value of attribute file_name
191 192 193 |
# File 'lib/autoc/code.rb', line 191 def file_name @file_name end |
- (Object) index (readonly)
Returns the value of attribute index
191 192 193 |
# File 'lib/autoc/code.rb', line 191 def index @index end |
Instance Method Details
- (Boolean) main?
199 200 201 |
# File 'lib/autoc/code.rb', line 199 def main? equal?(@module.main_source) end |
- (Object) new_stream
213 214 215 |
# File 'lib/autoc/code.rb', line 213 def new_stream ::File.new(@file_name, "w") end |
- (Object) size
207 208 209 210 211 |
# File 'lib/autoc/code.rb', line 207 def size size = 0 @entities.each {|e| size += e.source_size} size end |
- (Boolean) smallest?
203 204 205 |
# File 'lib/autoc/code.rb', line 203 def smallest? equal?(@module.smallest_source) end |
- (Object) write(stream)
217 218 219 220 221 222 223 224 225 |
# File 'lib/autoc/code.rb', line 217 def write(stream) stream << %$ /* AUTOMATICALLY GENERATED SOURCE FILE. DO NOT MODIFY. */ #include "#{@module.header.file_name}" $ sorted = AutoC.priority_sort(entities) sorted.each {|e| e.write_decls(stream)} sorted.each {|e| e.write_defs(stream)} end |