| 3557 | // |
| 3558 | |
| 3559 | static void gen_tpb(const tpb* tpb_buffer) |
| 3560 | { |
| 3561 | union { |
| 3562 | UCHAR bytewise_tpb[4]; |
| 3563 | SLONG longword_tpb; |
| 3564 | } tpb_hunk; |
| 3565 | |
| 3566 | // TPBs are generated as raw BLR in longword chunks |
| 3567 | // because COBOL is a miserable excuse for a language |
| 3568 | // and doesn't allow byte value assignments to character |
| 3569 | // fields. |
| 3570 | |
| 3571 | printa(names[COLUMN_0], false, "01 %s%d.", names[isc_tpb_pos], tpb_buffer->tpb_ident); |
| 3572 | |
| 3573 | const UCHAR* text = tpb_buffer->tpb_string; |
| 3574 | int char_len = tpb_buffer->tpb_length; |
| 3575 | int length = 1; |
| 3576 | |
| 3577 | while (char_len) |
| 3578 | { |
| 3579 | for (UCHAR* c = tpb_hunk.bytewise_tpb; c < tpb_hunk.bytewise_tpb + sizeof(SLONG); c++) |
| 3580 | { |
| 3581 | *c = *text++; |
| 3582 | if (!--char_len) |
| 3583 | break; |
| 3584 | } |
| 3585 | |
| 3586 | printa(names[COLUMN], false, RAW_TPB_TEMPLATE, |
| 3587 | names[isc_tpb_pos], tpb_buffer->tpb_ident, |
| 3588 | names[UNDER], length++, tpb_hunk.longword_tpb); |
| 3589 | } |
| 3590 | |
| 3591 | sprintf(output_buffer, "%sEnd of data for %s%d\n", |
| 3592 | names[COMMENT], names[isc_tpb_pos], tpb_buffer->tpb_ident); |
| 3593 | COB_print_buffer(output_buffer, false); |
| 3594 | } |
| 3595 | |
| 3596 | |
| 3597 | //____________________________________________________________ |
no test coverage detected