added #import, broke demo into two files
[fleet.git] / demo.fleet
1 #include "demo.ships"
2
3 // NOTE: "accept" is a synonym for "move" it is less confusing in the case
4 //       of inboxes, but is otherwise identical
5
6 //////////////////////////////////////////////////////////////////////////////
7 // The following three instructions simply produce one hundred "3"s
8 // and put them into fifo "a".  Ignore the switch-fabric clogging
9 // issue here; this is just setup for the rest of the code.
10
11                  3                -> helper.in
12             copy helper.out  -[10]-> source.in
13          discard helper.out       -> ()
14
15
16 //////////////////////////////////////////////////////////////////////////////
17 // set up a counting move of 10 items from source.out to dest.in, but require
18 // flow control tokens (10 items is too many to send at once)
19
20  triggered move  source.out -[10]-> dest.in
21
22
23 //////////////////////////////////////////////////////////////////////////////
24 // The next instruction tears down the "default" standing move on dest.in
25 // and uses the resulting tokens to prime source.out's pump.  Once that
26 // has been kicked off, any subsequent incoming items will generate tokens
27 // which are sent back to the source outbox
28
29           nop+ack dest.in     -[3]-> source.out
30        accept+ack dest.in     -[7]-> source.out
31        accept     dest.in     -[3]-> source.out
32           nop+ack dest.in         -> fetch.release    // then release the fetch
33            accept dest.in     -[*]-> ()               // and return the fabric to normal
34
35 { tokensource.out -> halt.in }    -> fetch.codebag    // termination codebag
36
37
38