| 316 | } |
| 317 | |
| 318 | static char *transcode_class(CBMArena *arena, const char *cs, const char *ce) { |
| 319 | UdlBuf b; |
| 320 | ub_init(&b, arena); |
| 321 | if (!b.buf) |
| 322 | return NULL; |
| 323 | emit_header(&b, cs, ce); |
| 324 | const char *p = cs; |
| 325 | while (p < ce) { |
| 326 | p = skip_ws(p, ce); |
| 327 | if (p >= ce || *p != '<') { |
| 328 | if (p < ce) |
| 329 | p++; |
| 330 | continue; |
| 331 | } |
| 332 | if (sw(p, ce, "<Method ") || sw(p, ce, "<Method>")) { |
| 333 | const char *gt = find_s(p, ce, ">"); |
| 334 | if (!gt) |
| 335 | break; |
| 336 | const char *me = find_s(gt + 1, ce, "</Method>"); |
| 337 | if (!me) { |
| 338 | p = gt + 1; |
| 339 | continue; |
| 340 | } |
| 341 | emit_method(&b, p, me + strlen("</Method>")); |
| 342 | p = me + strlen("</Method>"); |
| 343 | continue; |
| 344 | } |
| 345 | if (sw(p, ce, "<Property ")) { |
| 346 | const char *gt = find_s(p, ce, ">"); |
| 347 | if (!gt) |
| 348 | break; |
| 349 | const char *pe = find_s(gt + 1, ce, "</Property>"); |
| 350 | if (!pe) { |
| 351 | p = gt + 1; |
| 352 | continue; |
| 353 | } |
| 354 | emit_property(&b, p, pe + strlen("</Property>")); |
| 355 | p = pe + strlen("</Property>"); |
| 356 | continue; |
| 357 | } |
| 358 | if (sw(p, ce, "<Parameter ")) { |
| 359 | const char *gt = find_s(p, ce, ">"); |
| 360 | if (!gt) |
| 361 | break; |
| 362 | if (is_self_closing(p, gt)) { |
| 363 | p = gt + 1; |
| 364 | continue; |
| 365 | } |
| 366 | const char *pe = find_s(gt + 1, ce, "</Parameter>"); |
| 367 | if (!pe) { |
| 368 | p = gt + 1; |
| 369 | continue; |
| 370 | } |
| 371 | emit_parameter(&b, p, pe + strlen("</Parameter>")); |
| 372 | p = pe + strlen("</Parameter>"); |
| 373 | continue; |
| 374 | } |
| 375 | if (sw(p, ce, "<Index ") || sw(p, ce, "<Index>")) { |
no test coverage detected