From 6e33a8c2f94598b13a2e1ce9fdf91124b5c59a71 Mon Sep 17 00:00:00 2001 From: hellerve Date: Mon, 22 Oct 2018 17:47:40 -0400 Subject: [PATCH] core: add IO.errorln and IO.error --- core/IO.carp | 4 ++++ core/carp_io.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/core/IO.carp b/core/IO.carp index c8f027b5..e0771050 100644 --- a/core/IO.carp +++ b/core/IO.carp @@ -7,6 +7,10 @@ (register println (Fn [(Ref String)] ())) (doc print "prints a string ref to stdout, does not append a newline.") (register print (Fn [(Ref String)] ())) + (doc errorln "prints a string ref to stderr, appends a newline.") + (register errorln (Fn [(Ref String)] ())) + (doc error "prints a string ref to stderr, does not append a newline.") + (register print (Fn [(Ref String)] ())) (doc get-line "gets a line from stdin.") (register get-line (Fn [] String)) (doc get-char "gets a character from stdin.") diff --git a/core/carp_io.h b/core/carp_io.h index 1e579232..53cf3ca0 100644 --- a/core/carp_io.h +++ b/core/carp_io.h @@ -6,6 +6,9 @@ void IO_println(String *s) { puts(*s); } void IO_print(String *s) { printf("%s", *s); } +void IO_errorln(String *s) { fprintf(stderr, "%s\n", *s); } +void IO_error(String *s) { fprintf(stderr, "%s", *s); } + char IO_EOF = (char) EOF; #ifndef _WIN32