Commit 75ee5733132a42cd9d7cf8e44ed6ed2a0cf261e7

Thomas de Grivel 2023-12-14T03:27:02

wip ptr_free

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
diff --git a/.gitignore b/.gitignore
index dec0999..c56c58a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,16 +32,24 @@ libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/MacOS
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/Frameworks
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/fonts
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/img
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_asan.app/Contents/MacOS
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_asan.app/Contents/Frameworks
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_asan.app/Contents/fonts
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_asan.app/Contents/img
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_asan.app/Contents/lib
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov.app/Contents/MacOS
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov.app/Contents/Frameworks
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov.app/Contents/fonts
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov.app/Contents/img
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_cov.app/Contents/lib
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/MacOS
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/Frameworks
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/fonts
 libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/img
+libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib
 libc3/window/cairo/xcb/demo/c3_window_cairo_xcb_demo
 libc3/window/cairo/xcb/demo/c3_window_cairo_xcb_demo_asan
 libc3/window/cairo/xcb/demo/c3_window_cairo_xcb_demo_cov
diff --git a/ic3/Makefile b/ic3/Makefile
index 8a6a936..c8dbc3a 100644
--- a/ic3/Makefile
+++ b/ic3/Makefile
@@ -50,7 +50,21 @@ install:
 	mkdir -p ${prefix}/bin
 	install -m 755 ic3 ${prefix}/bin/ic3
 
-.PHONY: all asan cov debug clean clean_cov distclean
+lldb_ic3: debug
+	if [ -f ic3_debug.core ]; then lldb .libs/ic3_debug ic3_debug.core; else lldb .libs/ic3_debug; fi
+
+.PHONY: \
+	all \
+	asan \
+	clean \
+	clean_cov \
+	cov \
+	debug \
+	distclean \
+	gdb_ic3 \
+	install \
+	lldb_ic3 \
+	update_sources \
 
 include config.mk
 include sources.mk
diff --git a/lib/c3/0.1/ptr_free.facts b/lib/c3/0.1/ptr_free.facts
new file mode 100644
index 0000000..b426783
--- /dev/null
+++ b/lib/c3/0.1/ptr_free.facts
@@ -0,0 +1,5 @@
+%{module: C3.Facts.Dump,
+  version: 1}
+replace {PtrFree, :is_a, :module}
+replace {PtrFree, :symbol, PtrFree.cast}
+replace {PtrFree.cast, :cfn, cfn PtrFree "ptr_free_cast" (Tag, Result)}
diff --git a/libc3/env.c b/libc3/env.c
index 4bf50cd..4362bdb 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -789,13 +789,14 @@ s_env * env_init (s_env *env, int argc, s8 **argv)
   return env;
 }
 
