2 Copyright (C) 2017-2018 Keziah Wesley
4 You can redistribute and/or modify this file under the terms of the
5 GNU Affero General Public License as published by the Free Software
6 Foundation, either version 3 of the License, or (at your option) any
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Affero General Public License for more details.
14 You should have received a copy of the GNU Affero General Public
15 License along with this file. If not, see
16 <http://www.gnu.org/licenses/>.
23 // TODO: "print" into buffer
29 print_vector_body (const vector_object * o)
31 const object *p = HEAP_OBJECT (o->val.body);
36 for (uint32_t i = 1; i < o->val.len; i++)
44 print_uvector_body (const uvector_object * o)
46 const uv_val *p = UV_VAL (o->val.body);
55 print_object ((object *) & x);
57 for (uint32_t i = 1; i < o->val.len; i++)
61 print_object ((object *) & x);
66 print_list_body (const list_object * o)
68 const pool_object *p = POOL_OBJECT (o->val.head);
71 print_object ((const object *) p);
72 while ((p = POOL_OBJECT (p->rest)))
75 print_object ((const object *) p);
80 print_object (const object * o)
85 printf ("%d", o->fix32.val.n);
88 printf ("%ld", o->fix64.val.n);
91 // for now, handle non-primtype print as special case (cf. OBLIST)
96 print_list_body (&o->list);
101 print_list_body (&o->list);
104 case EVALTYPE_VECTOR:
106 print_vector_body (&o->vector);
109 case EVALTYPE_OBLIST:
110 // for now, handle non-primtype print as special case
113 case EVALTYPE_UVECTOR:
115 print_uvector_body (&o->uvector);
119 printf ("%s", atom_pname (o->atom));
122 fprintf (stderr, "Tried to print the unprintable: 0x%x\n", o->type);
123 assert (0 && "I don't know how to print that");