From aa6ed1d04e1a2d02c4a347583aa7d068c248391b Mon Sep 17 00:00:00 2001 From: rabix Date: Fri, 7 Jun 2024 09:31:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=206.0s1.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 6.0s1.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/6.0s1.h b/6.0s1.h index fe1ff54..597d5fc 100644 --- a/6.0s1.h +++ b/6.0s1.h @@ -27,6 +27,12 @@ void s1_assert(int value, const char *reason, struct s1_location loc) { } } +void s1_trace(const char *text, struct s1_location loc) { + fprintf(stderr, "Trace: %s:%d: %s\n", loc.file, loc.line, text); +} + + +#define s1_trace(text) s1_trace(text, S1_LOC()) // 2. simple IO @@ -41,7 +47,7 @@ void write_long(S1_LONG value, struct s1_location loc) { } void write_double(S1_DOUBLE value, struct s1_location loc) { - int rc = printf("%f", value); + int rc = printf("%lf", value); s1_assert(rc != EOF, "Error: write_long", loc); }