Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
8b52566
typo
matthewhammer Mar 12, 2019
38bd231
more markdown comments
matthewhammer Mar 12, 2019
451ceb6
define messages to register and remove mostly-static entities
matthewhammer Mar 12, 2019
a57dac4
notes as comments, from today's team meeting
matthewhammer Mar 12, 2019
1587673
messages for registering truck types
matthewhammer Mar 12, 2019
632b13d
truck types table
matthewhammer Mar 12, 2019
1329349
create subdir for produce exchange, to create multiple small files, a…
matthewhammer Mar 12, 2019
91617fe
add a README file, with links to more information, and a to do list, …
matthewhammer Mar 12, 2019
c6a24e8
markdown
matthewhammer Mar 12, 2019
fbf78b7
markdown
matthewhammer Mar 12, 2019
51b7a46
markdown
matthewhammer Mar 12, 2019
8e9615c
markdown
matthewhammer Mar 12, 2019
deb4105
markdown
matthewhammer Mar 12, 2019
78b7171
markdown
matthewhammer Mar 12, 2019
8d24226
markdown
matthewhammer Mar 12, 2019
523e551
markdown
matthewhammer Mar 12, 2019
1bec37a
markdown
matthewhammer Mar 12, 2019
eef0921
produce exchange decomposition into smaller files; README mentions ea…
matthewhammer Mar 12, 2019
905afb2
markdown
matthewhammer Mar 12, 2019
f60a35c
markdown and comment fixes
matthewhammer Mar 12, 2019
9e8c8f1
markdown
matthewhammer Mar 12, 2019
3c4407d
markdown
matthewhammer Mar 12, 2019
8b0791f
markdown
matthewhammer Mar 12, 2019
49d56aa
markdown
matthewhammer Mar 12, 2019
e99824b
markdown
matthewhammer Mar 12, 2019
6cc487e
markdown
matthewhammer Mar 12, 2019
0acb1b6
markdown
matthewhammer Mar 12, 2019
7a45961
comments
matthewhammer Mar 12, 2019
3adb652
remove content moved to README.md
matthewhammer Mar 12, 2019
84f4f05
write ActorScript-based tests, eventually for CI
matthewhammer Mar 12, 2019
e146293
markdown
matthewhammer Mar 12, 2019
1951af4
markdown
matthewhammer Mar 12, 2019
a59f609
markdown
matthewhammer Mar 12, 2019
d3e5345
markdown
matthewhammer Mar 12, 2019
8a075aa
markdown
matthewhammer Mar 12, 2019
9770dc7
markdown
matthewhammer Mar 12, 2019
8332077
markdown
matthewhammer Mar 12, 2019
09b77d4
markdown
matthewhammer Mar 12, 2019
073ce08
markdown
matthewhammer Mar 12, 2019
8a3d73f
markdown
matthewhammer Mar 12, 2019
79763ea
markdown
matthewhammer Mar 12, 2019
ee23ad2
markdown
matthewhammer Mar 12, 2019
0a939f9
try to fix nix
matthewhammer Mar 12, 2019
0bb4485
use 'reserve' rather than 'order'
matthewhammer Mar 12, 2019
9b96d25
minor: comments
matthewhammer Mar 12, 2019
64075f2
no more 'orders'; use 'reservations'
matthewhammer Mar 12, 2019
b0b83d4
planning implementation of actor; use disjoint unions over maps (as t…
matthewhammer Mar 12, 2019
f241246
markdown
matthewhammer Mar 13, 2019
8a75c77
markdown
matthewhammer Mar 13, 2019
975a9b5
markdown
matthewhammer Mar 13, 2019
6a7bd14
markdown
matthewhammer Mar 13, 2019
8ae9bff
markdown
matthewhammer Mar 13, 2019
920eb53
markdown
matthewhammer Mar 13, 2019
fabc831
markdown
matthewhammer Mar 13, 2019
cb1fc2e
markdown
matthewhammer Mar 13, 2019
2995bd6
markdown
matthewhammer Mar 13, 2019
c2b0fb0
markdown
matthewhammer Mar 13, 2019
15d781e
markdown
matthewhammer Mar 13, 2019
aadfc50
rename and reorganize Produce Exchange; introduce 'Server' abstraction
matthewhammer Mar 13, 2019
2126732
markdown
matthewhammer Mar 13, 2019
6e79229
markdown
matthewhammer Mar 13, 2019
c173b77
PESS rather than PES
matthewhammer Mar 13, 2019
fd188ba
PESS rather than PES
matthewhammer Mar 13, 2019
9f6b8d3
fix broken links
matthewhammer Mar 13, 2019
026fed5
use the term 'test suite'
matthewhammer Mar 13, 2019
f11edb0
move all business logic into serverModel; serverActor is just a thin …
matthewhammer Mar 13, 2019
f52df80
workaround from Claudio
matthewhammer Mar 13, 2019
2b13adc
fix broken link
matthewhammer Mar 13, 2019
bac7366
lots of boilerplate code; still trying to be concise
matthewhammer Mar 13, 2019
82a59f2
lots of boilerplate code; still trying to be concise
matthewhammer Mar 13, 2019
bc9f129
markdown
matthewhammer Mar 13, 2019
ad60e0e
do region lookup correctly; strange no compiler error
matthewhammer Mar 13, 2019
1c576df
2D tries, and more server model implementation to use them
matthewhammer Mar 13, 2019
5aabe9e
notes about performance
matthewhammer Mar 13, 2019
b164a8e
design docs, testing plans, documenting future work
matthewhammer Mar 14, 2019
8d5d799
ideas for 'complex' query+update logic
matthewhammer Mar 14, 2019
ea47b2f
experiment in auto-generating docs for the standard library, from the…
matthewhammer Mar 14, 2019
441d1b8
avoid placing generated 'doc' files into github accidentally
matthewhammer Mar 14, 2019
b8420c0
Merge pull request #240 from dfinity-lab/doc-stdlib
matthewhammer Mar 14, 2019
f4020ef
update Makefile for doc generation
matthewhammer Mar 14, 2019
99f3c9e
closer to a workflow for generating stdlib docs
matthewhammer Mar 14, 2019
2f96670
markdown
matthewhammer Mar 14, 2019
4bc25a0
timestamp each autogenerated file
matthewhammer Mar 14, 2019
c638b4c
markdown
matthewhammer Mar 14, 2019
d80e2b1
markdown
matthewhammer Mar 14, 2019
623308b
markdown
matthewhammer Mar 14, 2019
6433d1a
markdown
matthewhammer Mar 14, 2019
64c56a5
markdown
matthewhammer Mar 14, 2019
08ac226
markdown
matthewhammer Mar 14, 2019
4945491
markdown
matthewhammer Mar 14, 2019
3f16b5c
markdown
matthewhammer Mar 14, 2019
20499c6
markdown
matthewhammer Mar 14, 2019
7d5f00a
markdown
matthewhammer Mar 14, 2019
3ce3bea
markdown
matthewhammer Mar 14, 2019
9c22bef
markdown
matthewhammer Mar 14, 2019
a5d1b1b
include actorscript listings in design docs
matthewhammer Mar 14, 2019
4ccee00
markdown
matthewhammer Mar 14, 2019
ff71b30
markdown
matthewhammer Mar 14, 2019
620a0bb
markdown
matthewhammer Mar 14, 2019
deba950
markdown
matthewhammer Mar 14, 2019
337d95b
improve auto-generated markdown script and its source files
matthewhammer Mar 14, 2019
cbfa1e7
markdown
matthewhammer Mar 14, 2019
6e9e995
markdown
matthewhammer Mar 14, 2019
1662228
markdown
matthewhammer Mar 14, 2019
647492e
markdown
matthewhammer Mar 14, 2019
33c9a9d
markdown
matthewhammer Mar 14, 2019
59dbc02
minor
matthewhammer Mar 14, 2019
bada39c
minor
matthewhammer Mar 15, 2019
b572c72
reorganize documentation of PE canister
matthewhammer Mar 15, 2019
b2b98f6
reorganize documentation of PE canister
matthewhammer Mar 15, 2019
39d154b
reorganize documentation of PE canister
matthewhammer Mar 15, 2019
5b62c1e
reorganize documentation of PE canister
matthewhammer Mar 16, 2019
98564cb
produce exchange skeletons...
matthewhammer Mar 18, 2019
61b6714
markdown
matthewhammer Mar 18, 2019
677032c
markdown
matthewhammer Mar 18, 2019
b31d6a8
markdown
matthewhammer Mar 18, 2019
e513a91
markdown
matthewhammer Mar 18, 2019
e4d445d
typos
matthewhammer Mar 18, 2019
187c9d8
typos
matthewhammer Mar 18, 2019
b2d4e84
fix broken links
matthewhammer Mar 18, 2019
e87b0c2
markdown
matthewhammer Mar 18, 2019
dfbf620
markdown
matthewhammer Mar 18, 2019
0482e6e
remove redundant api call
matthewhammer Mar 18, 2019
ba3c6e5
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
8ba1159
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
4410d28
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
beaaa3a
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
1b572cb
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
f788b6e
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
dc11a69
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
3d518b1
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
521cf55
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
48a4d46
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
f7429b7
document table abstraction, to simplify and shorten the produce excha…
matthewhammer Mar 19, 2019
3e44235
document table abstraction; lots of updates
matthewhammer Mar 19, 2019
b1cd90e
markdown docs
matthewhammer Mar 19, 2019
8eb60fb
markdown docs
matthewhammer Mar 19, 2019
06fe656
markdown docs
matthewhammer Mar 19, 2019
47acbdd
markdown docs
matthewhammer Mar 19, 2019
c2ca1f7
serverActor class is nearly defined
matthewhammer Mar 19, 2019
f3e70f2
remove old cruft
matthewhammer Mar 19, 2019
cd81d3c
classify each missing fun impl
matthewhammer Mar 19, 2019
55aa7a1
markdown typo
matthewhammer Mar 19, 2019
9915620
markdown typo
matthewhammer Mar 19, 2019
2cb57ed
markdown typo
matthewhammer Mar 19, 2019
8f48570
markdown link fixes
matthewhammer Mar 19, 2019
3daad11
toArray for tries; use in docTable
matthewhammer Mar 19, 2019
4b97d21
toArray for tries; use in docTable
matthewhammer Mar 19, 2019
b5902c1
minor; comments
matthewhammer Mar 19, 2019
29c1420
minor; expose helpers
matthewhammer Mar 19, 2019
6eb8d7d
more implementation of produce exchange back end framework
matthewhammer Mar 19, 2019
706486e
nits
matthewhammer Mar 19, 2019
c208499
wan typo
matthewhammer Mar 19, 2019
78454cf
remove verbage
matthewhammer Mar 19, 2019
f50a283
remove verbage
matthewhammer Mar 19, 2019
93ceb47
remove verbage
matthewhammer Mar 19, 2019
fd23140
remove verbage
matthewhammer Mar 19, 2019
811d40a
markdown
matthewhammer Mar 19, 2019
b81d01f
markdown
matthewhammer Mar 19, 2019
cae3f58
markdown
matthewhammer Mar 19, 2019
0ce9c18
minor
matthewhammer Mar 19, 2019
ead9309
minor
matthewhammer Mar 19, 2019
38d24e8
wrote view function in model; first of five
matthewhammer Mar 19, 2019
8b769f0
wrote view function in model; first of five
matthewhammer Mar 19, 2019
4bbc8f4
implement more server model operations
matthewhammer Mar 20, 2019
fddd93f
stdlib readme
matthewhammer Mar 20, 2019
03d0724
stdlib readme
matthewhammer Mar 20, 2019
943e62b
stdlib readme
matthewhammer Mar 20, 2019
2c64a7e
stdlib readme
matthewhammer Mar 20, 2019
5b03de3
markdown
matthewhammer Mar 20, 2019
e647c63
markdown
matthewhammer Mar 20, 2019
10b5ba3
line-by-line documentation
matthewhammer Mar 20, 2019
8dce0ae
line-by-line documentation
matthewhammer Mar 20, 2019
81acb29
more impl; draft of exit criteria
matthewhammer Mar 22, 2019
5591dc8
nits on exit criteria
matthewhammer Mar 22, 2019
314c168
nits on exit criteria
matthewhammer Mar 22, 2019
670c4c5
nits on exit criteria
matthewhammer Mar 22, 2019
74bd11b
getInventoryInfo message
matthewhammer Mar 22, 2019
aaf76ce
getInventoryInfo message
matthewhammer Mar 22, 2019
dddedbd
fix design issues; workaround actorscript language; thanks @paulyoung
matthewhammer Mar 25, 2019
d684282
markdown
matthewhammer Mar 25, 2019
f7c35af
run produce exchange in interpreter; fix dynamic def-use errors; add …
matthewhammer Mar 25, 2019
84b8f73
run produce exchange in interpreter; fix dynamic def-use errors; add …
matthewhammer Mar 25, 2019
1f79b11
fix typo; thanks @pualyoung
matthewhammer Mar 25, 2019
eda7d50
markdown; count joins
matthewhammer Mar 25, 2019
16871c6
markdown; links
matthewhammer Mar 25, 2019
fe3f06b
markdown; links
matthewhammer Mar 25, 2019
a12b714
markdown; links
matthewhammer Mar 26, 2019
2f3d035
unhide buildNewPath
matthewhammer Mar 26, 2019
9a1ff55
unhide buildNewPath
matthewhammer Mar 26, 2019
c7b2693
Merge remote-tracking branch 'origin/master' into paulyoung/stdlib-ex…
paulyoung Mar 28, 2019
c81e325
Change Server class to actor
paulyoung Mar 28, 2019
5a889d7
finish simple setup and query test; seems to work
matthewhammer Mar 28, 2019
3df61fc
bug fix
matthewhammer Mar 28, 2019
b90aa17
markdown fix
matthewhammer Mar 29, 2019
a66fae9
Merge pull request #280 from dfinity-lab/paulyoung/stdlib-examples
matthewhammer Apr 1, 2019
f2ac186
fix test script by naming the Server actor
matthewhammer Apr 2, 2019
288bfc3
Build stdlibs docs via nix on Hydra
nomeata Apr 2, 2019
6fd9996
Hide auto-generation warning from HTML output
nomeata Apr 2, 2019
ac77919
Merge pull request #286 from dfinity-lab/joachim/stdlib-docs-hydra
matthewhammer Apr 2, 2019
819ca26
start the stdlib hash module
matthewhammer Apr 2, 2019
9a9efab
represent hashes as bit vectors
matthewhammer Apr 2, 2019
3da75fb
Merge branch 'stdlib-examples' of github.com:dfinity-lab/actorscript …
matthewhammer Apr 2, 2019
c7d0ad5
WIP: hash and trie module
matthewhammer Apr 4, 2019
ceaaa5c
hash functions; finding bugs in compiler
matthewhammer Apr 4, 2019
2bd23c7
trying to mimimize the usedef bug... not successfully
matthewhammer Apr 4, 2019
e2ece96
missing file
matthewhammer Apr 4, 2019
73b60b0
disable VT100 stuff from stdlib Makefile
matthewhammer Apr 4, 2019
76a201c
add swiss table URL
matthewhammer Apr 4, 2019
d4ae86c
reorder defs (fix error); some WIP in comments
matthewhammer Apr 8, 2019
36cd783
commit half-done work, commented out; getting ready to merge with master
matthewhammer Apr 9, 2019
5cef136
Merge branch 'master' into stdlib-examples
matthewhammer Apr 9, 2019
f28b516
fix (newly surfaced) use-def errors throughout
matthewhammer Apr 9, 2019
0e81118
hashIntAcc: comment out; prepare to move hasing into stdlib
matthewhammer Apr 9, 2019
0269a07
fix nix derivation wrt produce exchange
matthewhammer Apr 9, 2019
ae2be5a
rename Trie operation: conj ~> join
matthewhammer Apr 9, 2019
02177c7
remove generated .md files from source repo
matthewhammer Apr 9, 2019
621df57
SDK-90 Compile the Produce Exchange as part of CI
paulyoung Apr 9, 2019
47cd3a2
implement producerRemInventory; still needs testing
matthewhammer Apr 9, 2019
366b6f8
Merge pull request #297 from dfinity-lab/paulyoung/compile-produce-ex…
matthewhammer Apr 9, 2019
75cdfd7
fix typo in Makefile
matthewhammer Apr 9, 2019
e542e39
impossible ~> unreachable
matthewhammer Apr 9, 2019
b8390e5
nit: always use tabs in Makefiles; the Makefile gods deem it so
matthewhammer Apr 9, 2019
f77e1c2
the AS/backend side of SDK-100
matthewhammer Apr 10, 2019
293603a
allUserInfo
matthewhammer Apr 10, 2019
04a80e6
Merge pull request #298 from dfinity-lab/matthew/registrarAddUser
matthewhammer Apr 10, 2019
15f0a85
nit
matthewhammer Apr 10, 2019
9d6fd15
producerUpdateInventory
matthewhammer Apr 10, 2019
f6745ea
Merge branch 'stdlib-examples' of github.com:dfinity-lab/actorscript …
matthewhammer Apr 10, 2019
6c6e8b5
sanity tests for producerRemInventory and producerUpdateInventory; on…
matthewhammer Apr 10, 2019
837ffce
minor: inventory updates in test actually change things
matthewhammer Apr 10, 2019
c7bb856
nyi means 'not yet implemented'
matthewhammer Apr 10, 2019
8c78ee9
Add getUserInfo
paulyoung Apr 10, 2019
9ba5146
Merge pull request #299 from dfinity-lab/paulyoung/produce-exchange-g…
matthewhammer Apr 11, 2019
55e5d0d
doc URLs refer to hydra, not github
matthewhammer Apr 11, 2019
0dfd948
minor Makefile cleanup
matthewhammer Apr 11, 2019
a8b14f4
Merge pull request #301 from dfinity-lab/matthew/docs-via-hydra
matthewhammer Apr 11, 2019
dce7d5f
minor: markdown
matthewhammer Apr 11, 2019
c9dd4ba
Add nix derivation for compiling Produce Exchange
paulyoung Apr 11, 2019
ff6688d
doc: clean up documentation of List module
matthewhammer Apr 11, 2019
16f12b4
Merge pull request #303 from dfinity-lab/paulyoung/produce-exchange-nix
paulyoung Apr 11, 2019
bb8eb23
addUser accepts a username; saves mapping; rejects duplicates
matthewhammer Apr 11, 2019
88f350e
apply review feedback from @FloorLamp and @paulyoung
matthewhammer Apr 11, 2019
8025d57
oops; fix minor bug that I introduced earlier
matthewhammer Apr 11, 2019
8dd74bf
Merge pull request #304 from dfinity-lab/matthew/px-username
matthewhammer Apr 11, 2019
5a0d952
Merge remote-tracking branch 'origin' into stdlib-examples
matthewhammer Apr 12, 2019
4a3cc25
PX test prints PX state, and full query results
matthewhammer Apr 12, 2019
6d7dbec
Merge branch 'joachim/bump-nixpkgs' into stdlib-examples
nomeata Apr 14, 2019
570068f
Merge remote-tracking branch 'origin' into stdlib-examples
matthewhammer Apr 14, 2019
7b002e4
do review comments from @nomeata
matthewhammer Apr 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ charlie.go("charlie", server);

## Syntax

See [here](design/Syntax.md).
See [here](design/Syntax.html).


## Semantics
Expand All @@ -382,4 +382,4 @@ TODO...

## Implementation

See [here](design/Implementation.md)
See [here](design/Implementation.html)
64 changes: 60 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ let
"stdlib/.*.as"
"stdlib/examples/"
"stdlib/examples/.*.as"
"stdlib/examples/produce-exchange/"
"stdlib/examples/produce-exchange/.*.as"
"stdlib/examples/produce-exchange/test/"
"stdlib/examples/produce-exchange/test/.*.as"
];
stdlib_doc_files = [
"stdlib/.*\.py"
"stdlib/README.md"
"stdlib/examples/produce-exchange/README.md"
];

