1 #define PERL_NO_GET_CONTEXT
10 typedef struct base91 {
15 Convert__Base91 new(pTHX_ SV* class) {
17 Newxc(self, 1, struct base91, struct base91);
18 basE91_init(&self->b91);
19 self->output = newSVpvs("");
23 void encode(pTHX_ Convert__Base91 self, SV* input) {
26 size_t len, max_out_len, ret;
28 i = SvPVbyte(input, len);
29 max_out_len = len + (len / 4) + 1; /* technically ceil(len * 16 / 13) */
30 Newx(o, max_out_len, char);
32 ret = basE91_encode(&self->b91, i, len, o);
33 sv_catpvn_nomg(self->output, o, ret);
37 SV* encode_end(pTHX_ Convert__Base91 self) {
41 ret = basE91_encode_end(&self->b91, o);
42 sv_catpvn_nomg(self->output, o, ret);
45 self->output = newSVpvs("");
49 void decode(pTHX_ Convert__Base91 self, SV* input) {
52 size_t len, max_out_len, ret;
54 i = SvPVbyte(input, len);
57 ret = basE91_decode(&self->b91, i, len, o);
58 sv_catpvn_nomg(self->output, o, ret);
62 SV* decode_end(pTHX_ Convert__Base91 self) {
66 ret = basE91_decode_end(&self->b91, &o);
67 sv_catpvn_nomg(self->output, &o, ret);
70 self->output = newSVpvs("");
74 void DESTROY(pTHX_ Convert__Base91 self) {
75 sv_2mortal(self->output);
79 MODULE = Convert::Base91 PACKAGE = Convert::Base91
82 Convert::Base91 new(SV* class)
85 void encode(Convert::Base91 self, SV* input)
86 C_ARGS: aTHX_ self, input
88 SV* encode_end(Convert::Base91 self)
91 void decode(Convert::Base91 self, SV* input)
92 C_ARGS: aTHX_ self, input
94 SV* decode_end(Convert::Base91 self)
97 void DESTROY(Convert::Base91 self)