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.
15 #include "ao_scheme.h"
19 ao_scheme_vprintf(const char *format, va_list args)
23 while ((c = *format++) != '\0') {
25 switch (c = *format++) {
27 ao_scheme_poly_write((ao_poly) va_arg(args, unsigned int), true);
30 ao_scheme_poly_write((ao_poly) va_arg(args, unsigned int), false);
33 printf("%p", va_arg(args, void *));
36 printf("%d", va_arg(args, int));
39 printf("%s", va_arg(args, char *));
51 ao_scheme_printf(const char *format, ...)
54 va_start(args, format);
55 ao_scheme_vprintf(format, args);
60 ao_scheme_error(int error, const char *format, ...)
64 ao_scheme_exception |= error;
65 va_start(args, format);
66 ao_scheme_vprintf(format, args);
69 ao_scheme_printf("Value: %v\n", ao_scheme_v);
70 ao_scheme_printf("Frame: %v\n", ao_scheme_frame_poly(ao_scheme_frame_current));
72 ao_scheme_stack_write(ao_scheme_stack_poly(ao_scheme_stack), true);
73 ao_scheme_printf("Globals: %v\n", ao_scheme_frame_poly(ao_scheme_frame_global));