node/lib/metasm/metasm/preprocessor.rb
def define(name, value=nil, from=caller.first)
		from =~ /^(.*?):(\d+)/
		btfile, btlineno = $1, $2.to_i
		if not @may_preprocess and @text =~ /#{Regexp.escape name}/
			@may_preprocess = true
		end
		t = Token.new([btfile, btlineno])
		t.type = :string
		t.raw = name.dup
		@definition[name] = Macro.new(t)
		if value.kind_of? ::String and eos?
			feed(value, btfile, btlineno)
			@definition[name].body << readtok until eos?
		elsif value	# XXX won't split multi-token defs..
			t = Token.new([btfile, btlineno])
			t.type = :string
			t.raw = value.to_s
			@definition[name].body << t
		end
	end
# defines a simple preprocessor macro (expands to 0 or 1 token)
# does not check overwriting
defines a simple preprocessor macro (expands to 0 or 1 token)
does not check overwriting
defines a simple preprocessor macro ( expands to 0 or 1 token ) does not check overwriting
def define(name, value=nil, from=caller.first)
		from =~ /^(.*?):(\d+)/
		btfile, btlineno = $1, $2.to_i
		if not @may_preprocess and @text =~ /#{Regexp.escape name}/
			@may_preprocess = true
		end
		t = Token.new([btfile, btlineno])
		t.type = :string
		t.raw = name.dup
		@definition[name] = Macro.new(t)
		if value.kind_of? ::String and eos?
			feed(value, btfile, btlineno)
			@definition[name].body << readtok until eos?
		elsif value	
			t = Token.new([btfile, btlineno])
			t.type = :string
			t.raw = value.to_s
			@definition[name].body << t
		end
	end
def define ( name , value = nil , from = caller . first ) from =~ / ^(.*?):( \d +) / btfile , btlineno = $1 , $2 . to_i if not @may_preprocess and @text =~ / #{ Regexp . escape name } / @may_preprocess = true end t = Token . new ( [ btfile , btlineno ] ) t . type = :string t . raw = name . dup @definition [ name ] = Macro . new ( t ) if value . kind_of? :: String and eos? feed ( value , btfile , btlineno ) @definition [ name ] . body << readtok until eos? elsif value t = Token . new ( [ btfile , btlineno ] ) t . type = :string t . raw = value . to_s @definition [ name ] . body << t end end
defines a simple preprocessor macro (expands to 0 or 1 token)
does not check overwriting
defines a simple preprocessor macro ( expands to 0 or 1 token ) does not check overwriting
# XXX won't split multi-token defs..
name
value
from
caller
first