| 1 | /* |
| 2 | * |
| 3 | * Print plug-in driver utility functions for the GIMP. |
| 4 | * |
| 5 | * Copyright 1997-2000 Michael Sweet ([email protected]) and |
| 6 | * Robert Krawitz ([email protected]) |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 16 | * for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:409:9`! |
| 23 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 24 | #endif |
| 25 | #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/ |
| 26 | #include "gutenprint-internal.h"cxx . . $ `<file>/src/main/gutenprint-internal.h`/ |
| 27 | #include <gutenprint/gutenprint-intl-internal.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl-internal.h`/ |
| 28 | #include <math.h> |
| 29 | #ifdef sun |
| 30 | #include <ieeefp.h> |
| 31 | #endif |
| 32 | #include <string.h> |
| 33 | #include <stdlib.h> |
| 34 | #include <limits.h> |
| 35 | #include <unistd.h> |
| 36 | #include <sys/types.h> |
| 37 | #include <sys/stat.h> |
| 38 | #include <strings.h> |
| 39 | |
| 40 | #ifdef __GNUC__cxx . . $ `<built-in>:8:9`! |
| 41 | #define inlinecxx . . $ `src/main/curve.c:41:9`! __inline__ |
| 42 | #endif |
| 43 | |
| 44 | #undef inlinecxx . . $ `src/main/curve.c:41:9`! |
| 45 | #define inlinecxx . . $ `src/main/curve.c:45:9`! |
| 46 | |
| 47 | /* |
| 48 | * We could do more sanity checks here if we want. |
| 49 | */ |
| 50 | #define CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve) \ |
| 51 | do \ |
| 52 | { \ |
| 53 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!((curve) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); \ |
| 54 | STPI_ASSERTcxx . . $ `src/main/gutenprint-internal.h:58:9`!((curve)->seq != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); \ |
| 55 | } while (0) |
| 56 | |
| 57 | static const int curve_point_limitcxx . . $ curve_point_limit. = 1048576; |
| 58 | |
| 59 | struct stp_curvecxx . . $ stp_curve# |
| 60 | { |
| 61 | stp_curve_type_tcxx . . $ stp_curve_type_t# curve_typecxx . . $ stp_curve#curve_type.; |
| 62 | stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# wrap_modecxx . . $ stp_curve#wrap_mode.; |
| 63 | int piecewisecxx . . $ stp_curve#piecewise.; |
| 64 | int recompute_intervalcxx . . $ stp_curve#recompute_interval.; /* Do we need to recompute the deltas? */ |
| 65 | double gammacxx . . $ stp_curve#gamma.; /* 0.0 means that the curve is not a gamma */ |
| 66 | stp_sequence_tcxx . . $ stp_sequence_t# *seqcxx . . $ stp_curve#seq.; /* Sequence (contains the curve data) */ |
| 67 | double *intervalcxx . . $ stp_curve#interval.; /* We allocate an extra slot for the |
| 68 | wrap-around value. */ |
| 69 | |
| 70 | }; |
| 71 | |
| 72 | static const char *const stpi_curve_type_namescxx . . $ stpi_curve_type_names.[] = |
| 73 | { |
| 74 | "linear", |
| 75 | "spline", |
| 76 | }; |
| 77 | |
| 78 | static const int stpi_curve_type_countcxx . . $ stpi_curve_type_count. = |
| 79 | (sizeof(stpi_curve_type_namescxx . . $ stpi_curve_type_names.) / sizeof(const char *)); |
| 80 | |
| 81 | static const char *const stpi_wrap_mode_namescxx . . $ stpi_wrap_mode_names.[] = |
| 82 | { |
| 83 | "nowrap", |
| 84 | "wrap" |
| 85 | }; |
| 86 | |
| 87 | /* |
| 88 | * Get the total number of points in the base sequence class |
| 89 | */ |
| 90 | static size_t |
| 91 | get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 92 | { |
| 93 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 94 | return stp_sequence_get_sizecxx . . $ stp_sequence_get_size(57c44cb7f90fb5bc).(curve->seqcxx . . $ stp_curve#seq.) / 2; |
| 95 | else |
| 96 | return stp_sequence_get_sizecxx . . $ stp_sequence_get_size(57c44cb7f90fb5bc).(curve->seqcxx . . $ stp_curve#seq.); |
| 97 | } |
| 98 | |
| 99 | /* |
| 100 | * Get the number of points used by the curve (that are visible to the |
| 101 | * user). This is the real point count, but is decreased by 1 if the |
| 102 | * curve wraps around. |
| 103 | */ |
| 104 | static size_t |
| 105 | get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 106 | { |
| 107 | size_t count = get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(curve); |
| 108 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 109 | count -= 1; |
| 110 | |
| 111 | return count; |
| 112 | } |
| 113 | |
| 114 | static void |
| 115 | invalidate_auxiliary_datacxx . . $ invalidate_auxiliary_data(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 116 | { |
| 117 | STP_SAFE_FREEcxx . . $ `include/gutenprint/util.h:210:9`!(curve->interval); |
| 118 | } |
| 119 | |
| 120 | static void |
| 121 | clear_curve_datacxx . . $ clear_curve_data(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 122 | { |
| 123 | if (curve->seqcxx . . $ stp_curve#seq.) |
| 124 | stp_sequence_set_sizecxx . . $ stp_sequence_set_size(cb447bd5d582db64).(curve->seqcxx . . $ stp_curve#seq., 0); |
| 125 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 0; |
| 126 | invalidate_auxiliary_datacxx . . $ invalidate_auxiliary_data(357dc05c3c24eef1).(curve); |
| 127 | } |
| 128 | |
| 129 | static void |
| 130 | compute_linear_deltascxx . . $ compute_linear_deltas(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 131 | { |
| 132 | int i; |
| 133 | size_t delta_count; |
| 134 | size_t seq_point_count; |
| 135 | const double *data; |
| 136 | |
| 137 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., &seq_point_count, &data); |
| 138 | if (data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 139 | return; |
| 140 | |
| 141 | delta_count = get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(curve); |
| 142 | |
| 143 | if (delta_count <= 1) /* No intervals can be computed */ |
| 144 | return; |
| 145 | delta_count--; /* One less than the real point count. Note size_t |
| 146 | is unsigned. */ |
| 147 | |
| 148 | curve->intervalcxx . . $ stp_curve#interval. = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * delta_count); |
| 149 | for (i = 0; i < delta_count; i++) |
| 150 | { |
| 151 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 152 | curve->intervalcxx . . $ stp_curve#interval.[i] = data[(2 * (i + 1)) + 1] - data[(2 * i) + 1]; |
| 153 | else |
| 154 | curve->intervalcxx . . $ stp_curve#interval.[i] = data[i + 1] - data[i]; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | static void |
| 159 | compute_spline_deltas_piecewisecxx . . $ compute_spline_deltas_piecewise(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 160 | { |
| 161 | int i; |
| 162 | int k; |
| 163 | double *u; |
| 164 | double *y2; |
| 165 | const double *data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 166 | const stp_curve_point_tcxx . . $ stp_curve_point_t# *dp; |
| 167 | size_t point_count; |
| 168 | size_t real_point_count; |
| 169 | double sig; |
| 170 | double p; |
| 171 | |
| 172 | point_count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 173 | |
| 174 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., &real_point_count, &data); |
| 175 | dp = (const stp_curve_point_tcxx . . $ stp_curve_point_t# *)data; |
| 176 | real_point_count = real_point_count / 2; |
| 177 | |
| 178 | u = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * real_point_count); |
| 179 | y2 = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * real_point_count); |
| 180 | |
| 181 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 182 | { |
| 183 | int reps = 3; |
| 184 | int count = reps * real_point_count; |
| 185 | double *y2a = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * count); |
| 186 | double *ua = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * count); |
| 187 | y2a[0] = 0.0; |
| 188 | ua[0] = 0.0; |
| 189 | for (i = 1; i < count - 1; i++) |
| 190 | { |
| 191 | int im1 = (i - 1) % point_count; |
| 192 | int ia = i % point_count; |
| 193 | int ip1 = (i + 1) % point_count; |
| 194 | |
| 195 | sig = (dp[ia].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.); |
| 196 | p = sig * y2a[im1] + 2.0; |
| 197 | y2a[i] = (sig - 1.0) / p; |
| 198 | |
| 199 | ua[i] = ((dp[ip1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - dp[ia].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[ia].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)) - |
| 200 | ((dp[ia].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - dp[im1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.) / (dp[ia].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)); |
| 201 | ua[i] = |
| 202 | (((6.0 * ua[ia]) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)) - (sig * ua[im1])) / p; |
| 203 | } |
| 204 | y2a[count - 1] = 0.0; |
| 205 | for (k = count - 2 ; k >= 0; k--) |
| 206 | y2a[k] = y2a[k] * y2a[k + 1] + ua[k]; |
| 207 | memcpycxx . . $ memcpy(cc817cb175f282d).(u, ua + ((reps / 2) * point_count), |
| 208 | sizeof(double) * real_point_count); |
| 209 | memcpycxx . . $ memcpy(cc817cb175f282d).(y2, y2a + ((reps / 2) * point_count), |
| 210 | sizeof(double) * real_point_count); |
| 211 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(y2a); |
| 212 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(ua); |
| 213 | } |
| 214 | else |
| 215 | { |
| 216 | int count = real_point_count - 1; |
| 217 | |
| 218 | y2[0] = 0; |
| 219 | u[0] = 2 * (dp[1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - dp[0].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.); |
| 220 | for (i = 1; i < count; i++) |
| 221 | { |
| 222 | int im1 = (i - 1); |
| 223 | int ip1 = (i + 1); |
| 224 | |
| 225 | sig = (dp[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.); |
| 226 | p = sig * y2[im1] + 2.0; |
| 227 | y2[i] = (sig - 1.0) / p; |
| 228 | |
| 229 | u[i] = ((dp[ip1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - dp[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)) - |
| 230 | ((dp[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - dp[im1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.) / (dp[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)); |
| 231 | u[i] = |
| 232 | (((6.0 * u[i]) / (dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.)) - (sig * u[im1])) / p; |
| 233 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVEcxx . . $ `include/gutenprint/util.h:185:9`!, |
| 234 | "%d sig %f p %f y2 %f u %f x %f %f %f y %f %f %f\n", |
| 235 | i, sig, p, y2[i], u[i], |
| 236 | dp[im1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., dp[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., dp[ip1].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., |
| 237 | dp[im1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y., dp[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y., dp[ip1].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.); |
| 238 | } |
| 239 | y2[count] = 0.0; |
| 240 | u[count] = 0.0; |
| 241 | for (k = real_point_count - 2; k >= 0; k--) |
| 242 | y2[k] = y2[k] * y2[k + 1] + u[k]; |
| 243 | } |
| 244 | |
| 245 | curve->intervalcxx . . $ stp_curve#interval. = y2; |
| 246 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(u); |
| 247 | } |
| 248 | |
| 249 | static void |
| 250 | compute_spline_deltas_densecxx . . $ compute_spline_deltas_dense(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 251 | { |
| 252 | int i; |
| 253 | int k; |
| 254 | double *u; |
| 255 | double *y2; |
| 256 | const double *y; |
| 257 | size_t point_count; |
| 258 | size_t real_point_count; |
| 259 | double sig; |
| 260 | double p; |
| 261 | |
| 262 | point_count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 263 | |
| 264 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., &real_point_count, &y); |
| 265 | u = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * real_point_count); |
| 266 | y2 = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * real_point_count); |
| 267 | |
| 268 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 269 | { |
| 270 | int reps = 3; |
| 271 | int count = reps * real_point_count; |
| 272 | double *y2a = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * count); |
| 273 | double *ua = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * count); |
| 274 | y2a[0] = 0.0; |
| 275 | ua[0] = 0.0; |
| 276 | for (i = 1; i < count - 1; i++) |
| 277 | { |
| 278 | int im1 = (i - 1); |
| 279 | int ip1 = (i + 1); |
| 280 | int im1a = im1 % point_count; |
| 281 | int ia = i % point_count; |
| 282 | int ip1a = ip1 % point_count; |
| 283 | |
| 284 | sig = (i - im1) / (ip1 - im1); |
| 285 | p = sig * y2a[im1] + 2.0; |
| 286 | y2a[i] = (sig - 1.0) / p; |
| 287 | |
| 288 | ua[i] = y[ip1a] - 2 * y[ia] + y[im1a]; |
| 289 | ua[i] = 3.0 * ua[i] - sig * ua[im1] / p; |
| 290 | } |
| 291 | y2a[count - 1] = 0.0; |
| 292 | for (k = count - 2 ; k >= 0; k--) |
| 293 | y2a[k] = y2a[k] * y2a[k + 1] + ua[k]; |
| 294 | memcpycxx . . $ memcpy(cc817cb175f282d).(u, ua + ((reps / 2) * point_count), |
| 295 | sizeof(double) * real_point_count); |
| 296 | memcpycxx . . $ memcpy(cc817cb175f282d).(y2, y2a + ((reps / 2) * point_count), |
| 297 | sizeof(double) * real_point_count); |
| 298 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(y2a); |
| 299 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(ua); |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | int count = real_point_count - 1; |
| 304 | |
| 305 | y2[0] = 0; |
| 306 | u[0] = 2 * (y[1] - y[0]); |
| 307 | for (i = 1; i < count; i++) |
| 308 | { |
| 309 | int im1 = (i - 1); |
| 310 | int ip1 = (i + 1); |
| 311 | |
| 312 | sig = (i - im1) / (ip1 - im1); |
| 313 | p = sig * y2[im1] + 2.0; |
| 314 | y2[i] = (sig - 1.0) / p; |
| 315 | |
| 316 | u[i] = y[ip1] - 2 * y[i] + y[im1]; |
| 317 | u[i] = 3.0 * u[i] - sig * u[im1] / p; |
| 318 | } |
| 319 | |
| 320 | u[count] = 2 * (y[count] - y[count - 1]); |
| 321 | y2[count] = 0.0; |
| 322 | |
| 323 | u[count] = 0.0; |
| 324 | for (k = real_point_count - 2; k >= 0; k--) |
| 325 | y2[k] = y2[k] * y2[k + 1] + u[k]; |
| 326 | } |
| 327 | |
| 328 | curve->intervalcxx . . $ stp_curve#interval. = y2; |
| 329 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(u); |
| 330 | } |
| 331 | |
| 332 | static void |
| 333 | compute_spline_deltascxx . . $ compute_spline_deltas(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 334 | { |
| 335 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 336 | compute_spline_deltas_piecewisecxx . . $ compute_spline_deltas_piecewise(357dc05c3c24eef1).(curve); |
| 337 | else |
| 338 | compute_spline_deltas_densecxx . . $ compute_spline_deltas_dense(357dc05c3c24eef1).(curve); |
| 339 | } |
| 340 | |
| 341 | /* |
| 342 | * Recompute the delta values for interpolation. |
| 343 | * When we actually do support spline curves, this routine will |
| 344 | * compute the second derivatives for that purpose, too. |
| 345 | */ |
| 346 | static void |
| 347 | compute_intervalscxx . . $ compute_intervals(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 348 | { |
| 349 | if (curve->intervalcxx . . $ stp_curve#interval.) |
| 350 | { |
| 351 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(curve->intervalcxx . . $ stp_curve#interval.); |
| 352 | curve->intervalcxx . . $ stp_curve#interval. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 353 | } |
| 354 | if (stp_sequence_get_sizecxx . . $ stp_sequence_get_size(57c44cb7f90fb5bc).(curve->seqcxx . . $ stp_curve#seq.) > 0) |
| 355 | { |
| 356 | switch (curve->curve_typecxx . . $ stp_curve#curve_type.) |
| 357 | { |
| 358 | case STP_CURVE_TYPE_SPLINEcxx . . $ STP_CURVE_TYPE_SPLINE.: |
| 359 | compute_spline_deltascxx . . $ compute_spline_deltas(357dc05c3c24eef1).(curve); |
| 360 | break; |
| 361 | case STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.: |
| 362 | compute_linear_deltascxx . . $ compute_linear_deltas(357dc05c3c24eef1).(curve); |
| 363 | break; |
| 364 | } |
| 365 | } |
| 366 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 0; |
| 367 | } |
| 368 | |
| 369 | static int |
| 370 | stpi_curve_set_pointscxx . . $ stpi_curve_set_points(bc87752a72bd695e).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t points) |
| 371 | { |
| 372 | if (points < 2) |
| 373 | return 0; |
| 374 | if (points > curve_point_limitcxx . . $ curve_point_limit. || |
| 375 | (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND. && |
| 376 | points > curve_point_limitcxx . . $ curve_point_limit. - 1)) |
| 377 | return 0; |
| 378 | clear_curve_datacxx . . $ clear_curve_data(357dc05c3c24eef1).(curve); |
| 379 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 380 | points++; |
| 381 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 382 | points *= 2; |
| 383 | if ((stp_sequence_set_sizecxx . . $ stp_sequence_set_size(cb447bd5d582db64).(curve->seqcxx . . $ stp_curve#seq., points)) == 0) |
| 384 | return 0; |
| 385 | return 1; |
| 386 | } |
| 387 | |
| 388 | static int |
| 389 | stpi_curve_set_datacxx . . $ stpi_curve_set_data(b7b412adf12354dc).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t points, const double *data) |
| 390 | { |
| 391 | if (points < 2) |
| 392 | return 0; |
| 393 | if (points > curve_point_limitcxx . . $ curve_point_limit. || |
| 394 | (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND. && |
| 395 | points > curve_point_limitcxx . . $ curve_point_limit. - 1)) |
| 396 | return 0; |
| 397 | clear_curve_datacxx . . $ clear_curve_data(357dc05c3c24eef1).(curve); |
| 398 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 399 | points++; |
| 400 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 401 | points *= 2; |
| 402 | if ((stp_sequence_set_datacxx . . $ stp_sequence_set_data(eaf6acc80580ab39).(curve->seqcxx . . $ stp_curve#seq., points, data)) == 0) |
| 403 | return 0; |
| 404 | return 1; |
| 405 | } |
| 406 | |
| 407 | /* |
| 408 | * Create a default curve |
| 409 | */ |
| 410 | static void |
| 411 | stpi_curve_ctorcxx . . $ stpi_curve_ctor(5e5ca9013b5f7690).(stp_curve_tcxx . . $ stp_curve_t# *curve, stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# wrap_mode) |
| 412 | { |
| 413 | curve->seqcxx . . $ stp_curve#seq. = stp_sequence_createcxx . . $ stp_sequence_create(c0c0907aae0ab0a0).(); |
| 414 | stp_sequence_set_boundscxx . . $ stp_sequence_set_bounds(d74b306f919ecc73).(curve->seqcxx . . $ stp_curve#seq., 0.0, 1.0); |
| 415 | curve->curve_typecxx . . $ stp_curve#curve_type. = STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.; |
| 416 | curve->wrap_modecxx . . $ stp_curve#wrap_mode. = wrap_mode; |
| 417 | curve->piecewisecxx . . $ stp_curve#piecewise. = 0; |
| 418 | stpi_curve_set_pointscxx . . $ stpi_curve_set_points(bc87752a72bd695e).(curve, 2); |
| 419 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 420 | if (wrap_mode == STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.) |
| 421 | curve->gammacxx . . $ stp_curve#gamma. = 1.0; |
| 422 | stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., 0, 0); |
| 423 | stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., 1, 1); |
| 424 | } |
| 425 | |
| 426 | stp_curve_tcxx . . $ stp_curve_t# * |
| 427 | stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# wrap_mode) |
| 428 | { |
| 429 | stp_curve_tcxx . . $ stp_curve_t# *ret; |
| 430 | if (wrap_mode != STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE. && wrap_mode != STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 431 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 432 | ret = stp_zalloccxx . . $ stp_zalloc(bfcfa4d6b7f7ef64).(sizeof(stp_curve_tcxx . . $ stp_curve_t#)); |
| 433 | stpi_curve_ctorcxx . . $ stpi_curve_ctor(5e5ca9013b5f7690).(ret, wrap_mode); |
| 434 | return ret; |
| 435 | } |
| 436 | |
| 437 | static void |
| 438 | curve_dtorcxx . . $ curve_dtor(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 439 | { |
| 440 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 441 | clear_curve_datacxx . . $ clear_curve_data(357dc05c3c24eef1).(curve); |
| 442 | if (curve->seqcxx . . $ stp_curve#seq.) |
| 443 | stp_sequence_destroycxx . . $ stp_sequence_destroy(58667e1f04cce976).(curve->seqcxx . . $ stp_curve#seq.); |
| 444 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(curve, 0, sizeof(stp_curve_tcxx . . $ stp_curve_t#)); |
| 445 | curve->curve_typecxx . . $ stp_curve#curve_type. = -1; |
| 446 | } |
| 447 | |
| 448 | void |
| 449 | stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 450 | { |
| 451 | curve_dtorcxx . . $ curve_dtor(357dc05c3c24eef1).(curve); |
| 452 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(curve); |
| 453 | } |
| 454 | |
| 455 | void |
| 456 | stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(stp_curve_tcxx . . $ stp_curve_t# *dest, const stp_curve_tcxx . . $ stp_curve_t# *source) |
| 457 | { |
| 458 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(dest); |
| 459 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(source); |
| 460 | curve_dtorcxx . . $ curve_dtor(357dc05c3c24eef1).(dest); |
| 461 | dest->curve_typecxx . . $ stp_curve#curve_type. = source->curve_typecxx . . $ stp_curve#curve_type.; |
| 462 | dest->wrap_modecxx . . $ stp_curve#wrap_mode. = source->wrap_modecxx . . $ stp_curve#wrap_mode.; |
| 463 | dest->gammacxx . . $ stp_curve#gamma. = source->gammacxx . . $ stp_curve#gamma.; |
| 464 | dest->seqcxx . . $ stp_curve#seq. = stp_sequence_create_copycxx . . $ stp_sequence_create_copy(e5907136df4f5f97).(source->seqcxx . . $ stp_curve#seq.); |
| 465 | dest->piecewisecxx . . $ stp_curve#piecewise. = source->piecewisecxx . . $ stp_curve#piecewise.; |
| 466 | dest->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 467 | } |
| 468 | |
| 469 | stp_curve_tcxx . . $ stp_curve_t# * |
| 470 | stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 471 | { |
| 472 | stp_curve_tcxx . . $ stp_curve_t# *ret; |
| 473 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 474 | ret = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(curve->wrap_modecxx . . $ stp_curve#wrap_mode.); |
| 475 | stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(ret, curve); |
| 476 | return ret; |
| 477 | } |
| 478 | |
| 479 | void |
| 480 | stp_curve_reversecxx . . $ stp_curve_reverse(c5c12b2c5dad0880).(stp_curve_tcxx . . $ stp_curve_t# *dest, const stp_curve_tcxx . . $ stp_curve_t# *source) |
| 481 | { |
| 482 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(dest); |
| 483 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(source); |
| 484 | curve_dtorcxx . . $ curve_dtor(357dc05c3c24eef1).(dest); |
| 485 | dest->curve_typecxx . . $ stp_curve#curve_type. = source->curve_typecxx . . $ stp_curve#curve_type.; |
| 486 | dest->wrap_modecxx . . $ stp_curve#wrap_mode. = source->wrap_modecxx . . $ stp_curve#wrap_mode.; |
| 487 | dest->gammacxx . . $ stp_curve#gamma. = source->gammacxx . . $ stp_curve#gamma.; |
| 488 | if (source->piecewisecxx . . $ stp_curve#piecewise.) |
| 489 | { |
| 490 | const double *source_data; |
| 491 | size_t size; |
| 492 | double *new_data; |
| 493 | int i; |
| 494 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(source->seqcxx . . $ stp_curve#seq., &size, &source_data); |
| 495 | new_data = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * size); |
| 496 | for (i = 0; i < size; i += 2) |
| 497 | { |
| 498 | int j = size - i - 2; |
| 499 | new_data[i] = 1.0 - source_data[j]; |
| 500 | new_data[i + 1] = source_data[j + 1]; |
| 501 | } |
| 502 | dest->seqcxx . . $ stp_curve#seq. = stp_sequence_createcxx . . $ stp_sequence_create(c0c0907aae0ab0a0).(); |
| 503 | stp_sequence_set_datacxx . . $ stp_sequence_set_data(eaf6acc80580ab39).(dest->seqcxx . . $ stp_curve#seq., size, new_data); |
| 504 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_data); |
| 505 | } |
| 506 | else |
| 507 | dest->seqcxx . . $ stp_curve#seq. = stp_sequence_create_reversecxx . . $ stp_sequence_create_reverse(e5907136df4f5f97).(source->seqcxx . . $ stp_curve#seq.); |
| 508 | dest->piecewisecxx . . $ stp_curve#piecewise. = source->piecewisecxx . . $ stp_curve#piecewise.; |
| 509 | dest->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 510 | } |
| 511 | |
| 512 | stp_curve_tcxx . . $ stp_curve_t# * |
| 513 | stp_curve_create_reversecxx . . $ stp_curve_create_reverse(df54bc0b812d6ee).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 514 | { |
| 515 | stp_curve_tcxx . . $ stp_curve_t# *ret; |
| 516 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 517 | ret = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(curve->wrap_modecxx . . $ stp_curve#wrap_mode.); |
| 518 | stp_curve_reversecxx . . $ stp_curve_reverse(c5c12b2c5dad0880).(ret, curve); |
| 519 | return ret; |
| 520 | } |
| 521 | |
| 522 | int |
| 523 | stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(stp_curve_tcxx . . $ stp_curve_t# *curve, double low, double high) |
| 524 | { |
| 525 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 526 | return stp_sequence_set_boundscxx . . $ stp_sequence_set_bounds(d74b306f919ecc73).(curve->seqcxx . . $ stp_curve#seq., low, high); |
| 527 | } |
| 528 | |
| 529 | void |
| 530 | stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(const stp_curve_tcxx . . $ stp_curve_t# *curve, double *low, double *high) |
| 531 | { |
| 532 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 533 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., low, high); |
| 534 | } |
| 535 | |
| 536 | /* |
| 537 | * Find the minimum and maximum points on the curve. This does not |
| 538 | * attempt to find the minimum and maximum interpolations; with cubic |
| 539 | * splines these could exceed the boundaries. That's OK; the interpolation |
| 540 | * code will clip them to the bounds. |
| 541 | */ |
| 542 | void |
| 543 | stp_curve_get_rangecxx . . $ stp_curve_get_range(de70be28309e8730).(const stp_curve_tcxx . . $ stp_curve_t# *curve, double *low, double *high) |
| 544 | { |
| 545 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 546 | stp_sequence_get_rangecxx . . $ stp_sequence_get_range(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., low, high); |
| 547 | } |
| 548 | |
| 549 | size_t |
| 550 | stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 551 | { |
| 552 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 553 | return get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 554 | } |
| 555 | |
| 556 | stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# |
| 557 | stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 558 | { |
| 559 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 560 | return curve->wrap_modecxx . . $ stp_curve#wrap_mode.; |
| 561 | } |
| 562 | |
| 563 | int |
| 564 | stp_curve_is_piecewisecxx . . $ stp_curve_is_piecewise(bc3348f13b0b16e6).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 565 | { |
| 566 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 567 | return curve->piecewisecxx . . $ stp_curve#piecewise.; |
| 568 | } |
| 569 | |
| 570 | int |
| 571 | stp_curve_set_interpolation_typecxx . . $ stp_curve_set_interpolation_type(43c66d7f6033514f).(stp_curve_tcxx . . $ stp_curve_t# *curve, stp_curve_type_tcxx . . $ stp_curve_type_t# itype) |
| 572 | { |
| 573 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 574 | if (itype >= stpi_curve_type_countcxx . . $ stpi_curve_type_count.) |
| 575 | return 0; |
| 576 | curve->curve_typecxx . . $ stp_curve#curve_type. = itype; |
| 577 | return 1; |
| 578 | } |
| 579 | |
| 580 | stp_curve_type_tcxx . . $ stp_curve_type_t# |
| 581 | stp_curve_get_interpolation_typecxx . . $ stp_curve_get_interpolation_type(1655c6932e427974).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 582 | { |
| 583 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 584 | return curve->curve_typecxx . . $ stp_curve#curve_type.; |
| 585 | } |
| 586 | |
| 587 | int |
| 588 | stp_curve_set_gammacxx . . $ stp_curve_set_gamma(4b664532c6114e82).(stp_curve_tcxx . . $ stp_curve_t# *curve, double fgamma) |
| 589 | { |
| 590 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 591 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. || ! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(fgamma) || fgamma == 0.0) |
| 592 | return 0; |
| 593 | clear_curve_datacxx . . $ clear_curve_data(357dc05c3c24eef1).(curve); |
| 594 | curve->gammacxx . . $ stp_curve#gamma. = fgamma; |
| 595 | stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(curve, 2); |
| 596 | return 1; |
| 597 | } |
| 598 | |
| 599 | double |
| 600 | stp_curve_get_gammacxx . . $ stp_curve_get_gamma(ba82a70c8cfd641c).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 601 | { |
| 602 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 603 | return curve->gammacxx . . $ stp_curve#gamma.; |
| 604 | } |
| 605 | |
| 606 | int |
| 607 | stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t count, const double *data) |
| 608 | { |
| 609 | size_t i; |
| 610 | size_t real_count = count; |
| 611 | double low, high; |
| 612 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 613 | if (count < 2) |
| 614 | return 0; |
| 615 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 616 | real_count++; |
| 617 | if (real_count > curve_point_limitcxx . . $ curve_point_limit.) |
| 618 | return 0; |
| 619 | |
| 620 | /* Validate the data before we commit to it. */ |
| 621 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &low, &high); |
| 622 | for (i = 0; i < count; i++) |
| 623 | if (! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(data[i]) || data[i] < low || data[i] > high) |
| 624 | { |
| 625 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 626 | "stp_curve_set_data: datum out of bounds: " |
| 627 | "%g (require %g <= x <= %g), n = %ld\n", |
| 628 | data[i], low, high, (long)i); |
| 629 | return 0; |
| 630 | } |
| 631 | /* Allocate sequence; also accounts for WRAP_MODE */ |
| 632 | stpi_curve_set_pointscxx . . $ stpi_curve_set_points(bc87752a72bd695e).(curve, count); |
| 633 | curve->gammacxx . . $ stp_curve#gamma. = 0.0; |
| 634 | stp_sequence_set_subrangecxx . . $ stp_sequence_set_subrange(3a82d5ae3a6d1032).(curve->seqcxx . . $ stp_curve#seq., 0, count, data); |
| 635 | |
| 636 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 637 | stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., count, data[0]); |
| 638 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 639 | curve->piecewisecxx . . $ stp_curve#piecewise. = 0; |
| 640 | |
| 641 | return 1; |
| 642 | } |
| 643 | |
| 644 | int |
| 645 | stp_curve_set_data_pointscxx . . $ stp_curve_set_data_points(114518be73fd3070).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t count, |
| 646 | const stp_curve_point_tcxx . . $ stp_curve_point_t# *data) |
| 647 | { |
| 648 | size_t i; |
| 649 | size_t real_count = count; |
| 650 | double low, high; |
| 651 | double last_x = -1; |
| 652 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 653 | if (count < 2) |
| 654 | { |
| 655 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 656 | "stp_curve_set_data_points: too few points %ld\n", (long)count); |
| 657 | return 0; |
| 658 | } |
| 659 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 660 | real_count++; |
| 661 | if (real_count > curve_point_limitcxx . . $ curve_point_limit.) |
| 662 | { |
| 663 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 664 | "stp_curve_set_data_points: too many points %ld\n", |
| 665 | (long)real_count); |
| 666 | return 0; |
| 667 | } |
| 668 | |
| 669 | /* Validate the data before we commit to it. */ |
| 670 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &low, &high); |
| 671 | for (i = 0; i < count; i++) |
| 672 | { |
| 673 | if (! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(data[i].y) || data[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. < low || data[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. > high) |
| 674 | { |
| 675 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 676 | "stp_curve_set_data_points: datum out of bounds: " |
| 677 | "%g (require %g <= x <= %g), n = %ld\n", |
| 678 | data[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y., low, high, (long)i); |
| 679 | return 0; |
| 680 | } |
| 681 | if (i == 0 && data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. != 0.0) |
| 682 | { |
| 683 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 684 | "stp_curve_set_data_points: first point must have x=0\n"); |
| 685 | return 0; |
| 686 | } |
| 687 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE. && i == count - 1 && |
| 688 | data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. != 1.0) |
| 689 | { |
| 690 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 691 | "stp_curve_set_data_points: last point must have x=1\n"); |
| 692 | return 0; |
| 693 | } |
| 694 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND. && |
| 695 | data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. >= 1.0 - .000001) |
| 696 | { |
| 697 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 698 | "stp_curve_set_data_points: horizontal value must " |
| 699 | "not exceed .99999\n"); |
| 700 | return 0; |
| 701 | } |
| 702 | if (data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. < 0 || data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. > 1) |
| 703 | { |
| 704 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 705 | "stp_curve_set_data_points: horizontal position out of bounds: " |
| 706 | "%g, n = %ld\n", |
| 707 | data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., (long)i); |
| 708 | return 0; |
| 709 | } |
| 710 | if (data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. - .000001 < last_x) |
| 711 | { |
| 712 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 713 | "stp_curve_set_data_points: horizontal position must " |
| 714 | "exceed previous position by .000001: %g, %g, n = %ld\n", |
| 715 | data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., last_x, (long)i); |
| 716 | return 0; |
| 717 | } |
| 718 | last_x = data[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.; |
| 719 | } |
| 720 | /* Allocate sequence; also accounts for WRAP_MODE */ |
| 721 | curve->piecewisecxx . . $ stp_curve#piecewise. = 1; |
| 722 | stpi_curve_set_pointscxx . . $ stpi_curve_set_points(bc87752a72bd695e).(curve, count); |
| 723 | curve->gammacxx . . $ stp_curve#gamma. = 0.0; |
| 724 | stp_sequence_set_subrangecxx . . $ stp_sequence_set_subrange(3a82d5ae3a6d1032).(curve->seqcxx . . $ stp_curve#seq., 0, count * 2, (const double *) data); |
| 725 | |
| 726 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 727 | { |
| 728 | stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., count * 2, data[0].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.); |
| 729 | stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., count * 2 + 1, data[0].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.); |
| 730 | } |
| 731 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 732 | |
| 733 | return 1; |
| 734 | } |
| 735 | |
| 736 | |
| 737 | /* |
| 738 | * Note that we return a pointer to the raw data here. |
| 739 | * A lot of operations change the data vector, that's why we don't |
| 740 | * guarantee it across non-const calls. |
| 741 | */ |
| 742 | const double * |
| 743 | stp_curve_get_datacxx . . $ stp_curve_get_data(2a13b0d70f8dce87).(const stp_curve_tcxx . . $ stp_curve_t# *curve, size_t *count) |
| 744 | { |
| 745 | const double *ret; |
| 746 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 747 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 748 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 749 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., count, &ret); |
| 750 | *count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 751 | return ret; |
| 752 | } |
| 753 | |
| 754 | const stp_curve_point_tcxx . . $ stp_curve_point_t# * |
| 755 | stp_curve_get_data_pointscxx . . $ stp_curve_get_data_points(58883ef28f2b1600).(const stp_curve_tcxx . . $ stp_curve_t# *curve, size_t *count) |
| 756 | { |
| 757 | const double *ret; |
| 758 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 759 | if (!curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 760 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 761 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., count, &ret); |
| 762 | *count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 763 | return (const stp_curve_point_tcxx . . $ stp_curve_point_t# *) ret; |
| 764 | } |
| 765 | |
| 766 | static const double * |
| 767 | stpi_curve_get_data_internalcxx . . $ stpi_curve_get_data_internal(2a13b0d70f8dce87).(const stp_curve_tcxx . . $ stp_curve_t# *curve, size_t *count) |
| 768 | { |
| 769 | const double *ret; |
| 770 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 771 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., count, &ret); |
| 772 | *count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 773 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 774 | *count *= 2; |
| 775 | return ret; |
| 776 | } |
| 777 | |
| 778 | |
| 779 | /* "Overloaded" functions */ |
| 780 | |
| 781 | #define DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(t, name) \ |
| 782 | int \ |
| 783 | stp_curve_set_##name##_data(stp_curve_t *curve, size_t count, const t *data) \ |
| 784 | { \ |
| 785 | double *tmp_data; \ |
| 786 | size_t i; \ |
| 787 | int status; \ |
| 788 | size_t real_count = count; \ |
| 789 | \ |
| 790 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); \ |
| 791 | if (count < 2) \ |
| 792 | return 0; \ |
| 793 | if (curve->wrap_mode == STP_CURVE_WRAP_AROUND) \ |
| 794 | real_count++; \ |
| 795 | if (real_count > curve_point_limit) \ |
| 796 | return 0; \ |
| 797 | tmp_data = stp_malloc(count * sizeof(double)); \ |
| 798 | for (i = 0; i < count; i++) \ |
| 799 | tmp_data[i] = (double) data[i]; \ |
| 800 | status = stp_curve_set_data(curve, count, tmp_data); \ |
| 801 | stp_free(tmp_data); \ |
| 802 | return status; \ |
| 803 | } |
| 804 | |
| 805 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(float, float) |
| 806 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(long, long) |
| 807 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(unsigned long, ulong) |
| 808 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(int, int) |
| 809 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(unsigned int, uint) |
| 810 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(short, short) |
| 811 | DEFINE_DATA_SETTERcxx . . $ `src/main/curve.c:781:9`!(unsigned short, ushort) |
| 812 | |
| 813 | |
| 814 | #define DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(t, name) \ |
| 815 | const t * \ |
| 816 | stp_curve_get_##name##_data(const stp_curve_t *curve, size_t *count) \ |
| 817 | { \ |
| 818 | if (curve->piecewise) \ |
| 819 | return 0; \ |
| 820 | return stp_sequence_get_##name##_data(curve->seq, count); \ |
| 821 | } |
| 822 | |
| 823 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(float, float) |
| 824 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(long, long) |
| 825 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(unsigned long, ulong) |
| 826 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(int, int) |
| 827 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(unsigned int, uint) |
| 828 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(short, short) |
| 829 | DEFINE_DATA_ACCESSORcxx . . $ `src/main/curve.c:814:9`!(unsigned short, ushort) |
| 830 | |
| 831 | |
| 832 | stp_curve_tcxx . . $ stp_curve_t# * |
| 833 | stp_curve_get_subrangecxx . . $ stp_curve_get_subrange(7ec6a22539f3472c).(const stp_curve_tcxx . . $ stp_curve_t# *curve, size_t start, size_t count) |
| 834 | { |
| 835 | stp_curve_tcxx . . $ stp_curve_t# *retval; |
| 836 | size_t ncount; |
| 837 | double blo, bhi; |
| 838 | const double *data; |
| 839 | if (start + count > stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(curve) || count < 2) |
| 840 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 841 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 842 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 843 | retval = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.); |
| 844 | stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve, &blo, &bhi); |
| 845 | stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(retval, blo, bhi); |
| 846 | data = stp_curve_get_datacxx . . $ stp_curve_get_data(2a13b0d70f8dce87).(curve, &ncount); |
| 847 | if (! stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(retval, count, data + start)) |
| 848 | { |
| 849 | stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(retval); |
| 850 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 851 | } |
| 852 | return retval; |
| 853 | } |
| 854 | |
| 855 | int |
| 856 | stp_curve_set_subrangecxx . . $ stp_curve_set_subrange(e3bf18be9622e1b).(stp_curve_tcxx . . $ stp_curve_t# *curve, const stp_curve_tcxx . . $ stp_curve_t# *range, |
| 857 | size_t start) |
| 858 | { |
| 859 | double blo, bhi; |
| 860 | double rlo, rhi; |
| 861 | const double *data; |
| 862 | size_t count; |
| 863 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 864 | if (start + stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(range) > stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(curve)) |
| 865 | return 0; |
| 866 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 867 | return 0; |
| 868 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 869 | stp_sequence_get_rangecxx . . $ stp_sequence_get_range(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &rlo, &rhi); |
| 870 | if (rlo < blo || rhi > bhi) |
| 871 | return 0; |
| 872 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(range->seqcxx . . $ stp_curve#seq., &count, &data); |
| 873 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 874 | curve->gammacxx . . $ stp_curve#gamma. = 0.0; |
| 875 | invalidate_auxiliary_datacxx . . $ invalidate_auxiliary_data(357dc05c3c24eef1).(curve); |
| 876 | stp_sequence_set_subrangecxx . . $ stp_sequence_set_subrange(3a82d5ae3a6d1032).(curve->seqcxx . . $ stp_curve#seq., start, stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(range), |
| 877 | data); |
| 878 | return 1; |
| 879 | } |
| 880 | |
| 881 | |
| 882 | int |
| 883 | stp_curve_set_pointcxx . . $ stp_curve_set_point(fb48804ae78197a).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t where, double data) |
| 884 | { |
| 885 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 886 | if (where >= get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve)) |
| 887 | return 0; |
| 888 | curve->gammacxx . . $ stp_curve#gamma. = 0.0; |
| 889 | |
| 890 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 891 | return 0; |
| 892 | if ((stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., where, data)) == 0) |
| 893 | return 0; |
| 894 | if (where == 0 && curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 895 | if ((stp_sequence_set_pointcxx . . $ stp_sequence_set_point(e632f4aa9a6329ba).(curve->seqcxx . . $ stp_curve#seq., |
| 896 | get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve), data)) == 0) |
| 897 | return 0; |
| 898 | invalidate_auxiliary_datacxx . . $ invalidate_auxiliary_data(357dc05c3c24eef1).(curve); |
| 899 | return 1; |
| 900 | } |
| 901 | |
| 902 | int |
| 903 | stp_curve_get_pointcxx . . $ stp_curve_get_point(d120f9942fdc532e).(const stp_curve_tcxx . . $ stp_curve_t# *curve, size_t where, double *data) |
| 904 | { |
| 905 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 906 | if (where >= get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve)) |
| 907 | return 0; |
| 908 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 909 | return 0; |
| 910 | return stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., where, data); |
| 911 | } |
| 912 | |
| 913 | const stp_sequence_tcxx . . $ stp_sequence_t# * |
| 914 | stp_curve_get_sequencecxx . . $ stp_curve_get_sequence(d2444037991bd646).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 915 | { |
| 916 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 917 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 918 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 919 | return curve->seqcxx . . $ stp_curve#seq.; |
| 920 | } |
| 921 | |
| 922 | int |
| 923 | stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(stp_curve_tcxx . . $ stp_curve_t# *curve, double scale, |
| 924 | stp_curve_compose_tcxx . . $ stp_curve_compose_t# mode, stp_curve_bounds_tcxx . . $ stp_curve_bounds_t# bounds_mode) |
| 925 | { |
| 926 | int i; |
| 927 | double nblo; |
| 928 | double nbhi; |
| 929 | size_t count; |
| 930 | |
| 931 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 932 | |
| 933 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &nblo, &nbhi); |
| 934 | if (bounds_mode == STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.) |
| 935 | { |
| 936 | switch (mode) |
| 937 | { |
| 938 | case STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.: |
| 939 | nblo += scale; |
| 940 | nbhi += scale; |
| 941 | break; |
| 942 | case STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY.: |
| 943 | if (scale < 0) |
| 944 | { |
| 945 | double tmp = nblo * scale; |
| 946 | nblo = nbhi * scale; |
| 947 | nbhi = tmp; |
| 948 | } |
| 949 | else |
| 950 | { |
| 951 | nblo *= scale; |
| 952 | nbhi *= scale; |
| 953 | } |
| 954 | break; |
| 955 | case STP_CURVE_COMPOSE_EXPONENTIATEcxx . . $ STP_CURVE_COMPOSE_EXPONENTIATE.: |
| 956 | if (scale == 0.0) |
| 957 | return 0; |
| 958 | if (nblo < 0) |
| 959 | return 0; |
| 960 | nblo = pow(nblo, scale); |
| 961 | nbhi = pow(nbhi, scale); |
| 962 | break; |
| 963 | default: |
| 964 | return 0; |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | if (! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(nbhi) || ! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(nblo)) |
| 969 | return 0; |
| 970 | |
| 971 | count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 972 | if (count) |
| 973 | { |
| 974 | double *tmp; |
| 975 | size_t scount; |
| 976 | int stride = 1; |
| 977 | int offset = 0; |
| 978 | const double *data; |
| 979 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 980 | { |
| 981 | stride = 2; |
| 982 | offset = 1; |
| 983 | } |
| 984 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., &scount, &data); |
| 985 | tmp = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * scount); |
| 986 | memcpycxx . . $ memcpy(cc817cb175f282d).(tmp, data, scount * sizeof(double)); |
| 987 | for (i = offset; i < scount; i += stride) |
| 988 | { |
| 989 | switch (mode) |
| 990 | { |
| 991 | case STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.: |
| 992 | tmp[i] = tmp[i] + scale; |
| 993 | break; |
| 994 | case STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY.: |
| 995 | tmp[i] = tmp[i] * scale; |
| 996 | break; |
| 997 | case STP_CURVE_COMPOSE_EXPONENTIATEcxx . . $ STP_CURVE_COMPOSE_EXPONENTIATE.: |
| 998 | tmp[i] = pow(tmp[i], scale); |
| 999 | break; |
| 1000 | } |
| 1001 | if (tmp[i] > nbhi || tmp[i] < nblo) |
| 1002 | { |
| 1003 | if (bounds_mode == STP_CURVE_BOUNDS_ERRORcxx . . $ STP_CURVE_BOUNDS_ERROR.) |
| 1004 | { |
| 1005 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp); |
| 1006 | return(0); |
| 1007 | } |
| 1008 | else if (tmp[i] > nbhi) |
| 1009 | tmp[i] = nbhi; |
| 1010 | else |
| 1011 | tmp[i] = nblo; |
| 1012 | } |
| 1013 | } |
| 1014 | stp_sequence_set_boundscxx . . $ stp_sequence_set_bounds(d74b306f919ecc73).(curve->seqcxx . . $ stp_curve#seq., nblo, nbhi); |
| 1015 | curve->gammacxx . . $ stp_curve#gamma. = 0.0; |
| 1016 | stpi_curve_set_pointscxx . . $ stpi_curve_set_points(bc87752a72bd695e).(curve, count); |
| 1017 | stp_sequence_set_subrangecxx . . $ stp_sequence_set_subrange(3a82d5ae3a6d1032).(curve->seqcxx . . $ stp_curve#seq., 0, scount, tmp); |
| 1018 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp); |
| 1019 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 1020 | invalidate_auxiliary_datacxx . . $ invalidate_auxiliary_data(357dc05c3c24eef1).(curve); |
| 1021 | } |
| 1022 | return 1; |
| 1023 | } |
| 1024 | |
| 1025 | static int |
| 1026 | stpi_curve_check_parameterscxx . . $ stpi_curve_check_parameters(bc87752a72bd695e).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t points) |
| 1027 | { |
| 1028 | double blo, bhi; |
| 1029 | (void)points; |
| 1030 | |
| 1031 | if (curve->gammacxx . . $ stp_curve#gamma. && curve->wrap_modecxx . . $ stp_curve#wrap_mode.) |
| 1032 | { |
| 1033 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1034 | "curve sets both gamma and wrap_mode\n"); |
| 1035 | return 0; |
| 1036 | } |
| 1037 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1038 | if (blo > bhi) |
| 1039 | { |
| 1040 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1041 | "curve low bound is greater than high bound\n"); |
| 1042 | return 0; |
| 1043 | } |
| 1044 | return 1; |
| 1045 | } |
| 1046 | |
| 1047 | static inlinecxx . . $ `src/main/curve.c:45:9`! double |
| 1048 | interpolate_gamma_internalcxx . . $ interpolate_gamma_internal(6c27895a344987b2).(const stp_curve_tcxx . . $ stp_curve_t# *curve, double where) |
| 1049 | { |
| 1050 | double fgamma = curve->gammacxx . . $ stp_curve#gamma.; |
| 1051 | double blo, bhi; |
| 1052 | size_t real_point_count; |
| 1053 | |
| 1054 | real_point_count = get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(curve); |
| 1055 | |
| 1056 | if (real_point_count) |
| 1057 | where /= (real_point_count - 1); |
| 1058 | if (fgamma < 0) |
| 1059 | { |
| 1060 | where = 1.0 - where; |
| 1061 | fgamma = -fgamma; |
| 1062 | } |
| 1063 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1064 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVEcxx . . $ `include/gutenprint/util.h:185:9`!, |
| 1065 | "interpolate_gamma %f %f %f %f %f\n", where, fgamma, |
| 1066 | blo, bhi, pow(where, fgamma)); |
| 1067 | return blo + (bhi - blo) * pow(where, fgamma); |
| 1068 | } |
| 1069 | |
| 1070 | static inlinecxx . . $ `src/main/curve.c:45:9`! double |
| 1071 | do_interpolate_splinecxx . . $ do_interpolate_spline(7ba2c0e50130b3d8).(double low, double high, double frac, |
| 1072 | double interval_low, double interval_high, |
| 1073 | double x_interval) |
| 1074 | { |
| 1075 | double a = 1.0 - frac; |
| 1076 | double b = frac; |
| 1077 | double retval = |
| 1078 | ((a * a * a - a) * interval_low) + ((b * b * b - b) * interval_high); |
| 1079 | retval = retval * x_interval * x_interval / 6; |
| 1080 | retval += (a * low) + (b * high); |
| 1081 | return retval; |
| 1082 | } |
| 1083 | |
| 1084 | static inlinecxx . . $ `src/main/curve.c:45:9`! double |
| 1085 | interpolate_point_internalcxx . . $ interpolate_point_internal(6c27895a344987b2).(const stp_curve_tcxx . . $ stp_curve_t# *curve, double where) |
| 1086 | { |
| 1087 | int integer = where; |
| 1088 | double frac = where - (double) integer; |
| 1089 | double bhi, blo; |
| 1090 | |
| 1091 | if (frac == 0.0) |
| 1092 | { |
| 1093 | double val; |
| 1094 | if ((stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., integer, &val)) == 0) |
| 1095 | return HUGE_VALcxx . . $ `<external>/11263917310783833665/math.h:48:10`!; /* Infinity */ |
| 1096 | return val; |
| 1097 | } |
| 1098 | if (curve->recompute_intervalcxx . . $ stp_curve#recompute_interval.) |
| 1099 | compute_intervalscxx . . $ compute_intervals(357dc05c3c24eef1).((stpi_cast_safecxx . . $ stpi_cast_safe(3343d82129b43479).(curve))); |
| 1100 | if (curve->curve_typecxx . . $ stp_curve#curve_type. == STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.) |
| 1101 | { |
| 1102 | double val; |
| 1103 | if ((stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., integer, &val)) == 0) |
| 1104 | return HUGE_VALcxx . . $ `<external>/11263917310783833665/math.h:48:10`!; /* Infinity */ |
| 1105 | return val + frac * curve->intervalcxx . . $ stp_curve#interval.[integer]; |
| 1106 | } |
| 1107 | else |
| 1108 | { |
| 1109 | size_t point_count; |
| 1110 | double ival, ip1val; |
| 1111 | double retval; |
| 1112 | int i = integer; |
| 1113 | int ip1 = integer + 1; |
| 1114 | |
| 1115 | point_count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 1116 | |
| 1117 | if (ip1 >= point_count) |
| 1118 | ip1 -= point_count; |
| 1119 | |
| 1120 | if ((stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., i, &ival)) == 0 || |
| 1121 | (stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., ip1, &ip1val)) == 0) |
| 1122 | return HUGE_VALcxx . . $ `<external>/11263917310783833665/math.h:48:10`!; /* Infinity */ |
| 1123 | |
| 1124 | retval = do_interpolate_splinecxx . . $ do_interpolate_spline(7ba2c0e50130b3d8).(ival, ip1val, frac, curve->intervalcxx . . $ stp_curve#interval.[i], |
| 1125 | curve->intervalcxx . . $ stp_curve#interval.[ip1], 1.0); |
| 1126 | |
| 1127 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1128 | if (retval > bhi) |
| 1129 | retval = bhi; |
| 1130 | if (retval < blo) |
| 1131 | retval = blo; |
| 1132 | return retval; |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | int |
| 1137 | stp_curve_interpolate_valuecxx . . $ stp_curve_interpolate_value(93e71508de7e4c35).(const stp_curve_tcxx . . $ stp_curve_t# *curve, double where, |
| 1138 | double *result) |
| 1139 | { |
| 1140 | size_t limit; |
| 1141 | |
| 1142 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 1143 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 1144 | return 0; |
| 1145 | |
| 1146 | limit = get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(curve); |
| 1147 | |
| 1148 | if (where < 0 || where > limit) |
| 1149 | return 0; |
| 1150 | if (curve->gammacxx . . $ stp_curve#gamma.) /* this means a pure gamma curve */ |
| 1151 | *result = interpolate_gamma_internalcxx . . $ interpolate_gamma_internal(6c27895a344987b2).(curve, where); |
| 1152 | else |
| 1153 | *result = interpolate_point_internalcxx . . $ interpolate_point_internal(6c27895a344987b2).(curve, where); |
| 1154 | return 1; |
| 1155 | } |
| 1156 | |
| 1157 | int |
| 1158 | stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(stp_curve_tcxx . . $ stp_curve_t# *curve, size_t points) |
| 1159 | { |
| 1160 | size_t limit = points; |
| 1161 | size_t old; |
| 1162 | size_t i; |
| 1163 | double *new_vec; |
| 1164 | |
| 1165 | CHECK_CURVEcxx . . $ `src/main/curve.c:50:9`!(curve); |
| 1166 | |
| 1167 | if (points == get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve) && curve->seqcxx . . $ stp_curve#seq. && !(curve->piecewisecxx . . $ stp_curve#piecewise.)) |
| 1168 | return 1; |
| 1169 | |
| 1170 | if (points < 2) |
| 1171 | return 1; |
| 1172 | |
| 1173 | if (curve->wrap_modecxx . . $ stp_curve#wrap_mode. == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 1174 | limit++; |
| 1175 | if (limit > curve_point_limitcxx . . $ curve_point_limit.) |
| 1176 | return 0; |
| 1177 | old = get_real_point_countcxx . . $ get_real_point_count(7c52d22dafe22fab).(curve); |
| 1178 | if (old) |
| 1179 | old--; |
| 1180 | if (!old) |
| 1181 | old = 1; |
| 1182 | |
| 1183 | new_vec = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * limit); |
| 1184 | |
| 1185 | /* |
| 1186 | * Be very careful how we calculate the location along the scale! |
| 1187 | * If we're not careful how we do it, we might get a small roundoff |
| 1188 | * error |
| 1189 | */ |
| 1190 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 1191 | { |
| 1192 | double blo, bhi; |
| 1193 | int curpos = 0; |
| 1194 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1195 | if (curve->recompute_intervalcxx . . $ stp_curve#recompute_interval.) |
| 1196 | compute_intervalscxx . . $ compute_intervals(357dc05c3c24eef1).(curve); |
| 1197 | for (i = 0; i < old; i++) |
| 1198 | { |
| 1199 | double low; |
| 1200 | double high; |
| 1201 | double low_y; |
| 1202 | double high_y; |
| 1203 | double x_delta; |
| 1204 | if (!stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., i * 2, &low)) |
| 1205 | { |
| 1206 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_vec); |
| 1207 | return 0; |
| 1208 | } |
| 1209 | if (i == old - 1) |
| 1210 | high = 1.0; |
| 1211 | else if (!stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., ((i + 1) * 2), &high)) |
| 1212 | { |
| 1213 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_vec); |
| 1214 | return 0; |
| 1215 | } |
| 1216 | if (!stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., (i * 2) + 1, &low_y)) |
| 1217 | { |
| 1218 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_vec); |
| 1219 | return 0; |
| 1220 | } |
| 1221 | if (!stp_sequence_get_pointcxx . . $ stp_sequence_get_point(dd05bfc28554384c).(curve->seqcxx . . $ stp_curve#seq., ((i + 1) * 2) + 1, &high_y)) |
| 1222 | { |
| 1223 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_vec); |
| 1224 | return 0; |
| 1225 | } |
| 1226 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVEcxx . . $ `include/gutenprint/util.h:185:9`!, |
| 1227 | "Filling slots at %ld %d: %f %f %f %f %ld\n", |
| 1228 | (long)i,curpos, high, low, high_y, low_y, (long)limit); |
| 1229 | x_delta = high - low; |
| 1230 | high *= (limit - 1); |
| 1231 | low *= (limit - 1); |
| 1232 | while (curpos <= high) |
| 1233 | { |
| 1234 | double frac = (curpos - low) / (high - low); |
| 1235 | if (curve->curve_typecxx . . $ stp_curve#curve_type. == STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.) |
| 1236 | new_vec[curpos] = low_y + frac * (high_y - low_y); |
| 1237 | else |
| 1238 | new_vec[curpos] = |
| 1239 | do_interpolate_splinecxx . . $ do_interpolate_spline(7ba2c0e50130b3d8).(low_y, high_y, frac, |
| 1240 | curve->intervalcxx . . $ stp_curve#interval.[i], |
| 1241 | curve->intervalcxx . . $ stp_curve#interval.[i + 1], |
| 1242 | x_delta); |
| 1243 | if (new_vec[curpos] < blo) |
| 1244 | new_vec[curpos] = blo; |
| 1245 | if (new_vec[curpos] > bhi) |
| 1246 | new_vec[curpos] = bhi; |
| 1247 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVEcxx . . $ `include/gutenprint/util.h:185:9`!, |
| 1248 | " Filling slot %d %f %f\n", |
| 1249 | curpos, frac, new_vec[curpos]); |
| 1250 | curpos++; |
| 1251 | } |
| 1252 | } |
| 1253 | curve->piecewisecxx . . $ stp_curve#piecewise. = 0; |
| 1254 | } |
| 1255 | else if (curve->gammacxx . . $ stp_curve#gamma.) |
| 1256 | { |
| 1257 | double fgamma = curve->gammacxx . . $ stp_curve#gamma.; |
| 1258 | double blo, bhi; |
| 1259 | int negative_gamma = 0; |
| 1260 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1261 | if (fgamma > 0) |
| 1262 | { |
| 1263 | fgamma = -fgamma; |
| 1264 | negative_gamma = 1; |
| 1265 | } |
| 1266 | for (i = 0; i < limit; i++) |
| 1267 | { |
| 1268 | double where = ((double) i * (double) old / (double) (limit - 1)); |
| 1269 | if (negative_gamma) |
| 1270 | where = 1.0 - where; |
| 1271 | new_vec[i] = blo + ((bhi - blo) * pow(where, fgamma)); |
| 1272 | } |
| 1273 | } |
| 1274 | else |
| 1275 | { |
| 1276 | double blo, bhi; |
| 1277 | const double *seq_data; |
| 1278 | size_t seq_count; |
| 1279 | size_t point_count = get_point_countcxx . . $ get_point_count(7c52d22dafe22fab).(curve); |
| 1280 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(curve->seqcxx . . $ stp_curve#seq., &seq_count, &seq_data); |
| 1281 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(curve->seqcxx . . $ stp_curve#seq., &blo, &bhi); |
| 1282 | if (curve->recompute_intervalcxx . . $ stp_curve#recompute_interval.) |
| 1283 | compute_intervalscxx . . $ compute_intervals(357dc05c3c24eef1).((stpi_cast_safecxx . . $ stpi_cast_safe(3343d82129b43479).(curve))); |
| 1284 | for (i = 0; i < limit; i++) |
| 1285 | { |
| 1286 | double where = ((double) i * (double) old / (double) (limit - 1)); |
| 1287 | int iwhere = (int) where; |
| 1288 | double frac = where - (double) iwhere; |
| 1289 | if (frac == 0.0) |
| 1290 | new_vec[i] = seq_data[iwhere]; |
| 1291 | else if (curve->curve_typecxx . . $ stp_curve#curve_type. == STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.) |
| 1292 | new_vec[i] = seq_data[iwhere] + (frac * curve->intervalcxx . . $ stp_curve#interval.[iwhere]); |
| 1293 | else |
| 1294 | { |
| 1295 | int iwhere1 = iwhere + 1; |
| 1296 | while (iwhere1 > point_count) |
| 1297 | iwhere1 -= point_count; |
| 1298 | new_vec[i] = |
| 1299 | do_interpolate_splinecxx . . $ do_interpolate_spline(7ba2c0e50130b3d8).(seq_data[iwhere], seq_data[iwhere1], |
| 1300 | frac, curve->intervalcxx . . $ stp_curve#interval.[iwhere], |
| 1301 | curve->intervalcxx . . $ stp_curve#interval.[iwhere1], 1.0); |
| 1302 | if (new_vec[i] > bhi) |
| 1303 | new_vec[i] = bhi; |
| 1304 | else if (new_vec[i] < blo) |
| 1305 | new_vec[i] = blo; |
| 1306 | } |
| 1307 | } |
| 1308 | } |
| 1309 | stpi_curve_set_datacxx . . $ stpi_curve_set_data(b7b412adf12354dc).(curve, points, new_vec); |
| 1310 | curve->recompute_intervalcxx . . $ stp_curve#recompute_interval. = 1; |
| 1311 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(new_vec); |
| 1312 | return 1; |
| 1313 | } |
| 1314 | |
| 1315 | static unsigned |
| 1316 | gcdcxx . . $ gcd(83f10ac8959d5577).(unsigned a, unsigned b) |
| 1317 | { |
| 1318 | unsigned tmp; |
| 1319 | if (b > a) |
| 1320 | { |
| 1321 | tmp = a; |
| 1322 | a = b; |
| 1323 | b = tmp; |
| 1324 | } |
| 1325 | while (1) |
| 1326 | { |
| 1327 | tmp = a % b; |
| 1328 | if (tmp == 0) |
| 1329 | return b; |
| 1330 | a = b; |
| 1331 | b = tmp; |
| 1332 | } |
| 1333 | } |
| 1334 | |
| 1335 | static unsigned |
| 1336 | lcmcxx . . $ lcm(83f10ac8959d5577).(unsigned a, unsigned b) |
| 1337 | { |
| 1338 | if (a == b) |
| 1339 | return a; |
| 1340 | else if (a * b == 0) |
| 1341 | return a > b ? a : b; |
| 1342 | else |
| 1343 | { |
| 1344 | double rval = (double) a / gcdcxx . . $ gcd(83f10ac8959d5577).(a, b) * b; |
| 1345 | if (rval > curve_point_limitcxx . . $ curve_point_limit.) |
| 1346 | return curve_point_limitcxx . . $ curve_point_limit.; |
| 1347 | else |
| 1348 | return rval; |
| 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | static int |
| 1353 | create_gamma_curvecxx . . $ create_gamma_curve(830cfcfe0a57bc98).(stp_curve_tcxx . . $ stp_curve_t# **retval, double lo, double hi, double fgamma, |
| 1354 | int points) |
| 1355 | { |
| 1356 | *retval = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.); |
| 1357 | if (stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(*retval, lo, hi) && |
| 1358 | stp_curve_set_gammacxx . . $ stp_curve_set_gamma(4b664532c6114e82).(*retval, fgamma) && |
| 1359 | stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(*retval, points)) |
| 1360 | return 1; |
| 1361 | stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(*retval); |
| 1362 | *retval = 0; |
| 1363 | return 0; |
| 1364 | } |
| 1365 | |
| 1366 | static int |
| 1367 | interpolate_pointscxx . . $ interpolate_points(a8932111fe0e63a0).(stp_curve_tcxx . . $ stp_curve_t# *a, stp_curve_tcxx . . $ stp_curve_t# *b, |
| 1368 | stp_curve_compose_tcxx . . $ stp_curve_compose_t# mode, |
| 1369 | int points, double *tmp_data) |
| 1370 | { |
| 1371 | double pa, pb; |
| 1372 | int i; |
| 1373 | size_t points_a = stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(a); |
| 1374 | size_t points_b = stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(b); |
| 1375 | for (i = 0; i < points; i++) |
| 1376 | { |
| 1377 | if (!stp_curve_interpolate_valuecxx . . $ stp_curve_interpolate_value(93e71508de7e4c35). |
| 1378 | (a, (double) i * (points_a - 1) / (points - 1), &pa)) |
| 1379 | { |
| 1380 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1381 | "interpolate_points: interpolate curve a value failed\n"); |
| 1382 | return 0; |
| 1383 | } |
| 1384 | if (!stp_curve_interpolate_valuecxx . . $ stp_curve_interpolate_value(93e71508de7e4c35). |
| 1385 | (b, (double) i * (points_b - 1) / (points - 1), &pb)) |
| 1386 | { |
| 1387 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1388 | "interpolate_points: interpolate curve b value failed\n"); |
| 1389 | return 0; |
| 1390 | } |
| 1391 | if (mode == STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.) |
| 1392 | pa += pb; |
| 1393 | else |
| 1394 | pa *= pb; |
| 1395 | if (! isfinitecxx . . $ `<external>/11263917310783833665/math.h:963:11`!(pa)) |
| 1396 | { |
| 1397 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1398 | "interpolate_points: interpolated point %lu is invalid\n", |
| 1399 | (unsigned long) i); |
| 1400 | return 0; |
| 1401 | } |
| 1402 | tmp_data[i] = pa; |
| 1403 | } |
| 1404 | return 1; |
| 1405 | } |
| 1406 | |
| 1407 | int |
| 1408 | stp_curve_composecxx . . $ stp_curve_compose(116ca8de2bc26c87).(stp_curve_tcxx . . $ stp_curve_t# **retval, |
| 1409 | stp_curve_tcxx . . $ stp_curve_t# *a, stp_curve_tcxx . . $ stp_curve_t# *b, |
| 1410 | stp_curve_compose_tcxx . . $ stp_curve_compose_t# mode, int points) |
| 1411 | { |
| 1412 | stp_curve_tcxx . . $ stp_curve_t# *ret; |
| 1413 | double *tmp_data; |
| 1414 | double gamma_a = stp_curve_get_gammacxx . . $ stp_curve_get_gamma(ba82a70c8cfd641c).(a); |
| 1415 | double gamma_b = stp_curve_get_gammacxx . . $ stp_curve_get_gamma(ba82a70c8cfd641c).(b); |
| 1416 | unsigned points_a = stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(a); |
| 1417 | unsigned points_b = stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(b); |
| 1418 | double alo, ahi, blo, bhi; |
| 1419 | |
| 1420 | if (a->piecewisecxx . . $ stp_curve#piecewise. && b->piecewisecxx . . $ stp_curve#piecewise.) |
| 1421 | return 0; |
| 1422 | if (a->piecewisecxx . . $ stp_curve#piecewise.) |
| 1423 | { |
| 1424 | stp_curve_tcxx . . $ stp_curve_t# *a_save = a; |
| 1425 | a = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(a_save); |
| 1426 | stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(a, stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(b)); |
| 1427 | } |
| 1428 | if (b->piecewisecxx . . $ stp_curve#piecewise.) |
| 1429 | { |
| 1430 | stp_curve_tcxx . . $ stp_curve_t# *b_save = b; |
| 1431 | b = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(b_save); |
| 1432 | stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(b, stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(a)); |
| 1433 | } |
| 1434 | |
| 1435 | if (mode != STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD. && mode != STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY.) |
| 1436 | return 0; |
| 1437 | if (stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(a) != stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(b)) |
| 1438 | return 0; |
| 1439 | stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(a, &alo, &ahi); |
| 1440 | stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(b, &blo, &bhi); |
| 1441 | if (mode == STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY. && (alo < 0 || blo < 0)) |
| 1442 | return 0; |
| 1443 | |
| 1444 | if (stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(a) == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 1445 | { |
| 1446 | points_a++; |
| 1447 | points_b++; |
| 1448 | } |
| 1449 | if (points == -1) |
| 1450 | { |
| 1451 | points = lcmcxx . . $ lcm(83f10ac8959d5577).(points_a, points_b); |
| 1452 | if (stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(a) == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) |
| 1453 | points--; |
| 1454 | } |
| 1455 | if (points < 2 || points > curve_point_limitcxx . . $ curve_point_limit. || |
| 1456 | ((stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(a) == STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.) && |
| 1457 | points > curve_point_limitcxx . . $ curve_point_limit. - 1)) |
| 1458 | return 0; |
| 1459 | |
| 1460 | if (gamma_a && gamma_b && gamma_a * gamma_b > 0 && |
| 1461 | mode == STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY.) |
| 1462 | return create_gamma_curvecxx . . $ create_gamma_curve(830cfcfe0a57bc98).(retval, alo * blo, ahi * bhi, gamma_a + gamma_b, |
| 1463 | points); |
| 1464 | tmp_data = stp_malloccxx . . $ stp_malloc(bfcfa4d6b7f7ef64).(sizeof(double) * points); |
| 1465 | if (!interpolate_pointscxx . . $ interpolate_points(a8932111fe0e63a0).(a, b, mode, points, tmp_data)) |
| 1466 | { |
| 1467 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp_data); |
| 1468 | return 0; |
| 1469 | } |
| 1470 | ret = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(a)); |
| 1471 | if (mode == STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.) |
| 1472 | { |
| 1473 | stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(ret, (ahi - alo) + (bhi - blo), |
| 1474 | STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY., STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.); |
| 1475 | stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(ret, alo + blo, |
| 1476 | STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD., STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.); |
| 1477 | } |
| 1478 | else |
| 1479 | { |
| 1480 | stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(ret, (ahi - alo) * (bhi - blo), |
| 1481 | STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY., STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.); |
| 1482 | stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(ret, alo * blo, |
| 1483 | STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD., STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.); |
| 1484 | } |
| 1485 | if (! stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(ret, points, tmp_data)) |
| 1486 | goto bad1; |
| 1487 | *retval = ret; |
| 1488 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp_data); |
| 1489 | return 1; |
| 1490 | bad1: |
| 1491 | stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(ret); |
| 1492 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp_data); |
| 1493 | return 0; |
| 1494 | } |
| 1495 | |
| 1496 | |
| 1497 | stp_curve_tcxx . . $ stp_curve_t# * |
| 1498 | stp_curve_create_from_xmltreecxx . . $ stp_curve_create_from_xmltree(43c00d17ff70fe89).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *curve) /* The curve node */ |
| 1499 | { |
| 1500 | const char *stmp; /* Temporary string */ |
| 1501 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child; /* Child sequence node */ |
| 1502 | stp_curve_tcxx . . $ stp_curve_t# *ret = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; /* Curve to return */ |
| 1503 | stp_curve_type_tcxx . . $ stp_curve_type_t# curve_type; /* Type of curve */ |
| 1504 | stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# wrap_mode; /* Curve wrap mode */ |
| 1505 | double fgamma; /* Gamma value */ |
| 1506 | stp_sequence_tcxx . . $ stp_sequence_t# *seq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; /* Sequence data */ |
| 1507 | double low, high; /* Sequence bounds */ |
| 1508 | int piecewise = 0; |
| 1509 | |
| 1510 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1511 | /* FIXME Need protection against unlimited recursion */ |
| 1512 | if ((stmp = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(curve, "src")) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1513 | return stp_curve_create_from_filecxx . . $ stp_curve_create_from_file(fc1a54117bc5f637).(stmp); |
| 1514 | /* Get curve type */ |
| 1515 | stmp = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(curve, "type"); |
| 1516 | if (stmp) |
| 1517 | { |
| 1518 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stmp, "linear")) |
| 1519 | curve_type = STP_CURVE_TYPE_LINEARcxx . . $ STP_CURVE_TYPE_LINEAR.; |
| 1520 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stmp, "spline")) |
| 1521 | curve_type = STP_CURVE_TYPE_SPLINEcxx . . $ STP_CURVE_TYPE_SPLINE.; |
| 1522 | else |
| 1523 | { |
| 1524 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1525 | "stp_curve_create_from_xmltree: %s: \"type\" invalid\n", stmp); |
| 1526 | goto error; |
| 1527 | } |
| 1528 | } |
| 1529 | else |
| 1530 | { |
| 1531 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1532 | "stp_curve_create_from_xmltree: \"type\" missing\n"); |
| 1533 | goto error; |
| 1534 | } |
| 1535 | /* Get curve wrap mode */ |
| 1536 | stmp = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(curve, "wrap"); |
| 1537 | if (stmp) |
| 1538 | { |
| 1539 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stmp, "nowrap")) |
| 1540 | wrap_mode = STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.; |
| 1541 | else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stmp, "wrap")) |
| 1542 | { |
| 1543 | wrap_mode = STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.; |
| 1544 | } |
| 1545 | else |
| 1546 | { |
| 1547 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1548 | "stp_curve_create_from_xmltree: %s: \"wrap\" invalid\n", stmp); |
| 1549 | goto error; |
| 1550 | } |
| 1551 | } |
| 1552 | else |
| 1553 | { |
| 1554 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1555 | "stp_curve_create_from_xmltree: \"wrap\" missing\n"); |
| 1556 | goto error; |
| 1557 | } |
| 1558 | /* Get curve gamma */ |
| 1559 | stmp = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(curve, "gamma"); |
| 1560 | if (stmp) |
| 1561 | { |
| 1562 | fgamma = stp_xmlstrtodcxx . . $ stp_xmlstrtod(9a18bdb0e56c1bc2).(stmp); |
| 1563 | } |
| 1564 | else |
| 1565 | { |
| 1566 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1567 | "stp_curve_create_from_xmltree: \"gamma\" missing\n"); |
| 1568 | goto error; |
| 1569 | } |
| 1570 | /* If gamma is set, wrap_mode must be STP_CURVE_WRAP_NONE */ |
| 1571 | if (fgamma && wrap_mode != STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.) |
| 1572 | { |
| 1573 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, "stp_curve_create_from_xmltree: " |
| 1574 | "gamma set and \"wrap\" is not STP_CURVE_WRAP_NONE\n"); |
| 1575 | goto error; |
| 1576 | } |
| 1577 | stmp = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(curve, "piecewise"); |
| 1578 | if (stmp && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(stmp, "true") == 0) |
| 1579 | piecewise = 1; |
| 1580 | |
| 1581 | /* Set up the curve */ |
| 1582 | ret = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(wrap_mode); |
| 1583 | stp_curve_set_interpolation_typecxx . . $ stp_curve_set_interpolation_type(43c66d7f6033514f).(ret, curve_type); |
| 1584 | |
| 1585 | child = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(curve, "sequence", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1586 | if (child) |
| 1587 | seq = stp_sequence_create_from_xmltreecxx . . $ stp_sequence_create_from_xmltree(46d170727e408206).(child); |
| 1588 | |
| 1589 | if (seq == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1590 | { |
| 1591 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1592 | "stp_curve_create_from_xmltree: sequence read failed\n"); |
| 1593 | goto error; |
| 1594 | } |
| 1595 | |
| 1596 | /* Set curve bounds */ |
| 1597 | stp_sequence_get_boundscxx . . $ stp_sequence_get_bounds(f1c777fa1c0d001).(seq, &low, &high); |
| 1598 | stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(ret, low, high); |
| 1599 | |
| 1600 | if (fgamma) |
| 1601 | stp_curve_set_gammacxx . . $ stp_curve_set_gamma(4b664532c6114e82).(ret, fgamma); |
| 1602 | else /* Not a gamma curve, so set points */ |
| 1603 | { |
| 1604 | size_t seq_count; |
| 1605 | const double* data; |
| 1606 | |
| 1607 | stp_sequence_get_datacxx . . $ stp_sequence_get_data(5acce6d1b35abc9a).(seq, &seq_count, &data); |
| 1608 | if (piecewise) |
| 1609 | { |
| 1610 | if ((seq_count % 2) != 0) |
| 1611 | { |
| 1612 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1613 | "stp_curve_create_from_xmltree: invalid data count %ld\n", |
| 1614 | (long)seq_count); |
| 1615 | goto error; |
| 1616 | } |
| 1617 | if (stp_curve_set_data_pointscxx . . $ stp_curve_set_data_points(114518be73fd3070).(ret, seq_count / 2, |
| 1618 | (const stp_curve_point_tcxx . . $ stp_curve_point_t# *) data) == 0) |
| 1619 | { |
| 1620 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1621 | "stp_curve_create_from_xmltree: failed to set curve data points\n"); |
| 1622 | goto error; |
| 1623 | } |
| 1624 | } |
| 1625 | else |
| 1626 | { |
| 1627 | if (stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(ret, seq_count, data) == 0) |
| 1628 | { |
| 1629 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1630 | "stp_curve_create_from_xmltree: failed to set curve data\n"); |
| 1631 | goto error; |
| 1632 | } |
| 1633 | } |
| 1634 | } |
| 1635 | |
| 1636 | if (seq) |
| 1637 | { |
| 1638 | stp_sequence_destroycxx . . $ stp_sequence_destroy(58667e1f04cce976).(seq); |
| 1639 | seq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1640 | } |
| 1641 | |
| 1642 | /* Validate curve */ |
| 1643 | if (stpi_curve_check_parameterscxx . . $ stpi_curve_check_parameters(bc87752a72bd695e).(ret, stp_curve_count_pointscxx . . $ stp_curve_count_points(7c52d22dafe22fab).(ret)) == 0) |
| 1644 | { |
| 1645 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1646 | "stp_curve_create_from_xmltree: parameter check failed\n"); |
| 1647 | goto error; |
| 1648 | } |
| 1649 | |
| 1650 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1651 | |
| 1652 | return ret; |
| 1653 | |
| 1654 | error: |
| 1655 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1656 | "stp_curve_create_from_xmltree: error during curve read\n"); |
| 1657 | if (seq) |
| 1658 | { |
| 1659 | stp_sequence_destroycxx . . $ stp_sequence_destroy(58667e1f04cce976).(seq); |
| 1660 | seq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1661 | } |
| 1662 | if (ret) |
| 1663 | stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(ret); |
| 1664 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1665 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1666 | } |
| 1667 | |
| 1668 | |
| 1669 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# * |
| 1670 | stp_xmltree_create_from_curvecxx . . $ stp_xmltree_create_from_curve(7d3a94b2d525d003).(const stp_curve_tcxx . . $ stp_curve_t# *curve) /* The curve */ |
| 1671 | { |
| 1672 | stp_curve_wrap_mode_tcxx . . $ stp_curve_wrap_mode_t# wrapmode; |
| 1673 | stp_curve_type_tcxx . . $ stp_curve_type_t# interptype; |
| 1674 | double gammaval, low, high; |
| 1675 | stp_sequence_tcxx . . $ stp_sequence_t# *seq; |
| 1676 | |
| 1677 | char *cgamma; |
| 1678 | |
| 1679 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *curvenode = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1680 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *child = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1681 | |
| 1682 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1683 | |
| 1684 | /* Get curve details */ |
| 1685 | wrapmode = stp_curve_get_wrapcxx . . $ stp_curve_get_wrap(4b83c4900be391a7).(curve); |
| 1686 | interptype = stp_curve_get_interpolation_typecxx . . $ stp_curve_get_interpolation_type(1655c6932e427974).(curve); |
| 1687 | gammaval = stp_curve_get_gammacxx . . $ stp_curve_get_gamma(ba82a70c8cfd641c).(curve); |
| 1688 | |
| 1689 | if (gammaval && wrapmode != STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.) |
| 1690 | { |
| 1691 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, "stp_xmltree_create_from_curve: " |
| 1692 | "curve sets gamma and wrap_mode is not STP_CURVE_WRAP_NONE\n"); |
| 1693 | goto error; |
| 1694 | } |
| 1695 | |
| 1696 | /* Construct the allocated strings required */ |
| 1697 | stp_asprintfcxx . . $ stp_asprintf(816f0239e6d49b84).(&cgamma, "%g", gammaval); |
| 1698 | |
| 1699 | curvenode = stp_mxmlNewElementcxx . . $ stp_mxmlNewElement(85c1b86a85cbb6d).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, "curve"); |
| 1700 | stp_mxmlElementSetAttrcxx . . $ stp_mxmlElementSetAttr(22374eb3aa38e502).(curvenode, "wrap", stpi_wrap_mode_namescxx . . $ stpi_wrap_mode_names.[wrapmode]); |
| 1701 | stp_mxmlElementSetAttrcxx . . $ stp_mxmlElementSetAttr(22374eb3aa38e502).(curvenode, "type", stpi_curve_type_namescxx . . $ stpi_curve_type_names.[interptype]); |
| 1702 | stp_mxmlElementSetAttrcxx . . $ stp_mxmlElementSetAttr(22374eb3aa38e502).(curvenode, "gamma", cgamma); |
| 1703 | if (curve->piecewisecxx . . $ stp_curve#piecewise.) |
| 1704 | stp_mxmlElementSetAttrcxx . . $ stp_mxmlElementSetAttr(22374eb3aa38e502).(curvenode, "piecewise", "true"); |
| 1705 | else |
| 1706 | stp_mxmlElementSetAttrcxx . . $ stp_mxmlElementSetAttr(22374eb3aa38e502).(curvenode, "piecewise", "false"); |
| 1707 | |
| 1708 | stp_freecxx . . $ stp_free(5d22bdacc48458e8).(cgamma); |
| 1709 | |
| 1710 | seq = stp_sequence_createcxx . . $ stp_sequence_create(c0c0907aae0ab0a0).(); |
| 1711 | stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve, &low, &high); |
| 1712 | stp_sequence_set_boundscxx . . $ stp_sequence_set_bounds(d74b306f919ecc73).(seq, low, high); |
| 1713 | if (gammaval != 0) /* A gamma curve does not require sequence data */ |
| 1714 | { |
| 1715 | stp_sequence_set_sizecxx . . $ stp_sequence_set_size(cb447bd5d582db64).(seq, 0); |
| 1716 | } |
| 1717 | else |
| 1718 | { |
| 1719 | const double *data; |
| 1720 | size_t count; |
| 1721 | data = stpi_curve_get_data_internalcxx . . $ stpi_curve_get_data_internal(2a13b0d70f8dce87).(curve, &count); |
| 1722 | stp_sequence_set_datacxx . . $ stp_sequence_set_data(eaf6acc80580ab39).(seq, count, data); |
| 1723 | } |
| 1724 | |
| 1725 | child = stp_xmltree_create_from_sequencecxx . . $ stp_xmltree_create_from_sequence(5a8928e2ae29fea3).(seq); |
| 1726 | |
| 1727 | if (seq) |
| 1728 | { |
| 1729 | stp_sequence_destroycxx . . $ stp_sequence_destroy(58667e1f04cce976).(seq); |
| 1730 | seq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1731 | } |
| 1732 | |
| 1733 | if (child == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1734 | { |
| 1735 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1736 | "stp_xmltree_create_from_curve: sequence node is NULL\n"); |
| 1737 | goto error; |
| 1738 | } |
| 1739 | stp_mxmlAddcxx . . $ stp_mxmlAdd(bd5d61ecf5707a05).(curvenode, STP_MXML_ADD_AFTERcxx . . $ `include/gutenprint/mxml.h:61:11`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, child); |
| 1740 | |
| 1741 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1742 | |
| 1743 | return curvenode; |
| 1744 | |
| 1745 | error: |
| 1746 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1747 | "stp_xmltree_create_from_curve: error during xmltree creation\n"); |
| 1748 | if (curvenode) |
| 1749 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(curvenode); |
| 1750 | if (child) |
| 1751 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(child); |
| 1752 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1753 | |
| 1754 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1755 | } |
| 1756 | |
| 1757 | static stp_mxml_node_tcxx . . $ stp_mxml_node_t# * |
| 1758 | xmldoc_create_from_curvecxx . . $ xmldoc_create_from_curve(7d3a94b2d525d003).(const stp_curve_tcxx . . $ stp_curve_t# *curve) |
| 1759 | { |
| 1760 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *xmldoc; |
| 1761 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *rootnode; |
| 1762 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *curvenode; |
| 1763 | |
| 1764 | /* Get curve details */ |
| 1765 | curvenode = stp_xmltree_create_from_curvecxx . . $ stp_xmltree_create_from_curve(7d3a94b2d525d003).(curve); |
| 1766 | if (curvenode == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1767 | { |
| 1768 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1769 | "xmldoc_create_from_curve: error creating curve node\n"); |
| 1770 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1771 | } |
| 1772 | /* Create the XML tree */ |
| 1773 | xmldoc = stp_xmldoc_create_genericcxx . . $ stp_xmldoc_create_generic(2e406f0fc93e98f4).(); |
| 1774 | if (xmldoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1775 | { |
| 1776 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1777 | "xmldoc_create_from_curve: error creating XML document\n"); |
| 1778 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1779 | } |
| 1780 | rootnode = xmldoc->childcxx . . $ stp_mxml_node_s#child.; |
| 1781 | if (rootnode == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1782 | { |
| 1783 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(xmldoc); |
| 1784 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1785 | "xmldoc_create_from_curve: error getting XML document root node\n"); |
| 1786 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1787 | } |
| 1788 | |
| 1789 | stp_mxmlAddcxx . . $ stp_mxmlAdd(bd5d61ecf5707a05).(rootnode, STP_MXML_ADD_AFTERcxx . . $ `include/gutenprint/mxml.h:61:11`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, curvenode); |
| 1790 | |
| 1791 | return xmldoc; |
| 1792 | } |
| 1793 | |
| 1794 | static int |
| 1795 | curve_whitespace_callbackcxx . . $ curve_whitespace_callback(90e46f0b0341a80e).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *node, int where) |
| 1796 | { |
| 1797 | if (node->typecxx . . $ stp_mxml_node_s#type. != STP_MXML_ELEMENTcxx . . $ STP_MXML_ELEMENT.) |
| 1798 | return 0; |
| 1799 | if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(node->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "gutenprint") == 0) |
| 1800 | { |
| 1801 | switch (where) |
| 1802 | { |
| 1803 | case STP_MXML_WS_AFTER_OPENcxx . . $ `include/gutenprint/mxml.h:56:11`!: |
| 1804 | case STP_MXML_WS_BEFORE_CLOSEcxx . . $ `include/gutenprint/mxml.h:57:11`!: |
| 1805 | case STP_MXML_WS_AFTER_CLOSEcxx . . $ `include/gutenprint/mxml.h:58:11`!: |
| 1806 | return '\n'; |
| 1807 | case STP_MXML_WS_BEFORE_OPENcxx . . $ `include/gutenprint/mxml.h:55:11`!: |
| 1808 | default: |
| 1809 | return 0; |
| 1810 | } |
| 1811 | } |
| 1812 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(node->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "curve") == 0) |
| 1813 | { |
| 1814 | switch (where) |
| 1815 | { |
| 1816 | case STP_MXML_WS_AFTER_OPENcxx . . $ `include/gutenprint/mxml.h:56:11`!: |
| 1817 | return '\n'; |
| 1818 | case STP_MXML_WS_BEFORE_CLOSEcxx . . $ `include/gutenprint/mxml.h:57:11`!: |
| 1819 | case STP_MXML_WS_AFTER_CLOSEcxx . . $ `include/gutenprint/mxml.h:58:11`!: |
| 1820 | case STP_MXML_WS_BEFORE_OPENcxx . . $ `include/gutenprint/mxml.h:55:11`!: |
| 1821 | default: |
| 1822 | return 0; |
| 1823 | } |
| 1824 | } |
| 1825 | else if (strcasecmpcxx . . $ strcasecmp(5ae29d726ae57f88).(node->valuecxx . . $ stp_mxml_node_s#value..elementcxx . . $ stp_mxml_value_u#element..namecxx . . $ stp_mxml_value_s#name., "sequence") == 0) |
| 1826 | { |
| 1827 | const char *count; |
| 1828 | switch (where) |
| 1829 | { |
| 1830 | case STP_MXML_WS_BEFORE_CLOSEcxx . . $ `include/gutenprint/mxml.h:57:11`!: |
| 1831 | count = stp_mxmlElementGetAttrcxx . . $ stp_mxmlElementGetAttr(42933e0d82869bb1).(node, "count"); |
| 1832 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(count, "0") == 0) |
| 1833 | return 0; |
| 1834 | else |
| 1835 | return '\n'; |
| 1836 | case STP_MXML_WS_AFTER_OPENcxx . . $ `include/gutenprint/mxml.h:56:11`!: |
| 1837 | case STP_MXML_WS_AFTER_CLOSEcxx . . $ `include/gutenprint/mxml.h:58:11`!: |
| 1838 | return '\n'; |
| 1839 | case STP_MXML_WS_BEFORE_OPENcxx . . $ `include/gutenprint/mxml.h:55:11`!: |
| 1840 | default: |
| 1841 | return 0; |
| 1842 | } |
| 1843 | } |
| 1844 | else |
| 1845 | return 0; |
| 1846 | } |
| 1847 | |
| 1848 | |
| 1849 | int |
| 1850 | stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(FILEcxx . . $ FILE# *file, const stp_curve_tcxx . . $ stp_curve_t# *curve) /* The curve */ |
| 1851 | { |
| 1852 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *xmldoc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1853 | |
| 1854 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1855 | |
| 1856 | xmldoc = xmldoc_create_from_curvecxx . . $ xmldoc_create_from_curve(7d3a94b2d525d003).(curve); |
| 1857 | if (xmldoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1858 | { |
| 1859 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1860 | return 1; |
| 1861 | } |
| 1862 | |
| 1863 | stp_mxmlSaveFilecxx . . $ stp_mxmlSaveFile(9223bc6fc3a01114).(xmldoc, file, curve_whitespace_callbackcxx . . $ curve_whitespace_callback(90e46f0b0341a80e).); |
| 1864 | |
| 1865 | if (xmldoc) |
| 1866 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(xmldoc); |
| 1867 | |
| 1868 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1869 | |
| 1870 | return 0; |
| 1871 | } |
| 1872 | |
| 1873 | char * |
| 1874 | stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(const stp_curve_tcxx . . $ stp_curve_t# *curve) /* The curve */ |
| 1875 | { |
| 1876 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *xmldoc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1877 | char *retval; |
| 1878 | |
| 1879 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1880 | |
| 1881 | xmldoc = xmldoc_create_from_curvecxx . . $ xmldoc_create_from_curve(7d3a94b2d525d003).(curve); |
| 1882 | if (xmldoc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1883 | { |
| 1884 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1885 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1886 | } |
| 1887 | |
| 1888 | retval = stp_mxmlSaveAllocStringcxx . . $ stp_mxmlSaveAllocString(a1f48baf55c04762).(xmldoc, curve_whitespace_callbackcxx . . $ curve_whitespace_callback(90e46f0b0341a80e).); |
| 1889 | |
| 1890 | if (xmldoc) |
| 1891 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(xmldoc); |
| 1892 | |
| 1893 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1894 | |
| 1895 | return retval; |
| 1896 | } |
| 1897 | |
| 1898 | static stp_curve_tcxx . . $ stp_curve_t# * |
| 1899 | xml_doc_get_curvecxx . . $ xml_doc_get_curve(43c00d17ff70fe89).(stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc) |
| 1900 | { |
| 1901 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *cur; |
| 1902 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *xmlcurve; |
| 1903 | stp_curve_tcxx . . $ stp_curve_t# *curve = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1904 | |
| 1905 | if (doc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ) |
| 1906 | { |
| 1907 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1908 | "xml_doc_get_curve: XML file not parsed successfully.\n"); |
| 1909 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1910 | } |
| 1911 | |
| 1912 | cur = doc->childcxx . . $ stp_mxml_node_s#child.; |
| 1913 | |
| 1914 | if (cur == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1915 | { |
| 1916 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1917 | "xml_doc_get_curve: empty document\n"); |
| 1918 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1919 | } |
| 1920 | |
| 1921 | xmlcurve = stp_xml_get_nodecxx . . $ stp_xml_get_node(a1d8ee452fb78e99).(cur, "gutenprint", "curve", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1922 | |
| 1923 | if (xmlcurve) |
| 1924 | curve = stp_curve_create_from_xmltreecxx . . $ stp_curve_create_from_xmltree(43c00d17ff70fe89).(xmlcurve); |
| 1925 | |
| 1926 | return curve; |
| 1927 | } |
| 1928 | |
| 1929 | stp_curve_tcxx . . $ stp_curve_t# * |
| 1930 | stp_curve_create_from_filecxx . . $ stp_curve_create_from_file(fc1a54117bc5f637).(const char* file) |
| 1931 | { |
| 1932 | stp_curve_tcxx . . $ stp_curve_t# *curve = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1933 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc; |
| 1934 | FILEcxx . . $ FILE# *fp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1935 | if (file[0] != '/' && strncmpcxx . . $ strncmp(fd278af2f295fa2e).(file, "./", 2) && strncmpcxx . . $ strncmp(fd278af2f295fa2e).(file, "../", 3)) |
| 1936 | { |
| 1937 | char *fn = stp_path_find_filecxx . . $ stp_path_find_file(a713fe7b9a57cf96).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, file); |
| 1938 | if (fn) |
| 1939 | { |
| 1940 | fp = fopencxx . . $ fopen(82ec0787cd37e0a3).(file, "r"); |
| 1941 | freecxx . . $ free(5d22bdacc48458e8).(fn); |
| 1942 | } |
| 1943 | } |
| 1944 | else if (file) |
| 1945 | { |
| 1946 | fp = fopencxx . . $ fopen(82ec0787cd37e0a3).(file, "r"); |
| 1947 | } |
| 1948 | if (!fp) |
| 1949 | { |
| 1950 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_CURVE_ERRORScxx . . $ `include/gutenprint/util.h:186:9`!, |
| 1951 | "stp_curve_create_from_file: unable to open %s: %s\n", |
| 1952 | file, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 1953 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1954 | } |
| 1955 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_XMLcxx . . $ `include/gutenprint/util.h:182:9`!, "stp_curve_create_from_file: reading `%s'...\n", |
| 1956 | file); |
| 1957 | |
| 1958 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1959 | |
| 1960 | doc = stp_mxmlLoadFilecxx . . $ stp_mxmlLoadFile(3a8302cc33115af5).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, fp, STP_MXML_NO_CALLBACKcxx . . $ `include/gutenprint/mxml.h:48:11`!); |
| 1961 | |
| 1962 | curve = xml_doc_get_curvecxx . . $ xml_doc_get_curve(43c00d17ff70fe89).(doc); |
| 1963 | |
| 1964 | if (doc) |
| 1965 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(doc); |
| 1966 | |
| 1967 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1968 | (void) fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp); |
| 1969 | return curve; |
| 1970 | |
| 1971 | } |
| 1972 | |
| 1973 | stp_curve_tcxx . . $ stp_curve_t# * |
| 1974 | stp_curve_create_from_streamcxx . . $ stp_curve_create_from_stream(7d0524da07716371).(FILEcxx . . $ FILE#* fp) |
| 1975 | { |
| 1976 | stp_curve_tcxx . . $ stp_curve_t# *curve = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1977 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc; |
| 1978 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_XMLcxx . . $ `include/gutenprint/util.h:182:9`!, "stp_curve_create_from_fp: reading...\n"); |
| 1979 | |
| 1980 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 1981 | |
| 1982 | doc = stp_mxmlLoadFilecxx . . $ stp_mxmlLoadFile(3a8302cc33115af5).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, fp, STP_MXML_NO_CALLBACKcxx . . $ `include/gutenprint/mxml.h:48:11`!); |
| 1983 | |
| 1984 | curve = xml_doc_get_curvecxx . . $ xml_doc_get_curve(43c00d17ff70fe89).(doc); |
| 1985 | |
| 1986 | if (doc) |
| 1987 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(doc); |
| 1988 | |
| 1989 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 1990 | return curve; |
| 1991 | |
| 1992 | } |
| 1993 | |
| 1994 | stp_curve_tcxx . . $ stp_curve_t# * |
| 1995 | stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(const char* string) |
| 1996 | { |
| 1997 | stp_curve_tcxx . . $ stp_curve_t# *curve = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1998 | stp_mxml_node_tcxx . . $ stp_mxml_node_t# *doc; |
| 1999 | stp_deprintfcxx . . $ stp_deprintf(3d303ebd7ab3b1e3).(STP_DBG_XMLcxx . . $ `include/gutenprint/util.h:182:9`!, |
| 2000 | "stp_curve_create_from_string: reading '%s'...\n", string); |
| 2001 | stp_xml_initcxx . . $ stp_xml_init(49f6e7a06ebc5aa8).(); |
| 2002 | |
| 2003 | doc = stp_mxmlLoadStringcxx . . $ stp_mxmlLoadString(40d1ca7ef3f17308).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, string, STP_MXML_NO_CALLBACKcxx . . $ `include/gutenprint/mxml.h:48:11`!); |
| 2004 | |
| 2005 | curve = xml_doc_get_curvecxx . . $ xml_doc_get_curve(43c00d17ff70fe89).(doc); |
| 2006 | |
| 2007 | if (doc) |
| 2008 | stp_mxmlDeletecxx . . $ stp_mxmlDelete(6927777f14b5e2a1).(doc); |
| 2009 | |
| 2010 | stp_xml_exitcxx . . $ stp_xml_exit(49f6e7a06ebc5aa8).(); |
| 2011 | return curve; |
| 2012 | } |