更新 6.0s1.h
This commit is contained in:
parent
e6a7546f3e
commit
aa6ed1d04e
8
6.0s1.h
8
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
|
// 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) {
|
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);
|
s1_assert(rc != EOF, "Error: write_long", loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue