Class: AutoC::Module::Header
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Attributes inherited from File
Instance Method Summary collapse
-
#initialize(*args) ⇒ Header
constructor
A new instance of Header.
- #new_stream ⇒ Object
- #write(stream) ⇒ Object
Methods inherited from File
Constructor Details
#initialize(*args) ⇒ Header
Returns a new instance of Header.
170 171 172 173 174 |
# File 'lib/autoc/code.rb', line 170 def initialize(*args) super @file_name = "#{@module.name.downcase}_auto.h" @guard_macro = "#{@module.name.upcase}_AUTO_H" end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
168 169 170 |
# File 'lib/autoc/code.rb', line 168 def file_name @file_name end |
Instance Method Details
#new_stream ⇒ Object
176 177 178 |
# File 'lib/autoc/code.rb', line 176 def new_stream ::File.new(@file_name, "w") end |
#write(stream) ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/autoc/code.rb', line 180 def write(stream) stream << %$ /* AUTOMATICALLY GENERATED HEADER FILE. DO NOT MODIFY. */ #ifndef #{@guard_macro} #define #{@guard_macro} $ AutoC.priority_sort(entities).each {|e| e.write_intf(stream)} stream << %$ #endif $ stream << "\n" # DigitalMars C in strict ANSI (-A) mode complains about absent empty line at the very end so let's make it happy end |