From 185623be46dfd9a60e5a021259a6c7778cfb07cd Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 2 Feb 2017 22:29:41 +0100 Subject: Parse and typecheck casts --- nl/mandel.nl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nl') diff --git a/nl/mandel.nl b/nl/mandel.nl index cef9eb2..2bdc25b 100644 --- a/nl/mandel.nl +++ b/nl/mandel.nl @@ -3,6 +3,7 @@ type char = i8; type string = ptr(char); extern func void(int) putchar; +extern func u64(string) strlen; void printnum(int n) { if (n < 0) { @@ -53,12 +54,16 @@ int main() { hincr = 0.0625; vincr = 0.0625; + string shade = " .,-:!%@#"; + int shadelen = cast(int)(strlen(shade)); + double y = tbound; while (y >= bbound) { double x = lbound; while (x <= rbound) { int niter = mandeliter(x, y); - printnum(niter); + putchar(*(shade + niter*(shadelen-1)/maxiter)); + // printnum(niter); putchar(' '); x = x + hincr; } -- cgit v1.2.3-70-g09d2