(二)ghostscript源码分析之interp()函数之IREF_NEXT宏分析

本文深入探讨Ghostscript的interp()函数中频繁使用的IREF_NEXT宏,揭示其背后的逻辑。通过分析ref结构体和扫描token的过程,特别是以"{}"为例,解释了如何在scan_token()函数中识别并处理。进一步,详细解析ref_stack_store()函数,展示了为何宏IREF_NEXT的使用方式是正确的,并强调通过实际运行和调试来验证这一结论。
摘要由CSDN通过智能技术生成

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; 
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yshuise

权术横行

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值