25 #ifndef INCLUDED_pd_pdf_private_h
26 #define INCLUDED_pd_pdf_private_h
28 #define PDDeallocateViaStackDealloc(ob) pd_stack_dealloc(ob)
30 #define currch (scv->allocBuf)[scv->offs]
31 #define currchi scv->left--; (scv->allocBuf)[(scv->offs)++]
32 #define currstr &currch
33 #define iterate(v) scv->offs += v; scv->left -= v
35 #define putfmt(fmt...) \
36 sz = sprintf(currstr, fmt); \
39 #define putstr(str, len) \
40 memcpy(currstr, str, len); \
43 #define PDStringGrow(req) \
44 if (scv->left < req) { \
45 scv->allocBuf = realloc(scv->allocBuf, scv->offs + req); \
49 #define PDStringFromObRef(ref, reflen) \
50 PDInteger obid = pd_stack_pop_int(s); \
51 PDInteger genid = pd_stack_pop_int(s); \
54 char req = 5 + reflen + 2; \
55 if (obid > 999) req += 3; \
56 if (genid > 99) req += 5; \
58 putfmt("%ld %ld " ref, obid, genid)
61 #define PDStringFromAnything() \
62 if ((*s)->type == PD_STACK_STRING) {\
63 char *str = pd_stack_pop_key(s);\
64 PDInteger len = strlen(str);\
67 PDDeallocateViaStackDealloc(str); \
69 pd_stack co = pd_stack_pop_stack(s); \
70 PDStringFromArbitrary(&co, scv);\