aaeb01e518
- Rewrite apps/nexus with modular architecture: Config, Http, Errors, Parser, Router, Handlers, Server, Main - Use algebraic enums for ParseResult/FileResult/HttpError - Thread-pool server via Channel<ConnectionTask> and spawn - Fix C backend type ordering for generic struct instances (Array_T, Iter_T) and algebraic enum struct payloads - Collect Slice_T types from struct fields and enum payloads - Fix match lowering for simple enums (direct value compare) - Resolve match expression return type from first arm - Infer element type for for-in over Array<UserStruct> - Preserve generic type args in field access resolution - Add fflush to PrintLine/Print for immediate server logs - Add modern_features golden regression test - Regenerate golden expected.c files
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/* Bux Standard Library - I/O functions */
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
/* PrintLine - print string with newline */
|
|
void PrintLine(const char* s) {
|
|
if (s != NULL) {
|
|
puts(s);
|
|
} else {
|
|
puts("");
|
|
}
|
|
fflush(stdout);
|
|
}
|
|
|
|
/* Print - print string without newline */
|
|
void Print(const char* s) {
|
|
if (s != NULL) {
|
|
printf("%s", s);
|
|
}
|
|
fflush(stdout);
|
|
}
|
|
|
|
/* PrintInt - print integer */
|
|
void PrintInt(int n) {
|
|
printf("%d", n);
|
|
}
|
|
|
|
/* PrintInt64 - print 64-bit integer */
|
|
void PrintInt64(int64_t n) {
|
|
printf("%lld", (long long)n);
|
|
}
|
|
|
|
/* PrintFloat - print float */
|
|
void PrintFloat(double f) {
|
|
printf("%g", f);
|
|
}
|
|
|
|
/* PrintBool - print boolean */
|
|
void PrintBool(int b) {
|
|
printf("%s", b ? "true" : "false");
|
|
}
|
|
|
|
/* ReadLine - read line from stdin (simplified) */
|
|
const char* ReadLine(void) {
|
|
static char buffer[1024];
|
|
if (fgets(buffer, sizeof(buffer), stdin) != NULL) {
|
|
size_t len = strlen(buffer);
|
|
if (len > 0 && buffer[len-1] == '\n') {
|
|
buffer[len-1] = '\0';
|
|
}
|
|
return buffer;
|
|
}
|
|
return "";
|
|
}
|