| 1 |
|
| #include "EXTERN.h" |
| 2 |
|
| #include "perl.h" |
| 3 |
|
| #include "XSUB.h" |
| 4 |
|
| |
| 5 |
|
| #include <libpkgconf/libpkgconf.h> |
| 6 |
|
| |
| 7 |
|
| struct my_client_t { |
| 8 |
|
| pkgconf_client_t client; |
| 9 |
|
| FILE *auditf; |
| 10 |
|
| int maxdepth; |
| 11 |
|
| SV *error_handler; |
| 12 |
|
| }; |
| 13 |
|
| |
| 14 |
|
| typedef struct my_client_t my_client_t; |
| 15 |
|
| |
| 16 |
|
| static bool |
| 17 |
2 |
| my_error_handler(const char *msg, const pkgconf_client_t *_, const void *data) |
| 18 |
|
| { |
| 19 |
2 |
| dSP; |
| 20 |
|
| |
| 21 |
|
| int count; |
| 22 |
|
| bool value; |
| 23 |
2 |
| const my_client_t *client = (const my_client_t*)data; |
| 24 |
|
| |
| 25 |
2 |
| ENTER; |
| 26 |
2 |
| SAVETMPS; |
| 27 |
|
| |
| 28 |
2 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
2 |
2 |
|
| 29 |
2 |
▶ | EXTEND(SP, 1); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP, 1); |
0 |
2 |
2 |
|
| 30 |
2 |
| PUSHs(sv_2mortal(newSVpv(msg, 0))); |
| 31 |
2 |
| PUTBACK; |
| 32 |
|
| |
| 33 |
2 |
| count = call_sv(client->error_handler, G_SCALAR); |
| 34 |
|
| |
| 35 |
2 |
| SPAGAIN; |
| 36 |
|
| |
| 37 |
2 |
▶ | value = count > 0 && POPi; |
Branch: 2 branches
| Branch | True | False | Total |
| value = count > 0 && POPi; |
2 |
0 |
2 |
| value = count > 0 && POPi; |
2 |
0 |
2 |
|
| 38 |
|
| |
| 39 |
2 |
| PUTBACK; |
| 40 |
2 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
2 |
0 |
2 |
|
| 41 |
2 |
| LEAVE; |
| 42 |
|
| |
| 43 |
2 |
| return value; |
| 44 |
|
| } |
| 45 |
|
| |
| 46 |
|
| static bool |
| 47 |
3 |
| my_pkg_iterator(const pkgconf_pkg_t *pkg, void *data) |
| 48 |
|
| { |
| 49 |
3 |
| dSP; |
| 50 |
|
| |
| 51 |
|
| int count; |
| 52 |
|
| bool value; |
| 53 |
3 |
| SV *callback = (SV*)data; |
| 54 |
|
| |
| 55 |
3 |
| ENTER; |
| 56 |
3 |
| SAVETMPS; |
| 57 |
|
| |
| 58 |
3 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
3 |
3 |
|
| 59 |
3 |
▶ | EXTEND(SP,1); |
Branch: 1 branch
| Branch | True | False | Total |
| EXTEND(SP,1); |
0 |
3 |
3 |
|
| 60 |
3 |
| PUSHs(sv_2mortal(newSViv(PTR2IV(pkg)))); |
| 61 |
3 |
| PUTBACK; |
| 62 |
|
| |
| 63 |
3 |
| count = call_sv(callback, G_SCALAR); |
| 64 |
|
| |
| 65 |
3 |
| SPAGAIN; |
| 66 |
|
| |
| 67 |
3 |
▶ | value = count > 0 && POPi; |
Branch: 2 branches
| Branch | True | False | Total |
| value = count > 0 && POPi; |
3 |
0 |
3 |
| value = count > 0 && POPi; |
0 |
3 |
3 |
|
| 68 |
|
| |
| 69 |
3 |
| PUTBACK; |
| 70 |
3 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
3 |
0 |
3 |
|
| 71 |
3 |
| LEAVE; |
| 72 |
|
| |
| 73 |
3 |
| return value; |
| 74 |
|
| } |
| 75 |
|
| |
| 76 |
|
| static bool |
| 77 |
102 |
| directory_filter(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data) |
| 78 |
|
| { |
| 79 |
102 |
▶ | if(pkgconf_fragment_has_system_dir(client, frag)) |
Branch: 1 branch
| Branch | True | False | Total |
| if(pkgconf_fragment_has_system_dir(client, frag)) |
2 |
100 |
102 |
|
| 80 |
2 |
| return false; |
| 81 |
100 |
| return true; |
| 82 |
|
| } |
| 83 |
|
| |
| 84 |
|
| MODULE = PkgConfig::LibPkgConf PACKAGE = PkgConfig::LibPkgConf::Client |
| 85 |
|
| |
| 86 |
|
| |
| 87 |
|
| void |
| 88 |
|
| _init(object, error_handler, maxdepth) |
| 89 |
|
| SV *object |
| 90 |
|
| SV *error_handler |
| 91 |
|
| int maxdepth |
| 92 |
|
| INIT: |
| 93 |
|
| my_client_t *self; |
| 94 |
|
| CODE: |
| 95 |
41 |
| Newxz(self, 1, my_client_t); |
| 96 |
41 |
| self->auditf = NULL; |
| 97 |
41 |
| self->error_handler = SvREFCNT_inc(error_handler); |
| 98 |
41 |
| self->maxdepth = maxdepth; |
| 99 |
41 |
| pkgconf_client_init(&self->client, my_error_handler, self, pkgconf_cross_personality_default()); |
| 100 |
41 |
| pkgconf_client_set_flags(&self->client, PKGCONF_PKG_PKGF_NONE); |
| 101 |
41 |
| hv_store((HV*)SvRV(object), "ptr", 3, newSViv(PTR2IV(self)), 0); |
| 102 |
|
| |
| 103 |
|
| |
| 104 |
|
| void |
| 105 |
|
| audit_set_log(self, filename, mode) |
| 106 |
|
| my_client_t *self |
| 107 |
|
| const char *filename |
| 108 |
|
| const char *mode |
| 109 |
|
| CODE: |
| 110 |
1 |
▶ | if(self->auditf != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if(self->auditf != NULL) |
0 |
1 |
1 |
|
| 111 |
|
| { |
| 112 |
0 |
| fclose(self->auditf); |
| 113 |
0 |
| self->auditf = NULL; |
| 114 |
|
| } |
| 115 |
1 |
| self->auditf = fopen(filename, mode); |
| 116 |
1 |
▶ | if(self->auditf != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if(self->auditf != NULL) |
1 |
0 |
1 |
|
| 117 |
|
| { |
| 118 |
1 |
| pkgconf_audit_set_log(&self->client, self->auditf); |
| 119 |
|
| } |
| 120 |
|
| else |
| 121 |
|
| { |
| 122 |
|
| /* TODO: call error ? */ |
| 123 |
|
| } |
| 124 |
|
| |
| 125 |
|
| |
| 126 |
|
| const char * |
| 127 |
|
| sysroot_dir(self, ...) |
| 128 |
|
| my_client_t *self |
| 129 |
|
| CODE: |
| 130 |
3 |
▶ | if(items > 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(items > 1) |
1 |
2 |
3 |
|
| 131 |
|
| { |
| 132 |
2 |
| pkgconf_client_set_sysroot_dir(&self->client, SvPV_nolen(ST(1))); |
| 133 |
|
| } |
| 134 |
3 |
| RETVAL = pkgconf_client_get_sysroot_dir(&self->client); |
| 135 |
|
| OUTPUT: |
| 136 |
|
| RETVAL |
| 137 |
|
| |
| 138 |
|
| |
| 139 |
|
| const char * |
| 140 |
|
| buildroot_dir(self, ...) |
| 141 |
|
| my_client_t *self |
| 142 |
|
| CODE: |
| 143 |
3 |
▶ | if(items > 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(items > 1) |
1 |
2 |
3 |
|
| 144 |
|
| { |
| 145 |
2 |
| pkgconf_client_set_buildroot_dir(&self->client, SvPV_nolen(ST(1))); |
| 146 |
|
| } |
| 147 |
3 |
| RETVAL = pkgconf_client_get_buildroot_dir(&self->client); |
| 148 |
|
| OUTPUT: |
| 149 |
|
| RETVAL |
| 150 |
|
| |
| 151 |
|
| |
| 152 |
|
| int |
| 153 |
|
| maxdepth(self, ...) |
| 154 |
|
| my_client_t *self |
| 155 |
|
| CODE: |
| 156 |
4 |
▶ | if(items > 1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(items > 1) |
1 |
3 |
4 |
|
| 157 |
|
| { |
| 158 |
1 |
| self->maxdepth = SvIV(ST(1)); |
| 159 |
|
| } |
| 160 |
4 |
▶ | RETVAL = self->maxdepth; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = self->maxdepth; |
0 |
4 |
4 |
|
| 161 |
|
| OUTPUT: |
| 162 |
|
| RETVAL |
| 163 |
|
| |
| 164 |
|
| |
| 165 |
|
| void |
| 166 |
|
| path(self) |
| 167 |
|
| my_client_t *self |
| 168 |
|
| INIT: |
| 169 |
|
| pkgconf_node_t *n; |
| 170 |
|
| pkgconf_path_t *pnode; |
| 171 |
6 |
| int count = 0; |
| 172 |
|
| CODE: |
| 173 |
18 |
▶ | PKGCONF_FOREACH_LIST_ENTRY(self->client.dir_list.head, n) |
Branch: 1 branch
| Branch | True | False | Total |
| PKGCONF_FOREACH_LIST_ENTRY(self->client.dir_list.head, n) |
12 |
6 |
18 |
|
| 174 |
|
| { |
| 175 |
12 |
| pnode = n->data; |
| 176 |
12 |
| ST(count++) = sv_2mortal(newSVpv(pnode->path, 0)); |
| 177 |
|
| } |
| 178 |
6 |
| XSRETURN(count); |
| 179 |
|
| |
| 180 |
|
| |
| 181 |
|
| void |
| 182 |
|
| filter_lib_dirs(self) |
| 183 |
|
| my_client_t *self |
| 184 |
|
| INIT: |
| 185 |
|
| pkgconf_node_t *n; |
| 186 |
|
| pkgconf_path_t *pnode; |
| 187 |
3 |
| int count = 0; |
| 188 |
|
| CODE: |
| 189 |
11 |
▶ | PKGCONF_FOREACH_LIST_ENTRY(self->client.filter_libdirs.head, n) |
Branch: 1 branch
| Branch | True | False | Total |
| PKGCONF_FOREACH_LIST_ENTRY(self->client.filter_libdirs.head, n) |
8 |
3 |
11 |
|
| 190 |
|
| { |
| 191 |
8 |
| pnode = n->data; |
| 192 |
8 |
| ST(count++) = sv_2mortal(newSVpv(pnode->path, 0)); |
| 193 |
|
| } |
| 194 |
3 |
| XSRETURN(count); |
| 195 |
|
| |
| 196 |
|
| |
| 197 |
|
| void |
| 198 |
|
| filter_include_dirs(self) |
| 199 |
|
| my_client_t *self |
| 200 |
|
| INIT: |
| 201 |
|
| pkgconf_node_t *n; |
| 202 |
|
| pkgconf_path_t *pnode; |
| 203 |
3 |
| int count = 0; |
| 204 |
|
| CODE: |
| 205 |
9 |
▶ | PKGCONF_FOREACH_LIST_ENTRY(self->client.filter_includedirs.head, n) |
Branch: 1 branch
| Branch | True | False | Total |
| PKGCONF_FOREACH_LIST_ENTRY(self->client.filter_includedirs.head, n) |
6 |
3 |
9 |
|
| 206 |
|
| { |
| 207 |
6 |
| pnode = n->data; |
| 208 |
6 |
| ST(count++) = sv_2mortal(newSVpv(pnode->path, 0)); |
| 209 |
|
| } |
| 210 |
3 |
| XSRETURN(count); |
| 211 |
|
| |
| 212 |
|
| |
| 213 |
|
| void |
| 214 |
|
| DESTROY(self) |
| 215 |
|
| my_client_t *self; |
| 216 |
|
| CODE: |
| 217 |
41 |
▶ | if(self->auditf != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if(self->auditf != NULL) |
1 |
40 |
41 |
|
| 218 |
|
| { |
| 219 |
1 |
| fclose(self->auditf); |
| 220 |
1 |
| self->auditf = NULL; |
| 221 |
|
| } |
| 222 |
41 |
| pkgconf_client_deinit(&self->client); |
| 223 |
41 |
| SvREFCNT_dec(self->error_handler); |
| 224 |
41 |
| Safefree(self); |
| 225 |
|
| |
| 226 |
|
| |
| 227 |
|
| IV |
| 228 |
|
| _find(self, name) |
| 229 |
|
| my_client_t *self |
| 230 |
|
| const char *name |
| 231 |
|
| CODE: |
| 232 |
18 |
▶ | RETVAL = PTR2IV(pkgconf_pkg_find(&self->client, name)); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = PTR2IV(pkgconf_pkg_find(&self->client, name)); |
15 |
3 |
18 |
|
| 233 |
|
| OUTPUT: |
| 234 |
|
| RETVAL |
| 235 |
|
| |
| 236 |
|
| |
| 237 |
|
| IV |
| 238 |
|
| _package_from_file(self, filename) |
| 239 |
|
| my_client_t *self |
| 240 |
|
| const char *filename |
| 241 |
|
| INIT: |
| 242 |
|
| FILE *fp; |
| 243 |
|
| CODE: |
| 244 |
1 |
| fp = fopen(filename, "r"); |
| 245 |
1 |
▶ | if(fp != NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if(fp != NULL) |
1 |
0 |
1 |
|
| 246 |
1 |
| RETVAL = PTR2IV(pkgconf_pkg_new_from_file(&self->client, filename, fp)); |
| 247 |
|
| else |
| 248 |
0 |
| RETVAL = 0; |
| 249 |
|
| OUTPUT: |
| 250 |
|
| RETVAL |
| 251 |
|
| |
| 252 |
|
| |
| 253 |
|
| void |
| 254 |
|
| _scan_all(self, sub) |
| 255 |
|
| my_client_t *self |
| 256 |
|
| SV* sub |
| 257 |
|
| CODE: |
| 258 |
1 |
| pkgconf_scan_all(&self->client, sub, my_pkg_iterator); |
| 259 |
|
| |
| 260 |
|
| |
| 261 |
|
| void |
| 262 |
|
| _dir_list_build(self, env_only) |
| 263 |
|
| my_client_t *self |
| 264 |
|
| int env_only |
| 265 |
|
| INIT: |
| 266 |
|
| int old_flags; |
| 267 |
|
| CODE: |
| 268 |
41 |
▶ | if(env_only) |
Branch: 1 branch
| Branch | True | False | Total |
| if(env_only) |
11 |
30 |
41 |
|
| 269 |
|
| { |
| 270 |
11 |
| old_flags = pkgconf_client_get_flags(&self->client); |
| 271 |
11 |
| pkgconf_client_set_flags(&self->client, old_flags | PKGCONF_PKG_PKGF_ENV_ONLY); |
| 272 |
|
| } |
| 273 |
41 |
| pkgconf_client_dir_list_build(&self->client, pkgconf_cross_personality_default()); |
| 274 |
41 |
▶ | if(env_only) |
Branch: 1 branch
| Branch | True | False | Total |
| if(env_only) |
11 |
30 |
41 |
|
| 275 |
|
| { |
| 276 |
11 |
| pkgconf_client_set_flags(&self->client, old_flags); |
| 277 |
|
| } |
| 278 |
|
| |
| 279 |
|
| |
| 280 |
|
| void |
| 281 |
|
| _set_global(self, kv) |
| 282 |
|
| my_client_t *self |
| 283 |
|
| const char *kv |
| 284 |
|
| CODE: |
| 285 |
4 |
| pkgconf_tuple_define_global(&self->client, kv); |
| 286 |
|
| |
| 287 |
|
| |
| 288 |
|
| const char * |
| 289 |
|
| _get_global(self, key) |
| 290 |
|
| my_client_t *self |
| 291 |
|
| const char *key |
| 292 |
|
| INIT: |
| 293 |
|
| const char *val; |
| 294 |
|
| CODE: |
| 295 |
7 |
| val = pkgconf_tuple_find_global(&self->client, key); |
| 296 |
7 |
▶ | if(val == NULL) |
Branch: 1 branch
| Branch | True | False | Total |
| if(val == NULL) |
1 |
6 |
7 |
|
| 297 |
1 |
| XSRETURN_EMPTY; |
| 298 |
|
| else |
| 299 |
6 |
| RETVAL = val; |
| 300 |
|
| OUTPUT: |
| 301 |
|
| RETVAL |
| 302 |
|
| |
| 303 |
|
| |
| 304 |
|
| |
| 305 |
|
| MODULE = PkgConfig::LibPkgConf PACKAGE = PkgConfig::LibPkgConf::Package |
| 306 |
|
| |
| 307 |
|
| |
| 308 |
|
| int |
| 309 |
|
| refcount(self) |
| 310 |
|
| pkgconf_pkg_t* self |
| 311 |
|
| CODE: |
| 312 |
4 |
▶ | RETVAL = self->refcount; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = self->refcount; |
0 |
4 |
4 |
|
| 313 |
|
| OUTPUT: |
| 314 |
|
| RETVAL |
| 315 |
|
| |
| 316 |
|
| |
| 317 |
|
| const char * |
| 318 |
|
| id(self) |
| 319 |
|
| pkgconf_pkg_t* self |
| 320 |
|
| CODE: |
| 321 |
7 |
| RETVAL = self->id; |
| 322 |
|
| OUTPUT: |
| 323 |
|
| RETVAL |
| 324 |
|
| |
| 325 |
|
| |
| 326 |
|
| const char * |
| 327 |
|
| filename(self) |
| 328 |
|
| pkgconf_pkg_t* self |
| 329 |
|
| CODE: |
| 330 |
3 |
| RETVAL = self->filename; |
| 331 |
|
| OUTPUT: |
| 332 |
|
| RETVAL |
| 333 |
|
| |
| 334 |
|
| |
| 335 |
|
| const char * |
| 336 |
|
| realname(self) |
| 337 |
|
| pkgconf_pkg_t* self |
| 338 |
|
| CODE: |
| 339 |
4 |
| RETVAL = self->realname; |
| 340 |
|
| OUTPUT: |
| 341 |
|
| RETVAL |
| 342 |
|
| |
| 343 |
|
| |
| 344 |
|
| const char * |
| 345 |
|
| version(self) |
| 346 |
|
| pkgconf_pkg_t* self |
| 347 |
|
| CODE: |
| 348 |
5 |
| RETVAL = self->version; |
| 349 |
|
| OUTPUT: |
| 350 |
|
| RETVAL |
| 351 |
|
| |
| 352 |
|
| |
| 353 |
|
| const char * |
| 354 |
|
| description(self) |
| 355 |
|
| pkgconf_pkg_t* self |
| 356 |
|
| CODE: |
| 357 |
4 |
| RETVAL = self->description; |
| 358 |
|
| OUTPUT: |
| 359 |
|
| RETVAL |
| 360 |
|
| |
| 361 |
|
| |
| 362 |
|
| const char * |
| 363 |
|
| url(self) |
| 364 |
|
| pkgconf_pkg_t* self |
| 365 |
|
| CODE: |
| 366 |
0 |
| RETVAL = self->url; |
| 367 |
|
| OUTPUT: |
| 368 |
|
| RETVAL |
| 369 |
|
| |
| 370 |
|
| |
| 371 |
|
| const char * |
| 372 |
|
| pc_filedir(self) |
| 373 |
|
| pkgconf_pkg_t* self |
| 374 |
|
| CODE: |
| 375 |
0 |
| RETVAL = self->pc_filedir; |
| 376 |
|
| OUTPUT: |
| 377 |
|
| RETVAL |
| 378 |
|
| |
| 379 |
|
| |
| 380 |
|
| SV * |
| 381 |
|
| _get_string(self, client, type) |
| 382 |
|
| pkgconf_pkg_t *self |
| 383 |
|
| my_client_t *client |
| 384 |
|
| int type |
| 385 |
|
| INIT: |
| 386 |
27 |
| pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER; |
| 387 |
27 |
| pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER; |
| 388 |
|
| size_t len; |
| 389 |
|
| int eflag; |
| 390 |
|
| int flags; |
| 391 |
|
| int old_flags; |
| 392 |
27 |
| bool escape = true; |
| 393 |
|
| CODE: |
| 394 |
27 |
| old_flags = flags = pkgconf_client_get_flags(&client->client); |
| 395 |
27 |
▶ | if(type % 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if(type % 2) |
10 |
17 |
27 |
|
| 396 |
10 |
| flags = flags | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS; |
| 397 |
27 |
| pkgconf_client_set_flags(&client->client, flags); |
| 398 |
|
| /* |
| 399 |
|
| * TODO: attribute for max depth (also in the list version below) |
| 400 |
|
| */ |
| 401 |
27 |
| eflag = type > 1 |
| 402 |
15 |
| ? pkgconf_pkg_cflags(&client->client, self, &unfiltered_list, client->maxdepth) |
| 403 |
42 |
▶ | : pkgconf_pkg_libs(&client->client, self, &unfiltered_list, client->maxdepth); |
Branch: 1 branch
| Branch | True | False | Total |
| : pkgconf_pkg_libs(&client->client, self, &unfiltered_list, client->maxdepth); |
15 |
12 |
27 |
|
| 404 |
27 |
| pkgconf_client_set_flags(&client->client, old_flags); |
| 405 |
|
| /* |
| 406 |
|
| * TODO: throw an exception (also in the list verson below) |
| 407 |
|
| */ |
| 408 |
27 |
▶ | if(eflag != PKGCONF_PKG_ERRF_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if(eflag != PKGCONF_PKG_ERRF_OK) |
0 |
27 |
27 |
|
| 409 |
0 |
| XSRETURN_EMPTY; |
| 410 |
27 |
| pkgconf_fragment_filter(&client->client, &filtered_list, &unfiltered_list, directory_filter, NULL); |
| 411 |
27 |
| len = pkgconf_fragment_render_len(&filtered_list, escape, NULL); |
| 412 |
27 |
▶ | RETVAL = newSV(len == 1 ? len : len-1); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = newSV(len == 1 ? len : len-1); |
27 |
0 |
27 |
|
| 413 |
27 |
| SvPOK_on(RETVAL); |
| 414 |
27 |
| SvCUR_set(RETVAL, len-1); |
| 415 |
27 |
| pkgconf_fragment_render_buf(&filtered_list, SvPVX(RETVAL), len, escape, NULL); |
| 416 |
27 |
| pkgconf_fragment_free(&filtered_list); |
| 417 |
27 |
| pkgconf_fragment_free(&unfiltered_list); |
| 418 |
|
| OUTPUT: |
| 419 |
|
| RETVAL |
| 420 |
|
| |
| 421 |
|
| |
| 422 |
|
| void |
| 423 |
|
| _get_list(self, client, type) |
| 424 |
|
| pkgconf_pkg_t *self |
| 425 |
|
| my_client_t *client |
| 426 |
|
| int type |
| 427 |
|
| INIT: |
| 428 |
12 |
| pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER; |
| 429 |
12 |
| pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER; |
| 430 |
|
| pkgconf_node_t *node; |
| 431 |
|
| pkgconf_fragment_t *frag; |
| 432 |
12 |
| int count = 0; |
| 433 |
|
| HV *h; |
| 434 |
|
| int eflag; |
| 435 |
|
| int flags; |
| 436 |
|
| int old_flags; |
| 437 |
|
| CODE: |
| 438 |
12 |
| old_flags = flags = pkgconf_client_get_flags(&client->client); |
| 439 |
12 |
▶ | if(type % 2) |
Branch: 1 branch
| Branch | True | False | Total |
| if(type % 2) |
4 |
8 |
12 |
|
| 440 |
4 |
| flags = flags | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS; |
| 441 |
12 |
| pkgconf_client_set_flags(&client->client, flags); |
| 442 |
|
| /* |
| 443 |
|
| * TODO: attribute for max depth |
| 444 |
|
| */ |
| 445 |
12 |
| eflag = type > 1 |
| 446 |
7 |
| ? pkgconf_pkg_cflags(&client->client, self, &unfiltered_list, client->maxdepth) |
| 447 |
19 |
▶ | : pkgconf_pkg_libs(&client->client, self, &unfiltered_list, client->maxdepth); |
Branch: 1 branch
| Branch | True | False | Total |
| : pkgconf_pkg_libs(&client->client, self, &unfiltered_list, client->maxdepth); |
7 |
5 |
12 |
|
| 448 |
12 |
| pkgconf_client_set_flags(&client->client, old_flags); |
| 449 |
|
| /* |
| 450 |
|
| * TODO: throw an exception |
| 451 |
|
| */ |
| 452 |
12 |
▶ | if(eflag != PKGCONF_PKG_ERRF_OK) |
Branch: 1 branch
| Branch | True | False | Total |
| if(eflag != PKGCONF_PKG_ERRF_OK) |
0 |
12 |
12 |
|
| 453 |
0 |
| XSRETURN_EMPTY; |
| 454 |
12 |
| pkgconf_fragment_filter(&client->client, &filtered_list, &unfiltered_list, directory_filter, NULL); |
| 455 |
46 |
▶ | PKGCONF_FOREACH_LIST_ENTRY(filtered_list.head, node) |
Branch: 1 branch
| Branch | True | False | Total |
| PKGCONF_FOREACH_LIST_ENTRY(filtered_list.head, node) |
34 |
12 |
46 |
|
| 456 |
|
| { |
| 457 |
34 |
| h = newHV(); |
| 458 |
34 |
| frag = node->data; |
| 459 |
34 |
▶ | if(frag->type) |
Branch: 1 branch
| Branch | True | False | Total |
| if(frag->type) |
34 |
0 |
34 |
|
| 460 |
34 |
| hv_store(h, "type", 4, newSVpvf("%c", frag->type), 0); |
| 461 |
|
| else |
| 462 |
0 |
| hv_store(h, "type", 4, newSVsv(&PL_sv_undef), 0); |
| 463 |
34 |
▶ | if(frag->data) |
Branch: 1 branch
| Branch | True | False | Total |
| if(frag->data) |
34 |
0 |
34 |
|
| 464 |
34 |
| hv_store(h, "data", 4, newSVpv(frag->data, strlen(frag->data)), 0); |
| 465 |
|
| else |
| 466 |
0 |
| hv_store(h, "data", 4, newSVsv(&PL_sv_undef), 0); |
| 467 |
34 |
| ST(count++) = newRV_noinc((SV*) h); |
| 468 |
|
| } |
| 469 |
12 |
| pkgconf_fragment_free(&filtered_list); |
| 470 |
12 |
| pkgconf_fragment_free(&unfiltered_list); |
| 471 |
12 |
| XSRETURN(count); |
| 472 |
|
| |
| 473 |
|
| |
| 474 |
|
| void |
| 475 |
|
| _get_variable(self, key) |
| 476 |
|
| pkgconf_pkg_t *self |
| 477 |
|
| const char *key |
| 478 |
|
| INIT: |
| 479 |
|
| pkgconf_node_t *node; |
| 480 |
|
| pkgconf_tuple_t *tup; |
| 481 |
|
| CODE: |
| 482 |
20 |
▶ | PKGCONF_FOREACH_LIST_ENTRY(self->vars.head, node) |
Branch: 1 branch
| Branch | True | False | Total |
| PKGCONF_FOREACH_LIST_ENTRY(self->vars.head, node) |
18 |
2 |
20 |
|
| 483 |
|
| { |
| 484 |
18 |
| tup = node->data; |
| 485 |
18 |
▶ | if(!strcmp(tup->key, key)) |
Branch: 1 branch
| Branch | True | False | Total |
| if(!strcmp(tup->key, key)) |
2 |
16 |
18 |
|
| 486 |
|
| { |
| 487 |
2 |
| XSRETURN_PV(tup->value); |
| 488 |
|
| } |
| 489 |
|
| } |
| 490 |
2 |
| XSRETURN_EMPTY; |
| 491 |
|
| |
| 492 |
|
| |
| 493 |
|
| MODULE = PkgConfig::LibPkgConf PACKAGE = PkgConfig::LibPkgConf::Util |
| 494 |
|
| |
| 495 |
|
| |
| 496 |
|
| void |
| 497 |
|
| argv_split(src) |
| 498 |
|
| const char *src |
| 499 |
|
| INIT: |
| 500 |
|
| int argc, ret, i; |
| 501 |
|
| char **argv; |
| 502 |
|
| PPCODE: |
| 503 |
1 |
| ret = pkgconf_argv_split(src, &argc, &argv); |
| 504 |
1 |
▶ | if(ret == 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if(ret == 0) |
1 |
0 |
1 |
|
| 505 |
|
| { |
| 506 |
4 |
▶ | for(i=0; i<argc; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for(i=0; i<argc; i++) |
3 |
1 |
4 |
|
| 507 |
|
| { |
| 508 |
3 |
▶ | XPUSHs(sv_2mortal(newSVpv(argv[i],0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(argv[i],0))); |
0 |
3 |
3 |
|
| 509 |
|
| } |
| 510 |
1 |
| pkgconf_argv_free(argv); |
| 511 |
|
| } |
| 512 |
|
| else |
| 513 |
|
| { |
| 514 |
0 |
| croak("error in argv_split"); |
| 515 |
|
| } |
| 516 |
|
| |
| 517 |
|
| |
| 518 |
|
| int |
| 519 |
|
| compare_version(a,b) |
| 520 |
|
| const char *a |
| 521 |
|
| const char *b |
| 522 |
|
| INIT: |
| 523 |
|
| int ret; |
| 524 |
|
| CODE: |
| 525 |
3 |
| ret = pkgconf_compare_version(a,b); |
| 526 |
3 |
▶ | if(ret < 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if(ret < 0) |
1 |
2 |
3 |
|
| 527 |
1 |
| RETVAL = -1; |
| 528 |
2 |
▶ | else if(ret > 0) |
Branch: 1 branch
| Branch | True | False | Total |
| else if(ret > 0) |
1 |
1 |
2 |
|
| 529 |
1 |
| RETVAL = 1; |
| 530 |
|
| else |
| 531 |
1 |
| RETVAL = 0; |
| 532 |
|
| OUTPUT: |
| 533 |
|
| RETVAL |
| 534 |
|
| |
| 535 |
|
| |
| 536 |
|
| char * |
| 537 |
|
| path_sep() |
| 538 |
|
| CODE: |
| 539 |
24 |
| RETVAL = PKG_CONFIG_PATH_SEP_S; |
| 540 |
|
| OUTPUT: |
| 541 |
|
| RETVAL |
| 542 |
|
| |
| 543 |
|
| |
| 544 |
|
| #define STRINGIZE(x) #x |
| 545 |
|
| #define STRINGIZE_VALUE_OF(x) STRINGIZE(x) |
| 546 |
|
| |
| 547 |
|
| |
| 548 |
|
| const char * |
| 549 |
|
| version() |
| 550 |
|
| CODE: |
| 551 |
1 |
| RETVAL = STRINGIZE_VALUE_OF(MY_PKGCONF_VERSION); |
| 552 |
|
| OUTPUT: |
| 553 |
|
| RETVAL |
| 554 |
|
| |
| 555 |
|
| |
| 556 |
|
| SV * |
| 557 |
|
| path_relocate(in) |
| 558 |
|
| const char *in; |
| 559 |
|
| INIT: |
| 560 |
|
| char out[PKGCONF_BUFSIZE]; |
| 561 |
|
| bool ok; |
| 562 |
|
| CODE: |
| 563 |
17 |
| strncpy(out, in, PKGCONF_BUFSIZE-1); |
| 564 |
17 |
| ok = pkgconf_path_relocate(out, sizeof out); |
| 565 |
17 |
▶ | RETVAL = newSVpv(ok ? out : in, 0); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = newSVpv(ok ? out : in, 0); |
17 |
0 |
17 |
|
| 566 |
|
| OUTPUT: |
| 567 |
|
| RETVAL |
| 568 |
|
| |
| 569 |
|
| |
| 570 |
|
| MODULE = PkgConfig::LibPkgConf PACKAGE = PkgConfig::LibPkgConf::Test |
| 571 |
|
| |
| 572 |
|
| |
| 573 |
|
| IV |
| 574 |
|
| send_error(client, msg) |
| 575 |
|
| my_client_t *client |
| 576 |
|
| const char *msg |
| 577 |
|
| CODE: |
| 578 |
2 |
▶ | RETVAL = pkgconf_error(&client->client, "%s", msg); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = pkgconf_error(&client->client, "%s", msg); |
0 |
2 |
2 |
|
| 579 |
|
| OUTPUT: |
| 580 |
|
| RETVAL |
| 581 |
|
| |
| 582 |
|
| |
| 583 |
|
| void |
| 584 |
|
| send_log(client, msg) |
| 585 |
|
| my_client_t *client |
| 586 |
|
| const char *msg |
| 587 |
|
| CODE: |
| 588 |
2 |
| pkgconf_audit_log(&client->client, "%s", msg); |
| 589 |
|
| |