../draw_line_generated_code_preprocessed.c
# 4 "../draw_line_generated_code.c"
static inline void
packstr__initialize (SV* self, int* psize, char** pptr) {
SV* self_sv; HV* self_hv; SV** psv; SV* str_ref; SV* string;
int offset = 0;
if(!SvOK(self) || !SvROK(self)) goto error;
self_sv = SvRV(self);
if(SvTYPE(self_sv) != SVt_PVHV) goto error;
self_hv = self_sv;
psv = hv_fetch(self_hv, "ppm_data", strlen("ppm_data"), 0);
if(psv == NULL) goto error;
str_ref = *psv;
if(!SvROK(str_ref)) goto error;
string = SvRV(str_ref);
if(!SvPOK(string)) goto error;
psv = hv_fetch(self_hv, "offset", strlen("offset"), 0);
if(psv == NULL) goto error;
offset = SvIV(*psv);
*pptr = SvPV(string, (*psize));
*pptr += offset;
return;
error:
croak("?CONTEXT?: packed_substr's INIT(obj) had difficulty with the given object.");
}
# 45 "../draw_line_generated_code.c"
static inline void
folded__initialize (SV* self, HV** pselfhv) {
SV* self_sv;
if(!SvOK(self) || !SvROK(self)) goto error;
self_sv = SvRV(self);
if(SvTYPE(self_sv) != SVt_PVHV) goto error;
*pselfhv = self_sv;
return;
error:
croak("toy broken2");
}
# 144 "../draw_line_generated_code.c"
void draw_line (SV* self,
int x1, int y1, int x2, int y2,
int r, int g, int b)
{
HV* folded__selfhv; int folded__dims[3]; int packstr__size; char* packstr__ptr;;
folded__initialize((self),&folded__selfhv); { SV ** psv; IV iv; psv = hv_fetch(folded__selfhv,\
"height", strlen("height"), 0); if(psv == NULL) goto folded__error; folded__dims[0] = SvIV(*psv);\
psv = hv_fetch(folded__selfhv, "width", strlen("width"), 0); if(psv == NULL) goto folded__error;\
folded__dims[1] = SvIV(*psv); psv = hv_fetch(folded__selfhv, "depth", strlen("depth"), 0);\
if(psv == NULL) goto folded__error; folded__dims[2] = SvIV(*psv); goto folded__no_error; folded__error:\
croak("toy broken (folding shape)"); folded__no_error: ; } packstr__initialize((self),&packstr__size,&packstr__ptr);;
{ int d, x, y, ax, ay, sx, sy, dx, dy; dx = x2-x1; ax = (dx>=0?dx:-dx)<<1; sx = (dx>=0?1:-1);\
dy = y2-y1; ay = (dy>=0?dy:-dy)<<1; sy = (dy>=0?1:-1); x = x1; y = y1; if (ax>ay) { d = ay-(ax>>1);\
for (;;) { { (packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((0)))*1))]\
= ((((r)))),packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((1)))*1))]\
= ((((g)))),packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((2)))*1))]\
= ((((b))))); } if (x==x2) return; if (d>=0) { y += sy; d -= ax; } x += sx; d += ay; } } else\
{ d = ax-(ay>>1); for (;;) { { (packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((0)))*1))]\
= ((((r)))),packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((1)))*1))]\
= ((((g)))),packstr__ptr[((((((((x))))*(folded__dims[1]*folded__dims[2]))+(((((y))))*folded__dims[2])+((2)))*1))]\
= ((((b))))); } if (y==y2) return; if (d>=0) { x += sx; d -= ay; } y += sy; d += ax; } }};
}
Generated by GNU enscript 1.6.1.