From 3a0f096cb64f581f0d8513c8b67ca41659982afa Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 3 Jun 2010 05:37:21 -0400 Subject: Added new "addr" value expression function It returns the address of the given object as an integer. This can be used to uniquely compare entities. --- src/item.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/item.cc') diff --git a/src/item.cc b/src/item.cc index 0a22b260..fea73066 100644 --- a/src/item.cc +++ b/src/item.cc @@ -323,6 +323,10 @@ namespace { return item.pos ? long(item.pos->sequence) : 0L; } + value_t get_addr(item_t& item) { + return long(&item); + } + value_t get_depth(item_t&) { return 0L; } @@ -376,6 +380,8 @@ expr_t::ptr_op_t item_t::lookup(const symbol_t::kind_t kind, return WRAP_FUNCTOR(get_wrapper<&get_actual>); else if (name == "actual_date") return WRAP_FUNCTOR(get_wrapper<&get_actual_date>); + else if (name == "addr") + return WRAP_FUNCTOR(get_wrapper<&get_addr>); break; case 'b': -- cgit v1.2.3