node/lib/metasm/metasm/gui/dasm_main.rb
def rename(what=nil)
		if not what and localvar = pointed_localvar
			addr = curaddr
			str = localvar.str.dup
			inputbox("new name for #{localvar}", :text => localvar.to_s) { |v|
				if v =~ /^[a-z_][a-z0-9_]*$/i
					localvar.str.replace v
					session_append "pointed_localvar(dasm.decoded[#{addr.inspect}], #{str.inspect}).str.replace(#{v.inspect})"
					gui_update
				else messagebox("invalid local var name #{v.inspect}")
				end
			}
			return
		end

		what ||= pointed_addr
		if @dasm.prog_binding[what] or old = @dasm.get_label_at(what)
			old ||= what
			inputbox("new name for #{old}", :text => old) { |v|
				if v == ''
					@dasm.del_label_at(what)
					session_append "dasm.del_label_at(#{what.inspect})"
				else
					@dasm.rename_label(old, v)
					session_append "dasm.rename_label(#{old.inspect}, #{v.inspect})"
				end
				gui_update
			}
		else
			inputbox("label name for #{Expression[what]}", :text => Expression[what]) { |v|
				next if v == ''
				@dasm.set_label_at(what, v)
				@dasm.split_block(what)
				session_append "dasm.set_label_at(#{what.inspect}, #{v.inspect}) ; dasm.split_block(#{what.inspect})"
				gui_update
			}
		end
	end
# prompts for a new name for what is under the cursor (or the current address)
prompts for a new name for what is under the cursor (or the current address)
prompts for a new name for what is under the cursor ( or the current address )
def rename(what=nil)
		if not what and localvar = pointed_localvar
			addr = curaddr
			str = localvar.str.dup
			inputbox("new name for #{localvar}", :text => localvar.to_s) { |v|
				if v =~ /^[a-z_][a-z0-9_]*$/i
					localvar.str.replace v
					session_append "pointed_localvar(dasm.decoded[#{addr.inspect}], #{str.inspect}).str.replace(#{v.inspect})"
					gui_update
				else messagebox("invalid local var name #{v.inspect}")
				end
			}
			return
		end
		what ||= pointed_addr
		if @dasm.prog_binding[what] or old = @dasm.get_label_at(what)
			old ||= what
			inputbox("new name for #{old}", :text => old) { |v|
				if v == ''
					@dasm.del_label_at(what)
					session_append "dasm.del_label_at(#{what.inspect})"
				else
					@dasm.rename_label(old, v)
					session_append "dasm.rename_label(#{old.inspect}, #{v.inspect})"
				end
				gui_update
			}
		else
			inputbox("label name for #{Expression[what]}", :text => Expression[what]) { |v|
				next if v == ''
				@dasm.set_label_at(what, v)
				@dasm.split_block(what)
				session_append "dasm.set_label_at(#{what.inspect}, #{v.inspect}) ; dasm.split_block(#{what.inspect})"
				gui_update
			}
		end
	end
def rename ( what = nil ) if not what and localvar = pointed_localvar addr = curaddr str = localvar . str . dup inputbox ( "new name for #{localvar}" , :text => localvar . to_s ) { | v | if v =~ / ^[a-z_][a-z0-9_]*$ /i localvar . str . replace v session_append "pointed_localvar(dasm.decoded[#{addr.inspect}], #{str.inspect}).str.replace(#{v.inspect})" gui_update else messagebox ( "invalid local var name #{v.inspect}" ) end } return end what ||= pointed_addr if @dasm . prog_binding [ what ] or old = @dasm . get_label_at ( what ) old ||= what inputbox ( "new name for #{old}" , :text => old ) { | v | if v == '' @dasm . del_label_at ( what ) session_append "dasm.del_label_at(#{what.inspect})" else @dasm . rename_label ( old , v ) session_append "dasm.rename_label(#{old.inspect}, #{v.inspect})" end gui_update } else inputbox ( "label name for #{Expression[what]}" , :text => Expression [ what ] ) { | v | next if v == '' @dasm . set_label_at ( what , v ) @dasm . split_block ( what ) session_append "dasm.set_label_at(#{what.inspect}, #{v.inspect}) ; dasm.split_block(#{what.inspect})" gui_update } end end
prompts for a new name for what is under the cursor (or the current address)
prompts for a new name for what is under the cursor ( or the current address )
what