program.c (76238846ad3e9e271a3d1f792f72beab727fd153) program.c (f4fbc49d201f81c481a33fac6ba28e19faf96260)
1/*
2 * *****************************************************************************
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 3766 unchanged lines hidden (view full) ---

3775
3776static void
3777bc_program_printStr(const BcProgram* p, const char* restrict code,
3778 size_t* restrict bgn)
3779{
3780 size_t idx = bc_program_index(code, bgn);
3781 char* s;
3782
1/*
2 * *****************************************************************************
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 *
6 * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 3766 unchanged lines hidden (view full) ---

3775
3776static void
3777bc_program_printStr(const BcProgram* p, const char* restrict code,
3778 size_t* restrict bgn)
3779{
3780 size_t idx = bc_program_index(code, bgn);
3781 char* s;
3782
3783 s = *((char**) bc_vec_item(p->strs, idx));
3783 s = *((char**) bc_vec_item(&p->strs, idx));
3784
3785 bc_vm_printf(" (\"%s\") ", s);
3786}
3787
3788void
3789bc_program_printInst(const BcProgram* p, const char* restrict code,
3790 size_t* restrict bgn)
3791{

--- 6 unchanged lines hidden (view full) ---

3798 inst == BC_INST_ARRAY)
3799 {
3800 bc_program_printIndex(code, bgn);
3801 }
3802 else if (inst == BC_INST_STR) bc_program_printStr(p, code, bgn);
3803 else if (inst == BC_INST_NUM)
3804 {
3805 size_t idx = bc_program_index(code, bgn);
3784
3785 bc_vm_printf(" (\"%s\") ", s);
3786}
3787
3788void
3789bc_program_printInst(const BcProgram* p, const char* restrict code,
3790 size_t* restrict bgn)
3791{

--- 6 unchanged lines hidden (view full) ---

3798 inst == BC_INST_ARRAY)
3799 {
3800 bc_program_printIndex(code, bgn);
3801 }
3802 else if (inst == BC_INST_STR) bc_program_printStr(p, code, bgn);
3803 else if (inst == BC_INST_NUM)
3804 {
3805 size_t idx = bc_program_index(code, bgn);
3806 BcConst* c = bc_vec_item(p->consts, idx);
3806 BcConst* c = bc_vec_item(&p->consts, idx);
3807 bc_vm_printf("(%s)", c->val);
3808 }
3809 else if (inst == BC_INST_CALL ||
3810 (inst > BC_INST_STR && inst <= BC_INST_JUMP_ZERO))
3811 {
3812 bc_program_printIndex(code, bgn);
3813 if (inst == BC_INST_CALL) bc_program_printIndex(code, bgn);
3814 }

--- 30 unchanged lines hidden ---
3807 bc_vm_printf("(%s)", c->val);
3808 }
3809 else if (inst == BC_INST_CALL ||
3810 (inst > BC_INST_STR && inst <= BC_INST_JUMP_ZERO))
3811 {
3812 bc_program_printIndex(code, bgn);
3813 if (inst == BC_INST_CALL) bc_program_printIndex(code, bgn);
3814 }

--- 30 unchanged lines hidden ---