about summary refs log tree commit diff stats
path: root/display.mu
Commit message (Expand)AuthorAgeFilesLines
* 4119Kartik K. Agaram2017-11-101-1/+1
* 3861 - screen untouched when entering console modeKartik K. Agaram2017-05-181-1/+2
* 3380Kartik K. Agaram2016-09-171-1/+1
* 2735 - define recipes using 'def'Kartik K. Agaram2016-03-081-1/+1
* 2095Kartik K. Agaram2015-08-281-1/+0
* 1868 - start using naked literals everywhereKartik K. Agaram2015-07-281-4/+4
* 1705 - change background colorKartik K. Agaram2015-07-041-1/+1
* 1618Kartik K. Agaram2015-06-211-2/+3
* 1617Kartik K. Agaram2015-06-211-7/+7
* 1584Kartik K. Agaram2015-06-171-1/+1
* 1457 - print to display in colorKartik K. Agaram2015-05-251-1/+1
* 1363 - rename 'integer' to 'number'Kartik K. Agaram2015-05-131-1/+1
* 1345Kartik K. Agaram2015-05-111-1/+2
* 1276 - make C++ version the defaultKartik K. Agaram2015-05-051-0/+23
ace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
all: mu_bin core.mu

CXX ?= c++
CFLAGS ?= -g -O3

mu_bin: makefile mu.cc termbox/libtermbox.a
	${CXX} ${CFLAGS} -Wall -Wextra -fno-strict-aliasing mu.cc termbox/libtermbox.a -o mu_bin

# To see what the program looks like after all layers have been applied, read
# mu.cc
mu.cc: [0-9]*.cc enumerate/enumerate tangle/tangle
	./tangle/tangle $$(./enumerate/enumerate --until zzz |grep -v '.mu$$') > mu.cc
	make --no-print-directory autogenerated_lists

core.mu: [0-9]*.mu mu.cc
	cat $$(./enumerate/enumerate --until zzz |grep '.mu$$') > core.mu

enumerate/enumerate:
	cd enumerate && make

tangle/tangle:
	cd tangle && make && ./tangle test

termbox/libtermbox.a: termbox/*.c termbox/*.h termbox/*.inl
	cd termbox && make

# auto-generated files; by convention they end in '_list'.
autogenerated_lists: mu.cc function_list test_list

# autogenerated list of function declarations, so I can define them in any order
function_list: mu.cc
	@# functions start out unindented, have all args on the same line, and end in ') {'
	@#                                      ignore methods
	@grep -h "^[^[:space:]#].*) {$$" mu.cc |grep -v ":.*(" |perl -pwe 's/ {.*/;/' > function_list
	@# occasionally we need to modify a declaration in a later layer without messing with ugly unbalanced brackets
	@# assume such functions move the '{' to column 0 of the very next line
	@grep -v "^#line" mu.cc |grep -B1 "^{" |grep -v "^{" |perl -pwe 's/$$/;/' >> function_list
	@# test functions
	@grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/void test_$$1();/' >> function_list

# autogenerated list of tests to run
test_list: mu.cc
	@grep -h "^\s*void test_" mu.cc |perl -pwe 's/^\s*void (.*)\(\) {.*/$$1,/' > test_list
	@grep -h "^\s*TEST(" mu.cc |perl -pwe 's/^\s*TEST\((.*)\)$$/test_$$1,/' >> test_list

#
.PHONY: all autogenerated_lists clean clena

test: autogenerated_lists mu_bin core.mu
	./mu_bin test

valgrind: autogenerated_lists mu_bin core.mu
	valgrind --leak-check=yes --num-callers=40 -q --error-exitcode=1 ./mu_bin test

clena: clean
clean:
	cd enumerate && make clean
	cd tangle && make clean
	cd termbox && make clean
	-rm mu.cc core.mu mu_bin *_list
	-rm -rf mu_bin.*