Commit Graph

422 Commits

Author SHA1 Message Date
Kartik K. Agaram
b78634acc7 588
Now that there isn't a stdout channel we can postpone the test showing
the need to flush-stdout before clearing screen.
2015-01-18 01:34:25 -08:00
Kartik K. Agaram
33d602db6c 582 - first tests for printing to screen 2015-01-17 18:50:32 -08:00
Kartik K. Agaram
e047981d39 580 2015-01-17 17:08:09 -08:00
Kartik K. Agaram
4b62edd8a6 578 - switch to non-polymorphic 'print' functions
Also clean up various prints from last few commits.
As a convention, for debugging we always print directly to host.
2015-01-17 17:00:44 -08:00
Kartik K. Agaram
7990aea904 577 - bounds-check on per-routine space
I discovered the problem when playing more than 3 moves in the
chessboard app.

But it turns out we've been clobbering each other willy-nilly even in
the chessboard-retro app.
2015-01-17 16:15:25 -08:00
Kartik K. Agaram
877b4fae04 576 - helper for printing integers
This requires creating a new data structure called buffer, because
strings are too inefficient for appending to, and we need to know how
long they need to be before we clear them.

But I'm not gonna bother to write tests for all the new primitives I
just introduced, because that's not expedient.

One test for mu is how nicely it handles situations like this without
requiring perfect test hygiene. In this case, I can imagine tools that
will extract tests for a particular function out of all known tests.
Especially if it's a pure function that should be easy. Then just show
each test to the programmer and ask him to give it a reasonable name.
2015-01-17 15:41:24 -08:00
Kartik K. Agaram
a1e8f8d8b4 575
Minimize use of 'unless' forms, they're harder to follow.

Also, using one-sided checks like greater-or-equal or lesser-or-equal is
more defensive.
2015-01-17 13:29:43 -08:00
Kartik K. Agaram
cbecfe10f9 574 - printing string literals is a hack; hard-code it in for now 2015-01-16 16:35:08 -08:00
Kartik K. Agaram
0d2c3387c5 571 - screen primitives take an explicit terminal
This will let me swap in a fake in tests.

Still hacky, though. I'm sure I'm not managing the parameter right in
the chessboard app.

And then there's the question of whether it should also appear as an
output operand.

But it's a start. And using nil to mean 'real' is a reasonable
convention.

If I ever need to handle multiple screens perhaps we'll have to switch
to 1:literal/terminal and 2:literal/terminal, etc. But those are equally
easy to guard on.
2015-01-15 00:00:46 -08:00
Kartik K. Agaram
ec6364a034 570 - warn on potential name conflict 2015-01-14 22:29:16 -08:00
Kartik K. Agaram
20379e7883 569 - ah, the right way to do generic functions
Each clause creates its own default-space for local variables.

Now we can justify prepending bodies on every 'function' form.

Later we can optimize away the duplicate default-spaces.

Another cost: we can't mindlessly use 'next-input' anymore. Pity.
2015-01-14 22:10:47 -08:00
Kartik K. Agaram
7d91aa77ff 568 2015-01-14 21:27:03 -08:00
Kartik K. Agaram
036467ba6c 566 2015-01-14 20:43:23 -08:00
Kartik K. Agaram
ac29c6a10c 565
Reduce printing primitives before I start messing with fake versions.
2015-01-14 20:22:00 -08:00
Kartik K. Agaram
631d3b4e98 563 - check actual errors during move validation 2015-01-14 16:06:53 -08:00
Kartik K. Agaram
f4ac0599ac 559 2015-01-13 22:40:20 -08:00
Kartik K. Agaram
10c5eed0c3 554 - tedious to have to check for routine errors on every fork 2015-01-13 21:18:39 -08:00
Kartik K. Agaram
ea5b8c2364 550 - another bugfix, another pending test 2015-01-13 19:53:30 -08:00
Kartik K. Agaram
7ea584b892 549 - suppress prints in read-move
This is the sort of thing we want to make super easy.

But there's a bug at the moment: chessboard prints junk input at second move.
2015-01-13 19:38:53 -08:00
Kartik K. Agaram
02244ae240 545 - graphics mode is now called bringing up a window 2015-01-12 10:45:08 -08:00
Kartik K. Agaram
a1f2f61330 544 - text modes now called 'retro' & 'cursor'
Other options considered for 'retro':

'teletype': perhaps most accurate, but arcane
'chat': captures that you have to hit 'enter', but not the rendering
'wrap': captures the auto-wrap when printing text but not that you have
to hit 'enter' when typing
'text': useful as a synonym of 'chat' while conveying more information
in other meanings, but too generic, nobody will get it

