refactor: migrate examples to import Std::Io instead of raw extern func

- Create stdlib/Std/Io.bux with extern func declarations
- Rename C shim functions to short names (PrintLine, PrintInt, etc.)
- Update all 9 examples to use import Std::Io::{PrintLine, PrintInt};
- Remove manual extern func Std_Io_* declarations from examples
This commit is contained in:
2026-05-31 02:01:28 +03:00
parent c7114c0538
commit 92c5cd59f5
11 changed files with 84 additions and 74 deletions
+6 -6
View File
@@ -5,7 +5,7 @@
#include <string.h>
/* PrintLine - print string with newline */
void Std_Io_PrintLine(const char* s) {
void PrintLine(const char* s) {
if (s != NULL) {
puts(s);
} else {
@@ -14,29 +14,29 @@ void Std_Io_PrintLine(const char* s) {
}
/* Print - print string without newline */
void Std_Io_Print(const char* s) {
void Print(const char* s) {
if (s != NULL) {
printf("%s", s);
}
}
/* PrintInt - print integer */
void Std_Io_PrintInt(int64_t n) {
void PrintInt(int64_t n) {
printf("%lld", (long long)n);
}
/* PrintFloat - print float */
void Std_Io_PrintFloat(double f) {
void PrintFloat(double f) {
printf("%g", f);
}
/* PrintBool - print boolean */
void Std_Io_PrintBool(int b) {
void PrintBool(int b) {
printf("%s", b ? "true" : "false");
}
/* ReadLine - read line from stdin (simplified) */
const char* Std_Io_ReadLine(void) {
const char* ReadLine(void) {
static char buffer[1024];
if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
size_t len = strlen(buffer);