1
0
Fork 0
forked from fun/fun
This commit is contained in:
Johannes Findeisen 2025-09-15 08:39:41 +02:00
commit 0e7fffcfe0
67 changed files with 154 additions and 65 deletions

14
src/vm_case_print.c Normal file
View file

@ -0,0 +1,14 @@
case OP_PRINT: {
Value v = pop_value(vm);
/* snapshot value at print time (deep copy arrays) */
Value snap = deep_copy_value(&v);
free_value(v);
if (vm->output_count < VM_OUTPUT_SIZE) {
vm->output[vm->output_count++] = snap; // store snapshot
} else {
free_value(snap); // prevent leak
fprintf(stderr, "Runtime error: output buffer overflow\n");
exit(1);
}
break;
}