Debian Codegraph @

typemap.local

raw
1 # definitions we don't want to make visible to the world
2 # because they're intended for use specifically by Imager.xs
3
4 # internal types used in Imager.xs
5 i_channel_list T_IM_CHANNEL_LIST
6 i_sample_list T_IM_SAMPLE_LIST
7 i_fsample_list T_IM_FSAMPLE_LIST
8 i_polygon_list T_IM_POLYGON_LIST
9 i_trim_color_list I_IM_TRIM_COLOR_LIST
10
11 off_t T_OFF_T
12
13 Imager::Internal::Hlines T_PTROBJ
14
15 Imager::Context T_PTROBJ
16
17 Imager::TrimColorList T_IM_TRIM_COLOR_LIST
18
19 i_palidx T_IV
20 double * T_AVARRAY
21 int * T_AVARRAY
22 i_img_dim * T_AVARRAY
23 i_color * T_AVARRAY
24
25 i_poly_fill_mode_t T_I_POLY_FILL_MODE_T
26
27 #############################################################################
28 INPUT
29
30 T_OFF_T
31 $var = i_sv_off_t(aTHX_ $arg);
32
33 T_IM_CHANNEL_LIST
34 SvGETMAGIC($arg);
35 if (SvOK($arg)) {
36 AV *channels_av;
37 int i;
38 if (!SvROK($arg) || SvTYPE(SvRV($arg)) != SVt_PVAV) {
39 croak(\"$var is not an array ref\");
40 }
41 channels_av = (AV *)SvRV($arg);
42 $var.count = av_len(channels_av) + 1;
43 if ($var.count < 1) {
44 croak(\"$pname: no channels provided\");
45 }
46 $var.channels = malloc_temp(aTHX_ sizeof(int) * $var.count);
47 for (i = 0; i < $var.count; ++i) {
48 SV **entry = av_fetch(channels_av, i, 0);
49 $var.channels[i] = entry ? SvIV(*entry) : 0;
50 }
51 }
52 else {
53 /* assumes we have an image */
54 $var.count = im->channels;
55 $var.channels = NULL;
56 }
57
58 T_IM_SAMPLE_LIST
59 SvGETMAGIC($arg);
60 if (!SvOK($arg))
61 croak(\"$var must be a scalar or an arrayref\");
62 if (SvROK($arg)) {
63 size_t i;
64 AV *av;
65 i_sample_t *s;
66 if (SvTYPE(SvRV($arg)) != SVt_PVAV)
67 croak(\"$var must be a scalar or an arrayref\");
68 av = (AV *)SvRV($arg);
69 $var.count = av_len(av) + 1;
70 if ($var.count < 1)
71 croak(\"$pname: no samples provided in $var\");
72 s = malloc_temp(aTHX_ sizeof(i_sample_t) * $var.count);
73 for (i = 0; i < $var.count; ++i) {
74 SV **entry = av_fetch(av, i, 0);
75 s[i] = entry ? SvIV(*entry) : 0;
76 }
77 $var.samples = s;
78 }
79 else {
80 /* non-magic would be preferable here */
81 $var.samples = (const i_sample_t *)SvPVbyte($arg, $var.count);
82 if ($var.count == 0)
83 croak(\"$pname: no samples provided in $var\");
84 }
85
86 T_IM_FSAMPLE_LIST
87 SvGETMAGIC($arg);
88 if (!SvOK($arg))
89 croak(\"$var must be a scalar or an arrayref\");
90 if (SvROK($arg)) {
91 size_t i;
92 AV *av;
93 i_fsample_t *s;
94 if (SvTYPE(SvRV($arg)) != SVt_PVAV)
95 croak(\"$var must be a scalar or an arrayref\");
96 av = (AV *)SvRV($arg);
97 $var.count = av_len(av) + 1;
98 if ($var.count < 1)
99 croak(\"$pname: no samples provided in $var\");
100 s = malloc_temp(aTHX_ sizeof(i_fsample_t) * $var.count);
101 for (i = 0; i < $var.count; ++i) {
102 SV **entry = av_fetch(av, i, 0);
103 s[i] = entry ? SvNV(*entry) : 0;
104 }
105 $var.samples = s;
106 }
107 else {
108 /* non-magic would be preferable here */
109 $var.samples = (const i_fsample_t *)SvPVbyte($arg, $var.count);
110 if ($var.count % sizeof(double))
111 croak(\"$pname: $var doesn't not contain a integer number of samples\");
112 $var.count /= sizeof(double);
113 if ($var.count == 0)
114 croak(\"$pname: no samples provided in $var\");
115 }
116
117 T_IM_POLYGON_LIST
118 S_get_polygon_list(aTHX_ &$var, $arg);
119
120 T_AVARRAY
121 STMT_START {
122 SV* const xsub_tmp_sv = $arg;
123 SvGETMAGIC(xsub_tmp_sv);
124 if (SvROK(xsub_tmp_sv) && SvTYPE(SvRV(xsub_tmp_sv)) == SVt_PVAV){
125 AV *xsub_tmp_av = (AV*)SvRV(xsub_tmp_sv);
126 STRLEN xsub_index;
127 size_$var = av_len(xsub_tmp_av) + 1;
128 $var = $ntype(size_$var);
129 for (xsub_index = 0; xsub_index < size_$var; ++xsub_index) {
130 SV **sv = av_fetch(xsub_tmp_av, xsub_index, 0);
131 if (sv) {
132 ${var}[xsub_index] = Sv${(my $ntt = $ntype) =~ s/Ptr$//; \(ucfirst $ntt)}(*sv, \"$pname\");
133 }
134 }
135 }
136 else{
137 Perl_croak(aTHX_ \"%s: %s is not an ARRAY reference\",
138 ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
139 \"$var\");
140 }
141 } STMT_END
142
143 T_I_POLY_FILL_MODE_T
144 $var = S_get_poly_fill_mode(aTHX_ $arg);
145
146 T_IM_TRIM_COLOR_LIST
147 if (!S_get_trim_color_list(aTHX_ $arg, &$var)) {
148 Perl_croak(aTHX_ \"%s: \" \"$var\" \" is not a valid Imager::TrimColorList\",
149 ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]});
150 }
151
152 #############################################################################
153 OUTPUT
154
155 T_OFF_T
156 $arg = i_new_sv_off_t(aTHX_ $var);
157
158 T_IM_TRIM_COLOR_LIST
159 $arg = $var.rsv;