interp()函数用了大量的宏。IREF_NEXT只是其中一个宏,但是出现的频率很高。
但是透彻的理解这个宏将为理解interp()函数提供便利。
它的定义形式如下:
#define IREF_NEXT(ip)/ ((const ref_packed *)((const ref *)(ip) + 1))
这句看似简单的代码实际上不那么容易理解,而后面一些列的宏要么与此类似,要么间接的调用它。
而ref的定义是下面这个样子:
struct ref_s {
struct tas_s tas;
union v { /* name the union to keep gdb happy */
int intval;
ushort boolval;
float realval;
ulong saveid;
byte *bytes;
const byte *const_bytes;
ref *refs;
const ref *const_refs;
name *pname;
const name *const_pname;
dict *pdict;
const dict *const_pdict; /* * packed is the normal variant for referring to packed arrays, * but we need a writable variant for memory management and for * storing into packed dictionary key arrays. */
const ref_packed *packed;
ref_packed *writable_packed;
op_proc_t opproc;
struct stream_s *pfile;
struct gx_device_s *pdevice;
obj_header_t *pstruct;
} value;
};