A couple really minor tweaks to metasm samples and code

git-svn-id: file:///home/svn/framework3/trunk@13217 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-07-19 05:50:17 +00:00
parent 13b3fe841e
commit ad53b4f115
3 changed files with 13 additions and 7 deletions

View File

@ -274,7 +274,7 @@ module C
when :ptr; " d#{%w[x b w x d x x x q][@parser.typesize[type.name]]} "
when :float; ' db ' + [value].pack(@parser.endianness == :little ? 'e' : 'g').unpack('C*').join(', ') + ' // '
when :double; ' db ' + [value].pack(@parser.endianness == :little ? 'E' : 'G').unpack('C*').join(', ') + ' // '
when :longdouble; ' db ' + [value].pack(@parser.endianness == :little ? 'E' : 'G').unpack('C*').join(', ') + ' // ' # XXX same as :double
when :longdouble; ' db ' + [value].pack(@parser.endianness == :little ? 'E' : 'G').unpack('C*').join(', ') + ' // ' # XXX same as :double
else raise "unknown idata type #{type.inspect} #{value.inspect}"
end
@ -663,7 +663,7 @@ module C
if not init.op and init.rexpr.kind_of? ::String
v = Variable.new
v.storage = :static
v.name = 'char_' + init.rexpr.tr('^a-zA-Z', '')[0, 8]
v.name = 'char_' + init.rexpr.gsub(/[^a-zA-Z]/, '')[0, 8]
v.type = Array.new(type.type)
v.type.length = init.rexpr.length + 1
v.type.type.qualifier = [:const]
@ -1434,3 +1434,4 @@ module C
end
end
end

View File

@ -1095,7 +1095,7 @@ class Preprocessor
nil while dir = readtok and dir.type == :space
raise cmd, 'qstring expected' if not dir or dir.type != :quoted
dir = ::File.expand_path dir.value
raise cmd, 'invalid path' if not ::File.directory? dir
raise cmd, "invalid path #{dir}" if not ::File.directory? dir
@include_search_path.unshift dir
when 'push_macro', 'pop_macro'

View File

@ -41,13 +41,18 @@ if opts[:vspath] ||= ARGV.shift
end
funcnames = opts[:exe].map { |e|
pe = PE.decode_file_header(e)
pe.decode_imports
if not pe.imports
pe = PE.decode_file_header(e) rescue nil
pe.decode_imports if pe
if pe and not pe.imports
puts "#{e} has no imports"
next
end
pe.imports.map { |id| id.imports.map { |i| i.name } }
if pe
pe.imports.map { |id| id.imports.map { |i| i.name } }
else
[]
end
}.flatten.compact.uniq.sort
ARGV.each { |n|