Module: RMasm
- Defined in:
- lib/rmasm/utility.rb,
lib/rmasm.rb,
lib/rmasm/align.rb,
lib/rmasm/binio.rb,
lib/rmasm/label.rb,
lib/rmasm/extern.rb,
lib/rmasm/report.rb,
lib/rmasm/struct.rb,
lib/rmasm/section.rb,
lib/rmasm/stacker.rb,
lib/rmasm/modifier.rb,
lib/rmasm/register.rb,
lib/rmasm/assembler.rb,
lib/rmasm/data_core.rb,
lib/rmasm/data_type.rb,
lib/rmasm/directive.rb,
lib/rmasm/primitive.rb,
lib/rmasm/expression.rb,
lib/rmasm/data_struct.rb,
lib/rmasm/instruction.rb,
lib/rmasm/data_primitive.rb,
lib/rmasm/symbol_manager.rb,
lib/rmasm/report_error_codes.rb
Overview
RMasm, a meta-macro assembler written in Ruby Copyright © 2009 Alexandre Mutel (alexandre_mutel at yahoo.fr)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Defined Under Namespace
Modules: DirectiveContainer, ExpressionOperations, IBinIOWriter, ObjectExtension, SymbolExtension Classes: Align, Assembler, BinIO, BinIOMode, BinaryDirective, BinaryExpression, Byte, Char, DWord, Data, DataDefault, DataItem, DataType, Directive, Double, ExpressionElement, Extern, Float, Float2, Float3, Float4, Instruction, Label, Modifier, Primitive, PrimitiveDataItem, QWord, Register, Registers, Report, Section, SectionManager, Stacker, Struct, StructDataItem, StructManager, SymbolManager, SymbolModifier, Utility, Word
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
Class Method Details
.include_rasm_file(owner, file) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/rmasm/assembler.rb', line 145 def self.include_rasm_file(owner, file) # include the file changing owner begin append = "" # Parse file and modify pure asm labels to __(:label) { old_line; \n}; File.open(file).each do |line| match = line.match(/^\s*([a-zA-Z_]\w+):[\s\r\n]+(.*)/) if match.nil? append += line else strip_end_of_line = match[2]; append += "__(:#{match[1]}) { #{strip_end_of_line}\n};" end end # Prepend "./" for relative files in order to have correct link to the file in an IDE filename = File.join(File.dirname(file), File.basename(file)) Assembler.file_includes << filename # owner.instance_eval(append, filename) if !owner.is_a?(Module) owner = owner.class end owner.class_eval(append, filename) Assembler.file_includes.pop rescue Exception => exp Report.error(exp) Assembler.file_includes.pop raise exp end nil end |