Why do the input and output options have to be entangled like this?
2015-01-12 10:38:56 -08:00
Kartik K. Agaram
f72a25ef72 542
Tests for terminating when there's just helpers left.
2015-01-12 00:04:48 -08:00
Kartik K. Agaram
f1748ef347 541 2015-01-11 23:37:19 -08:00
Kartik K. Agaram
353cf5a40f 540 2015-01-11 23:36:10 -08:00
Kartik K. Agaram
89a42dcea7 539
Simpler to just always sleep, whether or not a character was received.
2015-01-11 23:02:11 -08:00
Kartik K. Agaram
dd5be871fa 538 - stdin app now responsive 2015-01-11 23:00:02 -08:00
Kartik K. Agaram
491f9d7eb2 537 2015-01-11 22:57:04 -08:00
Kartik K. Agaram
bfdfcf7426 536 - introduce a notion of helper routines
When all you have left to run are helper routines, end the simulation.
2015-01-11 22:55:35 -08:00
Kartik K. Agaram
337a099d35 535 - reading keyboard input from a channel
The problem is that once main exits it takes two characters at minimum
to truly quit: one to fill the buffer and another to overflow it and
trigger the deadlock detector.

Not the cleanest way to exit in the world either, death by deadlock.
2015-01-11 22:03:16 -08:00
Kartik K. Agaram
e19e782027 534 - this is how we test blocking channels
Time to write some tests for the chessboard app.
2015-01-11 18:47:53 -08:00
Kartik K. Agaram
171f14faea 533 2015-01-11 18:44:32 -08:00
Kartik K. Agaram
e9a5385bf2 532 2015-01-11 18:41:23 -08:00
Kartik K. Agaram
405a99708f 531 2015-01-10 13:54:21 -08:00
Kartik K. Agaram
8b00ce3f5d 530 2015-01-10 13:53:00 -08:00
Kartik K. Agaram
ea0d661bb7 529 - 'sleep' can now wait for a routine to complete 2015-01-10 13:49:16 -08:00
Kartik K. Agaram
9c2ed23956 528 2015-01-10 13:20:13 -08:00
Kartik K. Agaram
f1737674fc 527 2015-01-10 13:15:10 -08:00
Kartik K. Agaram
13d849ff79 526 2015-01-10 13:13:44 -08:00
Kartik K. Agaram
06606073e4 525 - 'fork' now returns a routine id 2015-01-10 13:10:23 -08:00
Kartik K. Agaram
163ede5294 523 - debugging aide: dump just one test a time 2015-01-10 12:47:59 -08:00
Kartik K. Agaram
d385a0c859 522 - another arg for 'fork'
Fork syntax is now: fork <function> [global space] [max cycle limit] args*
2015-01-10 12:47:22 -08:00
Kartik K. Agaram
7e84205e4e 521 - check 'sleep' syntax 2015-01-10 12:28:00 -08:00
Kartik K. Agaram
3cde61a2ab 517
Cleaner trace for 'convert-braces'.
2015-01-10 11:26:45 -08:00
Kartik K. Agaram
37682077b8 516
Cleanup trace a little.
2015-01-10 10:36:59 -08:00
Kartik K. Agaram
b1a645ba8d 515 - support time limits for threads
Disquieting that I can't make each of these five tests fail in
isolation. We have to fix them all at once.
2015-01-10 03:32:14 -08:00
Kartik K. Agaram
b5018f8315 513 2015-01-09 00:48:13 -08:00
Kartik K. Agaram
bc3c3618d4 511 - make 'sleep' clearer 2015-01-08 23:29:09 -08:00
Kartik K. Agaram
afadac25a4 505 - simplify tagged-value
I could swear there was an issue earlier where tagged-values had to
contain pointers for some core function. But I can't find it anymore.
Ok, assume we can store primitives in it and pointers only for
aggregates (and-records and arrays).
2015-01-05 23:57:19 -08:00
Kartik K. Agaram
08878e3b6a 504 - give up on graphics for now 2015-01-05 23:57:14 -08:00
Kartik K. Agaram
364c4d0432 503 - start of a solution for drawing pieces
Dog slow, though. Drawing the sprite for a single piece takes 12s or
30ms/pixel for 400 pixels. A third of that is the actual racket overhead
of drawing pixel by pixel, which would in itself be too much. We need
bitblts.

(Black queen pixels derived from http://www.wpclipart.com/recreation/games/chess/chess_set_1,
after scaling down to 40x40 and replacing external white pixels with
transparent ones in Gimp.)
2015-01-05 23:28:02 -08:00