source: doc/theses/mike_brooks_MMath/content/string/sharing-demo.cfa.liquid @ 8e819a9

enumpthread-emulationqualifiedEnum
Last change on this file since 8e819a9 was 8e819a9, checked in by Michael Brooks <mlbrooks@…>, 10 months ago

Mike MMath initial

  • Property mode set to 100644
File size: 977 bytes
Line 
1#include <string.hfa>
2#include <assert.h>
3
4void demo1() {
5
6
7{% for item in demo1 %}
8  {% if item.type == "text" %}
9    /* {{ item.value }} */
10  {% elsif item.type == "demo" %}
11    {% for step in item.steps %}
12      {% for line in step.code %}{{ line }}
13      {% endfor %}
14      {% for endval in step.endvals %}
15        assert( {{endval[0]}} == "{{endval[1]}}" );
16      {% endfor %}
17    {% endfor %}
18  {% else %}
19    BAD ITEM
20  {% endif %}
21{% endfor %}
22
23}
24
25
26void demo2() {
27
28
29{% for item in demo2 %}
30  {% if item.type == "text" %}
31    /* {{ item.value }} */
32  {% elsif item.type == "demo" %}
33    {% for step in item.steps %}
34      {% for line in step.code %}{{ line }}
35      {% endfor %}
36      {% for endval in step.endvals %}
37        assert( {{endval[0]}} == "{{endval[1]}}" );
38      {% endfor %}
39    {% endfor %}
40  {% else %}
41    BAD ITEM
42  {% endif %}
43{% endfor %}
44
45}
46
47
48int main(int argc, char ** argv) {
49
50    demo1();
51    demo2();
52    printf("%s done running\n", argv[0]);
53}
Note: See TracBrowser for help on using the repository browser.