package Data::QRCode::XS; use strict; use warnings; # ABSTRACT: qrcodes in C # VERSION use Data::QRCode::XS::Inline with => 'Alien::QREncode'; use Data::QRCode::XS::Inline C => ( 'DATA', autowrap => 1, typemaps => 'typemap', ); 1; __DATA__ __C__ int ECLEVEL_L() { return QR_ECLEVEL_L; } int ECLEVEL_M() { return QR_ECLEVEL_M; } int ECLEVEL_Q() { return QR_ECLEVEL_Q; } int ECLEVEL_H() { return QR_ECLEVEL_H; } #define CLASS "Data::QRCode" QRcode* _build(const char* class, SV* data, int level, int version ) { unsigned char * str; STRLEN len; str = SvPVutf8(data,len); return QRcode_encodeData(len,str,version,(QRecLevel)level); } int version(QRcode* self) { return self->version; } int width(QRcode* self) { return self->width; } void DESTROY(QRcode* self) { QRcode_free(self); } int _data_at(QRcode* self, int x, int y) { return self->data[x+y*self->width]; }