in
Expand Down Expand Up @@ -120,8 +129,7 @@ rec {

src = sourceByRegex ./. (
test_files ++
samples_files ++
stdlib_files
samples_files
);

buildInputs =
Expand All @@ -137,7 +145,6 @@ rec {
buildPhase = ''
patchShebangs .
asc --version
make -C stdlib ASC=asc all
make -C samples ASC=asc all
'' +
(if test-dvm
Expand Down Expand Up @@ -226,8 +233,57 @@ rec {
[ { name = "bin/FileCheck"; path = "${nixpkgs.llvm}/bin/FileCheck";} ];
wabt = nixpkgs.wabt;

stdlib-reference = stdenv.mkDerivation {
name = "stdlib-reference";

src = sourceByRegex ./. (
stdlib_files ++
stdlib_doc_files
) + "/stdlib";

buildInputs = with nixpkgs;
[ pandoc bash python ];

buildPhase = ''
patchShebangs .
make alldoc
'';

installPhase = ''
mkdir -p $out
mv doc $out/
mkdir -p $out/nix-support
echo "report docs $out/doc README.html" >> $out/nix-support/hydra-build-products
'';

forceShare = ["man"];
};

produce-exchange = stdenv.mkDerivation {
name = "produce-exchange";
src = sourceByRegex ./. (
stdlib_files
);

buildInputs = [
native
];

doCheck = true;
buildPhase = ''
make -C stdlib ASC=asc OUTDIR=_out _out/ProduceExchange.wasm
'';
checkPhase = ''
make -C stdlib ASC=asc OUTDIR=_out _out/ProduceExchange.out
'';
installPhase = ''
mkdir -p $out
cp stdlib/_out/ProduceExchange.wasm $out
'';
};

all-systems-go = nixpkgs.releaseTools.aggregate {
name = "all-systems-go";
constituents = [ native js native_test coverage-report ];
constituents = [ native js native_test coverage-report stdlib-reference produce-exchange ];
};
}
1 change: 0 additions & 1 deletion src/prelude.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func print(x : Text) { (prim "print" : Text -> ()) x };
// Hashing
func hashInt(n : Int) : Word32 = (prim "Int~hash" : Int -> Word32) n;


// Conversions
func natToWord8(n : Nat) : Word8 = (prim "Nat->Word8" : Nat -> Word8) n;
func word8ToNat(n : Word8) : Nat = (prim "Word8->Nat" : Word8 -> Nat) n;
Expand Down
1 change: 1 addition & 0 deletions stdlib/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
_out
doc
171 changes: 104 additions & 67 deletions stdlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,117 +1,154 @@
ASC=../src/asc
OUTDIR=_out

## VT100 stuff
HRULE="\x1b[2;34m----------------------------------------------------------------\x1b[0m"
MODULE_NAME="\x1b[1;32mModule:\x1b[1;34m"
BEGIN="\x1b[0;1mBegin...\x1b[0m"
DONE="\x1b[1mDone.\n"$(HRULE)
MODULE_NAME_COLOR="\x1b[0;1;34m"
NO_COLOR="\x1b[0m"
DOCDIR=doc
MDofAS=./markdown-of-actorscript.py
MDofMD=./markdown-of-markdown.py
PANDOC=pandoc

# Add new module targets here:
MODULES=\
Hash \
List \
ListTest \
AssocList \
Trie \
DocTable \
Set \
SetDb \
SetDbTest \
ProduceExchange \

WASM=\
ProduceExchange

OUTFILES=$(addsuffix .out, $(MODULES))
OUTFILES=$(addsuffix .out, $(MODULES)) $(addsuffix .wasm, $(WASM))

OUTPATHS=$(addprefix $(OUTDIR)/, $(OUTFILES))

.PHONY: default all clean startmsg
.PHONY: default all clean alltests alldoc docMd docHtml

default: all

startmsg:
@echo Begin build: $(MODULE_NAME_COLOR)$(MODULES)$(NO_COLOR)...
docmsg:
@echo Begin building documentation in \`$(DOCDIR)\`...
@echo $(HRULE)

all: $(OUTDIR) startmsg $(OUTPATHS)
@echo Build done : $(MODULE_NAME_COLOR)$(MODULES)$(NO_COLOR)
alltests: $(OUTDIR) $(OUTPATHS)

all: alltests alldoc

alldoc: docMd docHtml

# Markdown documentation, extracted from the source directory
docMd: \
$(DOCDIR)/README.md \
$(DOCDIR)/prelude.md \
$(DOCDIR)/hash.md \
$(DOCDIR)/list.md \
$(DOCDIR)/assocList.md \
$(DOCDIR)/trie.md \
$(DOCDIR)/docTable.md \
$(DOCDIR)/set.md \
$(DOCDIR)/setDb.md \
$(DOCDIR)/setDbTest.md \
$(DOCDIR)/examples/produce-exchange/README.md \
$(DOCDIR)/examples/produce-exchange/serverTypes.md \
$(DOCDIR)/examples/produce-exchange/serverActor.md \
$(DOCDIR)/examples/produce-exchange/serverModelTypes.md \
$(DOCDIR)/examples/produce-exchange/serverModel.md \
| \
$(DOCDIR)/ \
$(DOCDIR)/examples/produce-exchange/

# HTML documentation, extracted from the source directory
docHtml: \
$(DOCDIR)/README.html \
$(DOCDIR)/prelude.html \
$(DOCDIR)/hash.html \
$(DOCDIR)/list.html \
$(DOCDIR)/assocList.html \
$(DOCDIR)/trie.html \
$(DOCDIR)/docTable.html \
$(DOCDIR)/set.html \
$(DOCDIR)/setDb.html \
$(DOCDIR)/setDbTest.html \
$(DOCDIR)/examples/produce-exchange/README.html \
$(DOCDIR)/examples/produce-exchange/serverTypes.html \
$(DOCDIR)/examples/produce-exchange/serverActor.html \
$(DOCDIR)/examples/produce-exchange/serverModelTypes.html \
$(DOCDIR)/examples/produce-exchange/serverModel.html \
| \
$(DOCDIR)/ \
$(DOCDIR)/examples/produce-exchange/

clean:
rm -rf $(OUTDIR)
rm -rf $(OUTDIR) $(DOCDIR)

$(OUTDIR):
@mkdir $(OUTDIR)
@mkdir $@

$(DOCDIR):
mkdir $@

$(OUTDIR)/List.out: $(OUTDIR) list.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)
$(DOCDIR)/README.md: README.md | $(DOCDIR)
@echo "<!-- **[ DO NOT EDIT -- GENERATED by a Makefile, on `date` ]** -->" > $@
@echo "" >> $@
$(MDofMD) $< >> $@

$(OUTDIR)/ListTest.out: $(OUTDIR) list.as listTest.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)
$(DOCDIR)/examples/produce-exchange/: README.md
@mkdir -p $@

$(OUTDIR)/AssocList.out: $(OUTDIR) list.as assocList.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)
$(DOCDIR)/examples/produce-exchange/README.md: examples/produce-exchange/README.md | $(DOCDIR)/examples/produce-exchange/
@echo "<!-- **[ DO NOT EDIT -- GENERATED by a Makefile, on `date` ]** -->" > $@
@echo "" >> $@
$(MDofMD) $< >> $@

$(OUTDIR)/Trie.out: $(OUTDIR) list.as assocList.as trie.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(OUTDIR)/Hash.out: prelude.as hash.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)

$(OUTDIR)/Set.out: $(OUTDIR) list.as assocList.as trie.as set.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(OUTDIR)/List.out: prelude.as list.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)

$(OUTDIR)/SetDb.out: $(OUTDIR) list.as assocList.as trie.as set.as setDb.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(OUTDIR)/ListTest.out: prelude.as list.as listTest.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)

$(OUTDIR)/SetDbTest.out: $(OUTDIR) list.as assocList.as trie.as set.as setDb.as setDbTest.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(OUTDIR)/AssocList.out: prelude.as list.as assocList.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)

$(OUTDIR)/ProduceExchange.out: $(OUTDIR) list.as assocList.as trie.as examples/produceExchange.as
@echo $(MODULE_NAME) $(basename $(notdir $@))
@echo $(BEGIN)
$(OUTDIR)/Trie.out: prelude.as hash.as list.as assocList.as trie.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@
@echo $(DONE)


#########################################################################################
# TODO(Matthew): Figure out why this "compressed" version of the rules doesn't work.
$(OUTDIR)/DocTable.out: prelude.as hash.as list.as assocList.as trie.as docTable.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@

# $(OUTDIR)/List.out: $(OUTDIR) list.as ; @$(doModule)
$(OUTDIR)/Set.out: prelude.as hash.as list.as assocList.as trie.as set.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@

# $(OUTDIR)/ListTest.out: $(OUTDIR) list.as listTest.as ; @$(doModule)
$(OUTDIR)/SetDb.out: prelude.as hash.as list.as assocList.as trie.as set.as setDb.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@

# $(OUTDIR)/Trie.out: $(OUTDIR) list.as trie.as ; @$(doModule)
$(OUTDIR)/SetDbTest.out: prelude.as hash.as list.as assocList.as trie.as set.as setDb.as setDbTest.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@

# $(OUTDIR)/Set.out: $(OUTDIR) list.as trie.as set.as ; @$(doModule)
PRODUCE_EXCHANGE_SRC=\
prelude.as hash.as list.as assocList.as trie.as docTable.as \
examples/produce-exchange/serverTypes.as \
examples/produce-exchange/serverModelTypes.as \
examples/produce-exchange/serverModel.as \
examples/produce-exchange/serverActor.as \

# $(OUTDIR)/SetDb.out: $(OUTDIR) list.as trie.as set.as setDb.as ; @$(doModule)
$(OUTDIR)/ProduceExchange.out: $(PRODUCE_EXCHANGE_SRC) \
examples/produce-exchange/test/simpleSetupAndQuery.as | $(OUTDIR)
$(ASC) -r $(filter-out $(OUTDIR), $^) > $@

# $(OUTDIR)/SetDbTest.out: $(OUTDIR) list.as trie.as set.as setDb.as setDbTest.as ; @$(doModule)
$(OUTDIR)/ProduceExchange.wasm: $(PRODUCE_EXCHANGE_SRC) | $(OUTDIR)
$(ASC) -c --dfinity -o $@ $(filter-out $(OUTDIR), $^)

# $(OUTDIR)/ProduceExchange.out: $(OUTDIR) list.as trie.as produceExchange.as ; @$(doModule)
$(DOCDIR)/%.md: %.as $(MDofAS) | $(DOCDIR)
@echo "<!-- **[ Do not edit; This file was machine-generated on `date`. ]** -->" > $@
@echo "" >> $@
@echo "" >> $@
$(MDofAS) $< >> $@

# define doModule =
# @echo $(MODULE_NAME) $(basename $(notdir $@))
# @echo $(BEGIN)
# $(ASC) -r $(filter-out $(OUTDIR), $^) > $@
# @echo $(DONE)
# endef
$(DOCDIR)/%.html: $(DOCDIR)/%.md
$(PANDOC) -f gfm $^ > $@
Loading