test we don't use vars and that we have use 5.006.
[imager.git] / JPEG / JPEG.xs
CommitLineData
797a9f9c
TC
1#define PERL_NO_GET_CONTEXT
2#ifdef __cplusplus
3extern "C" {
4#endif
5#include "EXTERN.h"
6#include "perl.h"
7#include "XSUB.h"
8#include "imext.h"
9#include "imperl.h"
10#include "imjpeg.h"
11
12DEFINE_IMAGER_CALLBACKS;
13
14MODULE = Imager::File::JPEG PACKAGE = Imager::File::JPEG
15
d20ad5ba
TC
16const char *
17i_libjpeg_version()
18
797a9f9c
TC
19undef_int
20i_writejpeg_wiol(im, ig, qfactor)
21 Imager::ImgRaw im
22 Imager::IO ig
23 int qfactor
24
25
26void
27i_readjpeg_wiol(ig)
28 Imager::IO ig
29 PREINIT:
30 char* iptc_itext;
31 int tlength;
32 i_img* rimg;
33 SV* r;
34 PPCODE:
35 iptc_itext = NULL;
36 rimg = i_readjpeg_wiol(ig,-1,&iptc_itext,&tlength);
37 if (iptc_itext == NULL) {
38 r = sv_newmortal();
39 EXTEND(SP,1);
40 sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
41 PUSHs(r);
42 } else {
43 r = sv_newmortal();
44 EXTEND(SP,2);
45 sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
46 PUSHs(r);
47 PUSHs(sv_2mortal(newSVpv(iptc_itext,tlength)));
48 myfree(iptc_itext);
49 }
50
51BOOT:
52 PERL_INITIALIZE_IMAGER_CALLBACKS;