| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
2
|
|
|
|
|
|
|
#include "perl.h" |
|
3
|
|
|
|
|
|
|
#include "XSUB.h" |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#include "radamsa/c/radamsa.h" |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
MODULE = Radamsa PACKAGE = Radamsa |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BOOT: |
|
10
|
1
|
|
|
|
|
|
radamsa_init(); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
SV * |
|
13
|
|
|
|
|
|
|
_mutate_raw(input, max_len, seed) |
|
14
|
|
|
|
|
|
|
SV *input |
|
15
|
|
|
|
|
|
|
size_t max_len |
|
16
|
|
|
|
|
|
|
unsigned int seed |
|
17
|
|
|
|
|
|
|
PREINIT: |
|
18
|
3
|
|
|
|
|
|
STRLEN input_len = 0; |
|
19
|
3
|
|
|
|
|
|
unsigned char *input_ptr = NULL; |
|
20
|
3
|
|
|
|
|
|
SV *output = NULL; |
|
21
|
3
|
|
|
|
|
|
unsigned char *output_ptr = NULL; |
|
22
|
3
|
|
|
|
|
|
size_t out_len = 0; |
|
23
|
|
|
|
|
|
|
CODE: |
|
24
|
3
|
50
|
|
|
|
|
if (!SvOK(input)) { |
|
25
|
0
|
|
|
|
|
|
croak("input must be defined"); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
|
input_ptr = (unsigned char *) SvPVbyte(input, input_len); |
|
29
|
3
|
|
|
|
|
|
output = newSV(max_len + 1); |
|
30
|
3
|
|
|
|
|
|
SvPOK_only(output); |
|
31
|
3
|
50
|
|
|
|
|
SvGROW(output, max_len + 1); |
|
|
|
50
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
|
output_ptr = (unsigned char *) SvPVX(output); |
|
33
|
3
|
|
|
|
|
|
out_len = radamsa(input_ptr, (size_t) input_len, output_ptr, max_len, seed); |
|
34
|
3
|
|
|
|
|
|
SvCUR_set(output, out_len); |
|
35
|
3
|
|
|
|
|
|
*SvEND(output) = '\0'; |
|
36
|
3
|
|
|
|
|
|
RETVAL = output; |
|
37
|
|
|
|
|
|
|
OUTPUT: |
|
38
|
|
|
|
|
|
|
RETVAL |