-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.tex
36 lines (35 loc) · 1.31 KB
/
compose.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% list name of solvers list
% :: solvers -> solver
\def\chr@compose#1{%
% execute rules first, we collect them globally
\chr@list@iter\chr@make@s:=#1\do{%
\chr@make@s
}%
\chr@program@set{composite_solver}##1{%
\chr@list@to@string\chr@temp@list{##1}{\csname##1length\endcsname}%
\chr@verbose{Running composite solver with '##1' ===========================}%
\chr@verbose{Constraint Store: [\chr@temp@list]}
\chr@list@concat{chr@list@return}{##1}{@empty@list}%
% iterate over every solver
\chr@list@iter\chr@s:=chr@rules\do{%
% contract: every solver must store its solver in \chr@toreturn
\def\chr@input@constraints{##1}%
\chr@s
% compare if the constraints have changed => did this solver make us happy?
\chr@list@equal{chr@constraints}{chr@list@return} \else
% if so, break, this solver is nice!
\chr@break
\fi
}%
% TODO: maybe just keep toreturn in local register?
% chr@constraints
}
% technically it is up to the caller to do that :eyes:
% on call, we simply assume, that '\constraintsname' is set
% \chr@program@get{composite_solver}%
}
\def\chr@compose@inline#1{%
% TODO: support nesting?
\chr@list{\chr@current @solvers}{#1}%
\chr@compose{\chr@current @solvers}%
}