projects
/
kaleidoscope-hs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f7ddcab
)
<s>Start the standard library
author
Luke Lau
<luke_lau@icloud.com>
Sat, 9 Nov 2019 17:51:23 +0000
(17:51 +0000)
committer
Luke Lau
<luke_lau@icloud.com>
Sat, 9 Nov 2019 17:53:17 +0000
(17:53 +0000)
Our standard library so far is just going to contain a single function
that acts as a version of putchar(3), except it operates on doubles.
We'll also flush stdout so that we can immediately see what we've
printed when we're inside the repl.
stdlib.c
[new file with mode: 0644]
patch
|
blob
diff --git a/stdlib.c
b/stdlib.c
new file mode 100644
(file)
index 0000000..
9749ee3
--- /dev/null
+++ b/
stdlib.c
@@ -0,0
+1,7
@@
+#include <stdio.h>
+// Takes a double and writes it to stdout
+double putchard(double x) {
+ int res = putchar((int)x);
+ fflush(stdout);
+ return (double)res;
+}