2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program 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 * General Public License for more details.
17 static void cons_mark(void *addr)
19 struct ao_lisp_cons *cons = addr;
22 ao_lisp_poly_mark(cons->car);
23 cons = ao_lisp_poly_cons(cons->cdr);
26 if (ao_lisp_mark_memory(cons, sizeof (struct ao_lisp_cons)))
31 static int cons_size(void *addr)
34 return sizeof (struct ao_lisp_cons);
37 static void cons_move(void *addr)
39 struct ao_lisp_cons *cons = addr;
42 struct ao_lisp_cons *cdr;
44 cons->car = ao_lisp_poly_move(cons->car);
45 cdr = ao_lisp_poly_cons(cons->cdr);
46 cdr = ao_lisp_move_memory(cdr, sizeof (struct ao_lisp_cons));
49 cons->cdr = ao_lisp_cons_poly(cdr);
54 const struct ao_lisp_type ao_lisp_cons_type = {
61 ao_lisp_cons_cons(ao_poly car, struct ao_lisp_cons *cdr)
63 struct ao_lisp_cons *cons = ao_lisp_alloc(sizeof (struct ao_lisp_cons));
67 cons->cdr = ao_lisp_cons_poly(cdr);
72 ao_lisp_cons_print(ao_poly c)
74 struct ao_lisp_cons *cons = ao_lisp_poly_cons(c);
80 ao_lisp_poly_print(cons->car);
81 cons = ao_lisp_poly_cons(cons->cdr);