-const s_list * env_get_struct_type_spec (s_env *env,
-                                         const s_sym *module)
+s_list ** env_get_struct_type_spec (s_env *env, const s_sym *module,
+                                    s_list **dest)
 {
   s_facts_cursor cursor;
   s_tag tag_defstruct;
   s_tag tag_module;
   s_tag tag_var;
+  s_tag tmp;
   tag_init_sym_1(&tag_defstruct, "defstruct");
   tag_init_sym(&tag_module, module);
   tag_init_var(&tag_var);
@@ -806,16 +807,23 @@ const s_list * env_get_struct_type_spec (s_env *env,
     warnx("env_get_struct_type_spec: module %s"
           " does not use defstruct",
           module->str.ptr.ps8);
+    facts_cursor_clean(&cursor);
     return NULL;
   }
-  if (tag_var.type != TAG_LIST ||
-      ! list_is_plist(tag_var.data.list)) {
+  facts_cursor_clean(&cursor);
+  if (! env_eval_tag(env, &tag_var, &tmp))
+    return NULL;
+  tag_clean(&tag_var);
+  if (tmp.type != TAG_LIST ||
+      ! list_is_plist(tmp.data.list)) {
     warnx("env_get_struct_type_spec: module %s"
           " has a defstruct that is not a property list",
           module->str.ptr.ps8);
+    tag_clean(&tmp);
     return NULL;
   }
-  return tag_var.data.list;
+  *dest = tmp.data.list;
+  return dest;
 }
 
 s_env * env_init_args (s_env *env, int argc, s8 **argv)
diff --git a/libc3/env.h b/libc3/env.h
index 34cc7f6..d9f4b98 100644
--- a/libc3/env.h
+++ b/libc3/env.h
@@ -21,10 +21,6 @@ extern s_env g_c3_env;
 void    env_clean (s_env *env);
 s_env * env_init (s_env *env, int argc, s8 **argv);
 
-/* Observers. */
-const s_list * env_get_struct_type_spec (s_env *env,
-                                         const s_sym *module);
-
 /* Operators. */
 bool          env_eval_array (s_env *env, const s_array *array,
                               s_array *dest);
@@ -64,6 +60,8 @@ bool          env_eval_struct (s_env *env, const s_struct *s,
 bool          env_eval_tag (s_env *env, const s_tag *tag, s_tag *dest);
 bool          env_eval_tuple (s_env *env, const s_tuple *tuple,
                               s_tag *dest);
+s_list **     env_get_struct_type_spec (s_env *env, const s_sym *module,
+                                        s_list **dest);
 bool          env_module_load (s_env *env, const s_sym *module,
                                s_facts *facts);
 bool          env_module_maybe_reload (s_env *env, const s_sym *module,
diff --git a/libc3/ptr_free.c b/libc3/ptr_free.c
index 27dfa1b..1c758cc 100644
--- a/libc3/ptr_free.c
+++ b/libc3/ptr_free.c
@@ -13,7 +13,37 @@
 #include <assert.h>
 #include <err.h>
 #include <stdlib.h>
+#include "integer.h"
 #include "ptr_free.h"
+#include "tag_type.h"
+
+u_ptr_w * ptr_free_cast (const s_tag *tag, u_ptr_w *dest)
+{
+  assert(tag);
+  assert(dest);
+  switch (tag->type) {
+  case TAG_F32: dest->p = (void *) ((uw) tag->data.f32);  return dest;
+  case TAG_F64: dest->p = (void *) ((uw) tag->data.f64);  return dest;
+  case TAG_INTEGER:
+    dest->p = (void *) integer_to_uw(&tag->data.integer); return dest;
+  case TAG_PTR: dest->p = tag->data.ptr.p;                return dest;
+  case TAG_PTR_FREE: dest->p = tag->data.ptr_free.p;      return dest;
+  case TAG_S8:  dest->p = (void *) ((uw) tag->data.s8);          return dest;
+  case TAG_S16: dest->p = (void *) ((uw) tag->data.s16);        return dest;
+  case TAG_S32: dest->p = (void *) ((uw) tag->data.s32);        return dest;
+  case TAG_S64: dest->p = (void *) ((uw) tag->data.s64);        return dest;
+  case TAG_SW:  dest->p = (void *) ((uw) tag->data.sw);         return dest;
+  case TAG_U8:  dest->p = (void *) ((uw) tag->data.u8);         return dest;
+  case TAG_U16: dest->p = (void *) ((uw) tag->data.u16);        return dest;
+  case TAG_U32: dest->p = (void *) ((uw) tag->data.u32);        return dest;
+  case TAG_U64: dest->p = (void *) ((uw) tag->data.u64);        return dest;
+  case TAG_UW:  dest->p = (void *) ((uw) tag->data.uw);         return dest;
+  default: break;
+  }
+  warnx("ptr_free_cast: cannot cast %s to PtrFree",
+        tag_type_to_string(tag->type));
+  return NULL;
+}
 
 void ptr_free_clean (u_ptr_w *ptr_free)
 {
diff --git a/libc3/struct_type.c b/libc3/struct_type.c
index 2d828ba..da47dcc 100644
--- a/libc3/struct_type.c
+++ b/libc3/struct_type.c
@@ -109,15 +109,18 @@ s_struct_type * struct_type_init_from_env (s_struct_type *st,
                                            const s_sym *module,
                                            s_env *env)
 {
-  const s_list *spec;
+  s_list *spec;
   assert(st);
   assert(module);
   assert(env);
-  spec = env_get_struct_type_spec(env, module);
-  if (! spec)
+  if (! env_get_struct_type_spec(env, module, &spec) ||
+      ! spec)
     return NULL;
-  if (! struct_type_init(st, module, spec))
+  if (! struct_type_init(st, module, spec)) {
+    list_delete_all(spec);
     return NULL;
+  }
+  list_delete_all(spec);
   return st;
 }
 
diff --git a/libc3/sym.c b/libc3/sym.c
index 0820139..29d4c51 100644
--- a/libc3/sym.c
+++ b/libc3/sym.c
@@ -374,6 +374,8 @@ f_clean sym_to_clean (const s_sym *type)
     return (f_clean) tuple_clean;
   if (type == sym_1("Var"))
     return NULL;
+  if (type == sym_1("Void"))
+    return NULL;
   err_write_1("sym_to_clean: unknown type: ");
   err_write_1(type->str.ptr.ps8);
   err_write_1("\n");
@@ -403,6 +405,10 @@ ffi_type * sym_to_ffi_type (const s_sym *sym, ffi_type *result_type)
     return &ffi_type_pointer;
   if (sym == sym_1("Map"))
     return &ffi_type_pointer;
+  if (sym == sym_1("Ptr"))
+    return &ffi_type_pointer;
+  if (sym == sym_1("PtrFree"))
+    return &ffi_type_pointer;
   if (sym == sym_1("S8"))
     return &ffi_type_sint8;
   if (sym == sym_1("S16"))
@@ -482,6 +488,10 @@ f_init_copy sym_to_init_copy (const s_sym *type)
     return (f_init_copy) uw_init_copy;
   if (type == sym_1("Ptag"))
     return (f_init_copy) ptag_init_copy;
+  if (type == sym_1("Ptr"))
+    return (f_init_copy) ptr_init_copy;
+  if (type == sym_1("PtrFree"))
+    return (f_init_copy) ptr_free_init_copy;
   if (type == sym_1("Quote"))
     return (f_init_copy) quote_init_copy;
   if (type == sym_1("Str"))
@@ -501,10 +511,6 @@ f_init_copy sym_to_init_copy (const s_sym *type)
 
 bool sym_to_tag_type (const s_sym *sym, e_tag_type *dest)
 {
-  if (sym->str.ptr.ps8[sym->str.size - 2] == '*') {
-    *dest = TAG_PTR;
-    return true;
-  }
   if (sym == sym_1("Void")) {
     *dest = TAG_VOID;
     return true;
@@ -545,72 +551,80 @@ bool sym_to_tag_type (const s_sym *sym, e_tag_type *dest)
     *dest = TAG_INTEGER;
     return true;
   }
-  if (sym == sym_1("Sw")) {
-    *dest = TAG_SW;
+  if (sym == sym_1("List")) {
+    *dest = TAG_LIST;
     return true;
   }
-  if (sym == sym_1("S64")) {
-    *dest = TAG_S64;
+  if (sym == sym_1("Ptag")) {
+    *dest = TAG_PTAG;
     return true;
   }
-  if (sym == sym_1("S32")) {
-    *dest = TAG_S32;
+  if (sym == sym_1("Ptr")) {
+    *dest = TAG_PTR;
     return true;
   }
-  if (sym == sym_1("S16")) {
-    *dest = TAG_S16;
+  if (sym == sym_1("PtrFree")) {
+    *dest = TAG_PTR_FREE;
+    return true;
+  }
+  if (sym == sym_1("Quote")) {
+    *dest = TAG_QUOTE;
     return true;
   }
   if (sym == sym_1("S8")) {
     *dest = TAG_S8;
     return true;
   }
-  if (sym == sym_1("U8")) {
-    *dest = TAG_U8;
+  if (sym == sym_1("S16")) {
+    *dest = TAG_S16;
     return true;
   }
-  if (sym == sym_1("U16")) {
-    *dest = TAG_U16;
+  if (sym == sym_1("S32")) {
+    *dest = TAG_S32;
     return true;
   }
-  if (sym == sym_1("U32")) {
-    *dest = TAG_U32;
+  if (sym == sym_1("S64")) {
+    *dest = TAG_S64;
     return true;
   }
-  if (sym == sym_1("U64")) {
-    *dest = TAG_U64;
+  if (sym == sym_1("Str")) {
+    *dest = TAG_STR;
     return true;
   }
-  if (sym == sym_1("Uw")) {
-    *dest = TAG_UW;
+  if (sym == sym_1("Sw")) {
+    *dest = TAG_SW;
     return true;
   }
-  if (sym == sym_1("List")) {
-    *dest = TAG_LIST;
+  if (sym == sym_1("Sym")) {
+    *dest = TAG_SYM;
     return true;
   }
-  if (sym == sym_1("Ptag")) {
-    *dest = TAG_PTAG;
+  if (sym == sym_1("Tag")) {
+    *dest = TAG_VOID;
     return true;
   }
-  if (sym == sym_1("Quote")) {
-    *dest = TAG_QUOTE;
+  if (sym == sym_1("Tuple")) {
+    *dest = TAG_TUPLE;
     return true;
   }
-  if (sym == sym_1("Str")) {
-    *dest = TAG_STR;
+  if (sym == sym_1("U8")) {
+    *dest = TAG_U8;
     return true;
   }
-  if (sym == sym_1("Sym")) {
-    *dest = TAG_SYM;
+  if (sym == sym_1("U16")) {
+    *dest = TAG_U16;
     return true;
   }
-  if (sym == sym_1("Tag")) {
-    *dest = TAG_VOID;
+  if (sym == sym_1("U32")) {
+    *dest = TAG_U32;
     return true;
   }
-  if (sym == sym_1("Tuple")) {
-    *dest = TAG_TUPLE;
+  if (sym == sym_1("U64")) {
+    *dest = TAG_U64;
+    return true;
+  }
+  if (sym == sym_1("Uw")) {
+    *dest = TAG_UW;
     return true;
   }
   err_write_1("sym_to_tag_type: unknown type: ");
@@ -642,40 +656,46 @@ uw sym_type_size (const s_sym *type)
     return sizeof(s_ident);
   if (type == sym_1("Integer"))
     return sizeof(s_integer);
-  if (type == sym_1("Sw"))
-    return sizeof(sw);
-  if (type == sym_1("S64"))
-    return sizeof(s64);
-  if (type == sym_1("S32"))
-    return sizeof(s32);
-  if (type == sym_1("S16"))
-    return sizeof(s16);
-  if (type == sym_1("S8"))
-    return sizeof(s8);
-  if (type == sym_1("U8"))
-    return sizeof(u8);
-  if (type == sym_1("U16"))
-    return sizeof(u16);
-  if (type == sym_1("U32"))
-    return sizeof(u32);
-  if (type == sym_1("U64"))
-    return sizeof(u64);
-  if (type == sym_1("Uw"))
-    return sizeof(uw);
   if (type == sym_1("List"))
     return sizeof(s_list *);
   if (type == sym_1("Ptag"))
     return sizeof(p_tag);
+  if (type == sym_1("Ptr"))
+    return sizeof(void *);
+  if (type == sym_1("PtrFree"))
+    return sizeof(void *);
   if (type == sym_1("Quote"))
     return sizeof(s_quote);
+  if (type == sym_1("S8"))
+    return sizeof(s8);
+  if (type == sym_1("S16"))
+    return sizeof(s16);
+  if (type == sym_1("S32"))
+    return sizeof(s32);
+  if (type == sym_1("S64"))
+    return sizeof(s64);
   if (type == sym_1("Str"))
     return sizeof(s_str);
+  if (type == sym_1("Sw"))
+    return sizeof(sw);
   if (type == sym_1("Sym"))
     return sizeof(s_sym *);
   if (type == sym_1("Tuple"))
     return sizeof(s_tuple);
+  if (type == sym_1("U8"))
+    return sizeof(u8);
+  if (type == sym_1("U16"))
+    return sizeof(u16);
+  if (type == sym_1("U32"))
+    return sizeof(u32);
+  if (type == sym_1("U64"))
+    return sizeof(u64);
+  if (type == sym_1("Uw"))
+    return sizeof(uw);
   if (type == sym_1("Var"))
     return sizeof(s_tag);
+  if (type == sym_1("Void"))
+    return 0;
   err_write_1("sym_type_size: unknown type: ");
   err_write_1(type->str.ptr.ps8);
   err_write_1("\n");
diff --git a/libc3/window/cairo/quartz/demo/Makefile b/libc3/window/cairo/quartz/demo/Makefile
index a775c59..69978d0 100644
--- a/libc3/window/cairo/quartz/demo/Makefile
+++ b/libc3/window/cairo/quartz/demo/Makefile
@@ -25,11 +25,16 @@ IMG_SOURCES = \
 	../../../../../img/fly-noto.png \
 	../../../../../img/toast.png \
 
+FONT_SOURCES = \
+	../../../../../fonts/Computer-Modern \
+	../../../../../fonts/Courier\ New \
+
 build:
 	${MAKE} ${APP_PROG}
 	${MAKE} ${APP}/Contents/Frameworks
-	rsync -aP --delete ../../../../../lib ${APP}/Contents/
+	rsync -aP ${FONT_SOURCES} ${APP}/Contents/fonts/
 	rsync -aP ${IMG_SOURCES} ${APP}/Contents/img/
+	rsync -aP --delete ../../../../../lib ${APP}/Contents/
 
 all:
 	${MAKE} build
@@ -40,8 +45,9 @@ all:
 asan:
 	${MAKE} ${APP_PROG_ASAN}
 	${MAKE} ${APP_ASAN}/Contents/Frameworks
-	rsync -aP --delete ../../../../../lib ${APP_ASAN}/Contents/
+	rsync -aP ${FONT_SOURCES} ${APP_ASAN}/Contents/fonts/
 	rsync -aP ${IMG_SOURCES} ${APP_ASAN}/Contents/img/
+	rsync -aP --delete ../../../../../lib ${APP_ASAN}/Contents/
 
 clean:
 	rm -rf ${CLEANFILES}
@@ -52,14 +58,16 @@ clean_cov:
 cov:
 	${MAKE} ${APP_PROG_COV}
 	${MAKE} ${APP_COV}/Contents/Frameworks
-	rsync -aP --delete ../../../../../lib ${APP_COV}/Contents/
+	rsync -aP ${FONT_SOURCES} ${APP_COV}/Contents/fonts/
 	rsync -aP ${IMG_SOURCES} ${APP_COV}/Contents/img/
+	rsync -aP --delete ../../../../../lib ${APP_COV}/Contents/
 
 debug:
 	${MAKE} ${APP_PROG_DEBUG}
 	${MAKE} ${APP_DEBUG}/Contents/Frameworks
-	rsync -aP --delete ../../../../../lib ${APP_DEBUG}/Contents/
+	rsync -aP ${FONT_SOURCES} ${APP_DEBUG}/Contents/fonts/
 	rsync -aP ${IMG_SOURCES} ${APP_DEBUG}/Contents/img/
+	rsync -aP --delete ../../../../../lib ${APP_DEBUG}/Contents/
 
 demo: build
 	time ${APP_PROG}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/array.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/array.facts
deleted file mode 100644
index 4bcb97c..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/array.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {Array, :is_a, :module}
-add {Array, :symbol, Array.data}
-replace {Array.data, :cfn, cfn :tag "array_data_tag" (:tag, :tag, :&result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/c3.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/c3.facts
deleted file mode 100644
index 0bdbba9..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/c3.facts
+++ /dev/null
@@ -1,188 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {C3, :is_a, :module}
-replace {C3, :operator, C3.operator00}
-replace {C3.operator00, :is_a, :operator}
-replace {C3.operator00, :symbol, :"()"}
-replace {C3.operator00, :arity, 1}
-replace {C3.operator00, :cfn, cfn Tag "tag_paren" (Tag, Result)}
-replace {C3.operator00, :operator_precedence, 13}
-replace {C3.operator00, :operator_associativity, :left}
-add {C3, :operator, C3.operator01}
-replace {C3.operator01, :is_a, :operator}
-replace {C3.operator01, :symbol, :"[]"}
-replace {C3.operator01, :arity, 2}
-replace {C3.operator01, :cfn, cfn Tag "tag_brackets" (Tag, Tag, Result)}
-replace {C3.operator01, :operator_precedence, 13}
-replace {C3.operator01, :operator_associativity, :left}
-add {C3, :operator, C3.operator02}
-replace {C3.operator02, :is_a, :operator}
-replace {C3.operator02, :symbol, :!}
-replace {C3.operator02, :arity, 1}
-replace {C3.operator02, :cfn, cfn Bool "tag_not" (Tag, Result)}
-replace {C3.operator02, :operator_precedence, 12}
-replace {C3.operator02, :operator_associativity, :right}
-add {C3, :operator, C3.operator03}
-replace {C3.operator03, :is_a, :operator}
-replace {C3.operator03, :symbol, :~}
-replace {C3.operator03, :arity, 1}
-replace {C3.operator03, :cfn, cfn Tag "tag_bnot" (Tag, Result)}
-replace {C3.operator03, :operator_precedence, 12}
-replace {C3.operator03, :operator_associativity, :right}
-add {C3, :operator, C3.operator04}
-replace {C3.operator04, :is_a, :operator}
-replace {C3.operator04, :symbol, :-}
-replace {C3.operator04, :arity, 1}
-replace {C3.operator04, :cfn, cfn Tag "tag_neg" (Tag, Result)}
-replace {C3.operator04, :operator_precedence, 12}
-replace {C3.operator04, :operator_associativity, :right}
-add {C3, :operator, C3.operator05}
-replace {C3.operator05, :is_a, :operator}
-replace {C3.operator05, :symbol, :*}
-replace {C3.operator05, :arity, 2}
-replace {C3.operator05, :cfn, cfn Tag "tag_mul" (Tag, Tag, Result)}
-replace {C3.operator05, :operator_precedence, 11}
-replace {C3.operator05, :operator_associativity, :left}
-add {C3, :operator, C3.operator06}
-replace {C3.operator06, :is_a, :operator}
-replace {C3.operator06, :symbol, :/}
-replace {C3.operator06, :arity, 2}
-replace {C3.operator06, :cfn, cfn Tag "tag_div" (Tag, Tag, Result)}
-replace {C3.operator06, :operator_precedence, 11}
-replace {C3.operator06, :operator_associativity, :left}
-add {C3, :operator, C3.operator07}
-replace {C3.operator07, :is_a, :operator}
-replace {C3.operator07, :symbol, :mod}
-replace {C3.operator07, :arity, 2}
-replace {C3.operator07, :cfn, cfn Tag "tag_mod" (Tag, Tag, Result)}
-replace {C3.operator07, :operator_precedence, 11}
-replace {C3.operator07, :operator_associativity, :left}
-add {C3, :operator, C3.operator08}
-replace {C3.operator08, :is_a, :operator}
-replace {C3.operator08, :symbol, :+}
-replace {C3.operator08, :arity, 2}
-replace {C3.operator08, :cfn, cfn Tag "tag_add" (Tag, Tag, Result)}
-replace {C3.operator08, :operator_precedence, 10}
-replace {C3.operator08, :operator_associativity, :left}
-add {C3, :operator, C3.operator09}
-replace {C3.operator09, :is_a, :operator}
-replace {C3.operator09, :symbol, :-}
-replace {C3.operator09, :arity, 2}
-replace {C3.operator09, :cfn, cfn Tag "tag_sub" (Tag, Tag, Result)}
-replace {C3.operator09, :operator_precedence, 10}
-replace {C3.operator09, :operator_associativity, :left}
-add {C3, :operator, C3.operator10}
-replace {C3.operator10, :is_a, :operator}
-replace {C3.operator10, :symbol, :<<}
-replace {C3.operator10, :arity, 2}
-replace {C3.operator10, :cfn, cfn Tag "tag_shift_left" (Tag, Tag, Result)}
-replace {C3.operator10, :operator_precedence, 9}
-replace {C3.operator10, :operator_associativity, :left}
-add {C3, :operator, C3.operator11}
-replace {C3.operator11, :is_a, :operator}
-replace {C3.operator11, :symbol, :>>}
-replace {C3.operator11, :arity, 2}
-replace {C3.operator11, :cfn, cfn Tag "tag_shift_right" (Tag, Tag, Result)}
-replace {C3.operator11, :operator_precedence, 9}
-replace {C3.operator11, :operator_associativity, :left}
-add {C3, :operator, C3.operator12}
-replace {C3.operator12, :is_a, :operator}
-replace {C3.operator12, :symbol, :<}
-replace {C3.operator12, :arity, 2}
-replace {C3.operator12, :cfn, cfn Bool "tag_lt" (Tag, Tag, Result)}
-replace {C3.operator12, :operator_precedence, 8}
-replace {C3.operator12, :operator_associativity, :left}
-add {C3, :operator, C3.operator13}
-replace {C3.operator13, :symbol, :<=}
-replace {C3.operator13, :is_a, :operator}
-replace {C3.operator13, :arity, 2}
-replace {C3.operator13, :cfn, cfn Bool "tag_lte" (Tag, Tag, Result)}
-replace {C3.operator13, :operator_precedence, 8}
-replace {C3.operator13, :operator_associativity, :left}
-add {C3, :operator, C3.operator14}
-replace {C3.operator14, :symbol, :>}
-replace {C3.operator14, :is_a, :operator}
-replace {C3.operator14, :arity, 2}
-replace {C3.operator14, :cfn, cfn Bool "tag_gt" (Tag, Tag, Result)}
-replace {C3.operator14, :operator_precedence, 8}
-replace {C3.operator14, :operator_associativity, :left}
-add {C3, :operator, C3.operator15}
-replace {C3.operator15, :symbol, :>=}
-replace {C3.operator15, :is_a, :operator}
-replace {C3.operator15, :arity, 2}
-replace {C3.operator15, :cfn, cfn Bool "tag_gte" (Tag, Tag, Result)}
-replace {C3.operator15, :operator_precedence, 8}
-replace {C3.operator15, :operator_associativity, :left}
-add {C3, :operator, C3.operator16}
-replace {C3.operator16, :is_a, :operator}
-replace {C3.operator16, :symbol, :==}
-replace {C3.operator16, :arity, 2}
-replace {C3.operator16, :cfn, cfn Bool "tag_eq" (Tag, Tag, Result)}
-replace {C3.operator16, :operator_precedence, 7}
-replace {C3.operator16, :operator_associativity, :left}
-add {C3, :operator, C3.operator17}
-replace {C3.operator17, :is_a, :operator}
-replace {C3.operator17, :symbol, :!=}
-replace {C3.operator17, :arity, 2}
-replace {C3.operator17, :cfn, cfn Bool "tag_not_eq" (Tag, Tag, Result)}
-replace {C3.operator17, :operator_precedence, 7}
-replace {C3.operator17, :operator_associativity, :left}
-add {C3, :operator, C3.operator18}
-replace {C3.operator18, :is_a, :operator}
-replace {C3.operator18, :symbol, :&}
-replace {C3.operator18, :arity, 2}
-replace {C3.operator18, :cfn, cfn Tag "tag_band" (Tag, Tag, Result)}
-replace {C3.operator18, :operator_precedence, 6}
-replace {C3.operator18, :operator_associativity, :left}
-add {C3, :operator, C3.operator19}
-replace {C3.operator19, :is_a, :operator}
-replace {C3.operator19, :symbol, :^}
-replace {C3.operator19, :arity, 2}
-replace {C3.operator19, :cfn, cfn Tag "tag_bxor" (Tag, Tag, Result)}
-replace {C3.operator19, :operator_precedence, 5}
-replace {C3.operator19, :operator_associativity, :left}
-add {C3, :operator, C3.operator20}
-replace {C3.operator20, :is_a, :operator}
-replace {C3.operator20, :symbol, :bor}
-replace {C3.operator20, :arity, 2}
-replace {C3.operator20, :cfn, cfn Tag "tag_bor" (Tag, Tag, Result)}
-replace {C3.operator20, :operator_precedence, 4}
-replace {C3.operator20, :operator_associativity, :left}
-add {C3, :operator, C3.operator21}
-replace {C3.operator21, :is_a, :operator}
-replace {C3.operator21, :symbol, :&&}
-replace {C3.operator21, :arity, 2}
-replace {C3.operator21, :cfn, cfn Bool "tag_and" (Tag, Tag, Result)}
-replace {C3.operator21, :operator_precedence, 3}
-replace {C3.operator21, :operator_associativity, :left}
-add {C3, :operator, C3.operator22}
-replace {C3.operator22, :is_a, :operator}
-replace {C3.operator22, :symbol, :||}
-replace {C3.operator22, :arity, 2}
-replace {C3.operator22, :cfn, cfn Bool "tag_or" (Tag, Tag, Result)}
-replace {C3.operator22, :operator_precedence, 2}
-replace {C3.operator22, :operator_associativity, :left}
-add {C3, :operator, C3.operator23}
-replace {C3.operator23, :is_a, :operator}
-add {C3.operator23, :is_a, :special_operator}
-replace {C3.operator23, :symbol, :=}
-replace {C3.operator23, :arity, 2}
-replace {C3.operator23, :cfn, cfn Tag "tag_equal" (Tag, Tag, Result)}
-replace {C3.operator23, :operator_precedence, 1}
-replace {C3.operator23, :operator_associativity, :right}
-replace {C3.break, :cfn, cfn Void "c3_break" ()}
-replace {C3, :symbol, C3.first}
-replace {C3.first, :fn, fn {
- ([a | _b]) { a }
- ({a, _b}) { a }
- ({a, _b, _c}) { a }
- ({a, _b, _c, _d}) { a }
-}}
-add {C3, :symbol, C3.license}
-replace {C3.license, :cfn, cfn Void "c3_license" ()}
-add {C3, :symbol, C3.type}
-replace {C3.type, :cfn, cfn Sym "tag_type" (Tag, Result)}
-add {C3, :symbol, C3.fib}
-replace {C3.fib, :fn, fn { (0) { 1 }
-                           (1) { 1 }
-                           (x) { fib(x - 1) + fib(x - 2) } }}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/integer.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/integer.facts
deleted file mode 100644
index ff8d8e7..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/integer.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Integer, :is_a, :module}
-replace {Integer, :symbol, Integer.cast}
-replace {Integer.cast, :cfn, cfn Integer "integer_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/list.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/list.facts
deleted file mode 100644
index ea05f14..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/list.facts
+++ /dev/null
@@ -1,20 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {List, :is_a, :module}
-add {List, :symbol, List.cast}
-add {List, :symbol, List.map}
-add {List, :symbol, List.reverse}
-replace {List.cast, :cfn, cfn :list "list_cast" (:tag, :&result)}
-replace {List.map, :fn, fn {
-  ([], _) {
-    []
-  }
-  ([a | b], f) {
-    [f(a) | List.map(b, f)]
-  }
-}}
-replace {List.reverse, :fn, fn {
-  (x) { List.reverse(x, []) }
-  ([], acc) { acc }
-  ([a | b], acc) { List.reverse(b, [a | acc]) }
-}}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/map.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/map.facts
deleted file mode 100644
index de43112..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/map.facts
+++ /dev/null
@@ -1,11 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {Map, :is_a, :module}
-add {Map, :symbol, Map.cast}
-add {Map, :symbol, Map.map}
-add {Map, :symbol, Map.to_list}
-replace {Map.cast, :cfn, cfn Map "map_cast" (Tag, Result)}
-replace {Map.map, :cfn, cfn List "map_map" (Map, Fn, Result)}
-replace {Map.to_list, :fn, fn (%{} = map) {
-  Map.map(map, fn (k, v) { {k, v} })
-}}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s16.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s16.facts
deleted file mode 100644
index 2a202d1..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s16.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S16, :is_a, :module}
-replace {S16, :symbol, S16.cast}
-replace {S16.cast, :cfn, cfn S16 "s16_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s32.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s32.facts
deleted file mode 100644
index fcbce6e..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s32.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S32, :is_a, :module}
-replace {S32, :symbol, S32.cast}
-replace {S32.cast, :cfn, cfn S32 "s32_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s64.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s64.facts
deleted file mode 100644
index 0e39a05..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s64.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S64, :is_a, :module}
-replace {S64, :symbol, S64.cast}
-replace {S64.cast, :cfn, cfn S64 "s64_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s8.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s8.facts
deleted file mode 100644
index 746d7ff..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/s8.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S8, :is_a, :module}
-replace {S8, :symbol, S8.cast}
-replace {S8.cast, :cfn, cfn S8 "s8_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/sw.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/sw.facts
deleted file mode 100644
index f9ec974..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/sw.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Sw, :is_a, :module}
-replace {Sw, :symbol, Sw.cast}
-replace {Sw.cast, :cfn, cfn Sw "sw_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u16.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u16.facts
deleted file mode 100644
index ee7d50c..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u16.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U16, :is_a, :module}
-replace {U16, :symbol, U16.cast}
-replace {U16.cast, :cfn, cfn U16 "u16_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u32.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u32.facts
deleted file mode 100644
index 29e6146..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u32.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U32, :is_a, :module}
-replace {U32, :symbol, U32.cast}
-replace {U32.cast, :cfn, cfn U32 "u32_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u64.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u64.facts
deleted file mode 100644
index 7cea2fe..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u64.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U64, :is_a, :module}
-replace {U64, :symbol, U64.cast}
-replace {U64.cast, :cfn, cfn U64 "u64_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u8.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u8.facts
deleted file mode 100644
index 39e73d0..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/u8.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U8, :is_a, :module}
-replace {U8, :symbol, U8.cast}
-replace {U8.cast, :cfn, cfn U8 "u8_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/uw.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/uw.facts
deleted file mode 100644
index c4a25a5..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo.app/Contents/lib/c3/0.1/uw.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Uw, :is_a, :module}
-replace {Uw, :symbol, Uw.cast}
-replace {Uw.cast, :cfn, cfn Uw "uw_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/array.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/array.facts
deleted file mode 100644
index 4bcb97c..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/array.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {Array, :is_a, :module}
-add {Array, :symbol, Array.data}
-replace {Array.data, :cfn, cfn :tag "array_data_tag" (:tag, :tag, :&result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/c3.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/c3.facts
deleted file mode 100644
index 0bdbba9..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/c3.facts
+++ /dev/null
@@ -1,188 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {C3, :is_a, :module}
-replace {C3, :operator, C3.operator00}
-replace {C3.operator00, :is_a, :operator}
-replace {C3.operator00, :symbol, :"()"}
-replace {C3.operator00, :arity, 1}
-replace {C3.operator00, :cfn, cfn Tag "tag_paren" (Tag, Result)}
-replace {C3.operator00, :operator_precedence, 13}
-replace {C3.operator00, :operator_associativity, :left}
-add {C3, :operator, C3.operator01}
-replace {C3.operator01, :is_a, :operator}
-replace {C3.operator01, :symbol, :"[]"}
-replace {C3.operator01, :arity, 2}
-replace {C3.operator01, :cfn, cfn Tag "tag_brackets" (Tag, Tag, Result)}
-replace {C3.operator01, :operator_precedence, 13}
-replace {C3.operator01, :operator_associativity, :left}
-add {C3, :operator, C3.operator02}
-replace {C3.operator02, :is_a, :operator}
-replace {C3.operator02, :symbol, :!}
-replace {C3.operator02, :arity, 1}
-replace {C3.operator02, :cfn, cfn Bool "tag_not" (Tag, Result)}
-replace {C3.operator02, :operator_precedence, 12}
-replace {C3.operator02, :operator_associativity, :right}
-add {C3, :operator, C3.operator03}
-replace {C3.operator03, :is_a, :operator}
-replace {C3.operator03, :symbol, :~}
-replace {C3.operator03, :arity, 1}
-replace {C3.operator03, :cfn, cfn Tag "tag_bnot" (Tag, Result)}
-replace {C3.operator03, :operator_precedence, 12}
-replace {C3.operator03, :operator_associativity, :right}
-add {C3, :operator, C3.operator04}
-replace {C3.operator04, :is_a, :operator}
-replace {C3.operator04, :symbol, :-}
-replace {C3.operator04, :arity, 1}
-replace {C3.operator04, :cfn, cfn Tag "tag_neg" (Tag, Result)}
-replace {C3.operator04, :operator_precedence, 12}
-replace {C3.operator04, :operator_associativity, :right}
-add {C3, :operator, C3.operator05}
-replace {C3.operator05, :is_a, :operator}
-replace {C3.operator05, :symbol, :*}
-replace {C3.operator05, :arity, 2}
-replace {C3.operator05, :cfn, cfn Tag "tag_mul" (Tag, Tag, Result)}
-replace {C3.operator05, :operator_precedence, 11}
-replace {C3.operator05, :operator_associativity, :left}
-add {C3, :operator, C3.operator06}
-replace {C3.operator06, :is_a, :operator}
-replace {C3.operator06, :symbol, :/}
-replace {C3.operator06, :arity, 2}
-replace {C3.operator06, :cfn, cfn Tag "tag_div" (Tag, Tag, Result)}
-replace {C3.operator06, :operator_precedence, 11}
-replace {C3.operator06, :operator_associativity, :left}
-add {C3, :operator, C3.operator07}
-replace {C3.operator07, :is_a, :operator}
-replace {C3.operator07, :symbol, :mod}
-replace {C3.operator07, :arity, 2}
-replace {C3.operator07, :cfn, cfn Tag "tag_mod" (Tag, Tag, Result)}
-replace {C3.operator07, :operator_precedence, 11}
-replace {C3.operator07, :operator_associativity, :left}
-add {C3, :operator, C3.operator08}
-replace {C3.operator08, :is_a, :operator}
-replace {C3.operator08, :symbol, :+}
-replace {C3.operator08, :arity, 2}
-replace {C3.operator08, :cfn, cfn Tag "tag_add" (Tag, Tag, Result)}
-replace {C3.operator08, :operator_precedence, 10}
-replace {C3.operator08, :operator_associativity, :left}
-add {C3, :operator, C3.operator09}
-replace {C3.operator09, :is_a, :operator}
-replace {C3.operator09, :symbol, :-}
-replace {C3.operator09, :arity, 2}
-replace {C3.operator09, :cfn, cfn Tag "tag_sub" (Tag, Tag, Result)}
-replace {C3.operator09, :operator_precedence, 10}
-replace {C3.operator09, :operator_associativity, :left}
-add {C3, :operator, C3.operator10}
-replace {C3.operator10, :is_a, :operator}
-replace {C3.operator10, :symbol, :<<}
-replace {C3.operator10, :arity, 2}
-replace {C3.operator10, :cfn, cfn Tag "tag_shift_left" (Tag, Tag, Result)}
-replace {C3.operator10, :operator_precedence, 9}
-replace {C3.operator10, :operator_associativity, :left}
-add {C3, :operator, C3.operator11}
-replace {C3.operator11, :is_a, :operator}
-replace {C3.operator11, :symbol, :>>}
-replace {C3.operator11, :arity, 2}
-replace {C3.operator11, :cfn, cfn Tag "tag_shift_right" (Tag, Tag, Result)}
-replace {C3.operator11, :operator_precedence, 9}
-replace {C3.operator11, :operator_associativity, :left}
-add {C3, :operator, C3.operator12}
-replace {C3.operator12, :is_a, :operator}
-replace {C3.operator12, :symbol, :<}
-replace {C3.operator12, :arity, 2}
-replace {C3.operator12, :cfn, cfn Bool "tag_lt" (Tag, Tag, Result)}
-replace {C3.operator12, :operator_precedence, 8}
-replace {C3.operator12, :operator_associativity, :left}
-add {C3, :operator, C3.operator13}
-replace {C3.operator13, :symbol, :<=}
-replace {C3.operator13, :is_a, :operator}
-replace {C3.operator13, :arity, 2}
-replace {C3.operator13, :cfn, cfn Bool "tag_lte" (Tag, Tag, Result)}
-replace {C3.operator13, :operator_precedence, 8}
-replace {C3.operator13, :operator_associativity, :left}
-add {C3, :operator, C3.operator14}
-replace {C3.operator14, :symbol, :>}
-replace {C3.operator14, :is_a, :operator}
-replace {C3.operator14, :arity, 2}
-replace {C3.operator14, :cfn, cfn Bool "tag_gt" (Tag, Tag, Result)}
-replace {C3.operator14, :operator_precedence, 8}
-replace {C3.operator14, :operator_associativity, :left}
-add {C3, :operator, C3.operator15}
-replace {C3.operator15, :symbol, :>=}
-replace {C3.operator15, :is_a, :operator}
-replace {C3.operator15, :arity, 2}
-replace {C3.operator15, :cfn, cfn Bool "tag_gte" (Tag, Tag, Result)}
-replace {C3.operator15, :operator_precedence, 8}
-replace {C3.operator15, :operator_associativity, :left}
-add {C3, :operator, C3.operator16}
-replace {C3.operator16, :is_a, :operator}
-replace {C3.operator16, :symbol, :==}
-replace {C3.operator16, :arity, 2}
-replace {C3.operator16, :cfn, cfn Bool "tag_eq" (Tag, Tag, Result)}
-replace {C3.operator16, :operator_precedence, 7}
-replace {C3.operator16, :operator_associativity, :left}
-add {C3, :operator, C3.operator17}
-replace {C3.operator17, :is_a, :operator}
-replace {C3.operator17, :symbol, :!=}
-replace {C3.operator17, :arity, 2}
-replace {C3.operator17, :cfn, cfn Bool "tag_not_eq" (Tag, Tag, Result)}
-replace {C3.operator17, :operator_precedence, 7}
-replace {C3.operator17, :operator_associativity, :left}
-add {C3, :operator, C3.operator18}
-replace {C3.operator18, :is_a, :operator}
-replace {C3.operator18, :symbol, :&}
-replace {C3.operator18, :arity, 2}
-replace {C3.operator18, :cfn, cfn Tag "tag_band" (Tag, Tag, Result)}
-replace {C3.operator18, :operator_precedence, 6}
-replace {C3.operator18, :operator_associativity, :left}
-add {C3, :operator, C3.operator19}
-replace {C3.operator19, :is_a, :operator}
-replace {C3.operator19, :symbol, :^}
-replace {C3.operator19, :arity, 2}
-replace {C3.operator19, :cfn, cfn Tag "tag_bxor" (Tag, Tag, Result)}
-replace {C3.operator19, :operator_precedence, 5}
-replace {C3.operator19, :operator_associativity, :left}
-add {C3, :operator, C3.operator20}
-replace {C3.operator20, :is_a, :operator}
-replace {C3.operator20, :symbol, :bor}
-replace {C3.operator20, :arity, 2}
-replace {C3.operator20, :cfn, cfn Tag "tag_bor" (Tag, Tag, Result)}
-replace {C3.operator20, :operator_precedence, 4}
-replace {C3.operator20, :operator_associativity, :left}
-add {C3, :operator, C3.operator21}
-replace {C3.operator21, :is_a, :operator}
-replace {C3.operator21, :symbol, :&&}
-replace {C3.operator21, :arity, 2}
-replace {C3.operator21, :cfn, cfn Bool "tag_and" (Tag, Tag, Result)}
-replace {C3.operator21, :operator_precedence, 3}
-replace {C3.operator21, :operator_associativity, :left}
-add {C3, :operator, C3.operator22}
-replace {C3.operator22, :is_a, :operator}
-replace {C3.operator22, :symbol, :||}
-replace {C3.operator22, :arity, 2}
-replace {C3.operator22, :cfn, cfn Bool "tag_or" (Tag, Tag, Result)}
-replace {C3.operator22, :operator_precedence, 2}
-replace {C3.operator22, :operator_associativity, :left}
-add {C3, :operator, C3.operator23}
-replace {C3.operator23, :is_a, :operator}
-add {C3.operator23, :is_a, :special_operator}
-replace {C3.operator23, :symbol, :=}
-replace {C3.operator23, :arity, 2}
-replace {C3.operator23, :cfn, cfn Tag "tag_equal" (Tag, Tag, Result)}
-replace {C3.operator23, :operator_precedence, 1}
-replace {C3.operator23, :operator_associativity, :right}
-replace {C3.break, :cfn, cfn Void "c3_break" ()}
-replace {C3, :symbol, C3.first}
-replace {C3.first, :fn, fn {
- ([a | _b]) { a }
- ({a, _b}) { a }
- ({a, _b, _c}) { a }
- ({a, _b, _c, _d}) { a }
-}}
-add {C3, :symbol, C3.license}
-replace {C3.license, :cfn, cfn Void "c3_license" ()}
-add {C3, :symbol, C3.type}
-replace {C3.type, :cfn, cfn Sym "tag_type" (Tag, Result)}
-add {C3, :symbol, C3.fib}
-replace {C3.fib, :fn, fn { (0) { 1 }
-                           (1) { 1 }
-                           (x) { fib(x - 1) + fib(x - 2) } }}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/integer.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/integer.facts
deleted file mode 100644
index ff8d8e7..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/integer.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Integer, :is_a, :module}
-replace {Integer, :symbol, Integer.cast}
-replace {Integer.cast, :cfn, cfn Integer "integer_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/list.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/list.facts
deleted file mode 100644
index ea05f14..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/list.facts
+++ /dev/null
@@ -1,20 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {List, :is_a, :module}
-add {List, :symbol, List.cast}
-add {List, :symbol, List.map}
-add {List, :symbol, List.reverse}
-replace {List.cast, :cfn, cfn :list "list_cast" (:tag, :&result)}
-replace {List.map, :fn, fn {
-  ([], _) {
-    []
-  }
-  ([a | b], f) {
-    [f(a) | List.map(b, f)]
-  }
-}}
-replace {List.reverse, :fn, fn {
-  (x) { List.reverse(x, []) }
-  ([], acc) { acc }
-  ([a | b], acc) { List.reverse(b, [a | acc]) }
-}}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/map.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/map.facts
deleted file mode 100644
index de43112..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/map.facts
+++ /dev/null
@@ -1,11 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-add {Map, :is_a, :module}
-add {Map, :symbol, Map.cast}
-add {Map, :symbol, Map.map}
-add {Map, :symbol, Map.to_list}
-replace {Map.cast, :cfn, cfn Map "map_cast" (Tag, Result)}
-replace {Map.map, :cfn, cfn List "map_map" (Map, Fn, Result)}
-replace {Map.to_list, :fn, fn (%{} = map) {
-  Map.map(map, fn (k, v) { {k, v} })
-}}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s16.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s16.facts
deleted file mode 100644
index 2a202d1..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s16.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S16, :is_a, :module}
-replace {S16, :symbol, S16.cast}
-replace {S16.cast, :cfn, cfn S16 "s16_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s32.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s32.facts
deleted file mode 100644
index fcbce6e..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s32.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S32, :is_a, :module}
-replace {S32, :symbol, S32.cast}
-replace {S32.cast, :cfn, cfn S32 "s32_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s64.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s64.facts
deleted file mode 100644
index 0e39a05..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s64.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S64, :is_a, :module}
-replace {S64, :symbol, S64.cast}
-replace {S64.cast, :cfn, cfn S64 "s64_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s8.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s8.facts
deleted file mode 100644
index 746d7ff..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/s8.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {S8, :is_a, :module}
-replace {S8, :symbol, S8.cast}
-replace {S8.cast, :cfn, cfn S8 "s8_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/sw.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/sw.facts
deleted file mode 100644
index f9ec974..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/sw.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Sw, :is_a, :module}
-replace {Sw, :symbol, Sw.cast}
-replace {Sw.cast, :cfn, cfn Sw "sw_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u16.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u16.facts
deleted file mode 100644
index ee7d50c..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u16.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U16, :is_a, :module}
-replace {U16, :symbol, U16.cast}
-replace {U16.cast, :cfn, cfn U16 "u16_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u32.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u32.facts
deleted file mode 100644
index 29e6146..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u32.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U32, :is_a, :module}
-replace {U32, :symbol, U32.cast}
-replace {U32.cast, :cfn, cfn U32 "u32_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u64.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u64.facts
deleted file mode 100644
index 7cea2fe..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u64.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U64, :is_a, :module}
-replace {U64, :symbol, U64.cast}
-replace {U64.cast, :cfn, cfn U64 "u64_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u8.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u8.facts
deleted file mode 100644
index 39e73d0..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/u8.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {U8, :is_a, :module}
-replace {U8, :symbol, U8.cast}
-replace {U8.cast, :cfn, cfn U8 "u8_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/uw.facts b/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/uw.facts
deleted file mode 100644
index c4a25a5..0000000
--- a/libc3/window/cairo/quartz/demo/c3_window_cairo_quartz_demo_debug.app/Contents/lib/c3/0.1/uw.facts
+++ /dev/null
@@ -1,5 +0,0 @@
-%{module: C3.Facts.Dump,
-  version: 1}
-replace {Uw, :is_a, :module}
-replace {Uw, :symbol, Uw.cast}
-replace {Uw.cast, :cfn, cfn Uw "uw_cast" (Tag, Result)}
diff --git a/libc3/window/cairo/quartz/demo/window_cairo_quartz_demo.c b/libc3/window/cairo/quartz/demo/window_cairo_quartz_demo.c
index 7635a23..00b6fb3 100644
--- a/libc3/window/cairo/quartz/demo/window_cairo_quartz_demo.c
+++ b/libc3/window/cairo/quartz/demo/window_cairo_quartz_demo.c
@@ -33,6 +33,7 @@ int main (int argc, s8 **argv)
   window.load   = window_cairo_demo_load;
   window.render = window_cairo_demo_render;
   window.resize = window_cairo_demo_resize;
+  window.unload = window_cairo_demo_unload;
   if (! window_cairo_quartz_run(&window))
     r = g_c3_exit_code;
   window_cairo_clean(&window);
diff --git a/libc3/window/sdl2/demo/earth.c b/libc3/window/sdl2/demo/earth.c
index b7e02a0..0465dc9 100644
--- a/libc3/window/sdl2/demo/earth.c
+++ b/libc3/window/sdl2/demo/earth.c
@@ -63,20 +63,20 @@ bool earth_render (s_sequence *seq, s_window_sdl2 *window,
   assert(window);
   (void) context;
   if (! seq || seq->tag.type != TAG_MAP ||
-      seq->tag.data.map.count < 2) {
+      seq->tag.data.map.count != 3) {
     warnx("earth_render: invalid seq->tag");
     return false;
   }
   map = &seq->tag.data.map;
-  if (map->value[0].type != TAG_PTR ||
+  if (map->value[0].type != TAG_PTR_FREE ||
       map->value[1].type != TAG_F64 ||
-      map->value[2].type != TAG_PTR) {
+      map->value[2].type != TAG_STRUCT) {
     warnx("earth_render: invalid map");
     return false;
   }
-  camera             =  map->value[0].data.ptr.p;
+  camera             =  map->value[0].data.ptr_free.p;
   camera_rot_x_speed = &map->value[1].data.f64;
-  sphere             =  map->value[2].data.ptr.p;
+  sphere             =  map->value[2].data.struct_.data;
   gl_camera_set_aspect_ratio(camera, window->w, window->h);
   camera->rotation.x += seq->dt * (*camera_rot_x_speed) *
     360.0;