1
0
Fork 0
forked from fun/fun

Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0)

This commit is contained in:
Johannes Findeisen 2026-03-18 20:52:00 +01:00
commit 03b2532474
237 changed files with 17550 additions and 13911 deletions

View file

@ -1,5 +1,5 @@
/*
* This file is part of the Fun programming language.
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
@ -7,25 +7,25 @@
* https://opensource.org/license/apache-2-0
*/
/**
/**
* Implements OP_ECHO: print top-of-stack value without trailing newline.
* Now stores the value into the VM's output buffer and marks it as partial,
* so the CLI can render echo output together with following print output.
*/
case OP_ECHO: {
Value v = pop_value(vm);
Value snap = deep_copy_value(&v);
free_value(v);
if (vm->output_count < OUTPUT_SIZE) {
int idx = vm->output_count;
vm->output[idx] = snap;
vm->output_is_partial[idx] = 1; // ECHO does not end the line
vm->output_count++;
} else {
free_value(snap);
fprintf(stderr, "Runtime error: output buffer overflow\n");
exit(1);
}
break;
Value v = pop_value(vm);
Value snap = deep_copy_value(&v);
free_value(v);
if (vm->output_count < OUTPUT_SIZE) {
int idx = vm->output_count;
vm->output[idx] = snap;
vm->output_is_partial[idx] = 1; // ECHO does not end the line
vm->output_count++;
} else {
free_value(snap);
fprintf(stderr, "Runtime error: output buffer overflow\n");
exit(1);
}
break;
}