view runtime/proghead.inc @ 269:632667d95d35

Improve message not implemented error message
author Michael Pavone <pavone@retrodev.com>
date Fri, 18 Jul 2014 19:31:07 -0700
parents ab7c142090a0
children
line wrap: on
line source
#include "object.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <gc/gc.h>

object * main_module;

char * methodNames[];

object * no_impl(uint32_t method_id, uint32_t num_args, object * self, va_list args)
{
	uint32_t *cur;
	int slot;
	fprintf(stderr, "method %s(%d) is not implemented on object %p\n", methodNames[method_id], method_id, self);
	fputs("Object implements:\n", stderr);
	for (slot = 0; slot < 16; slot++) {
		if (self->meta->methods[slot]) {
			for (cur = self->meta->methods[slot]; *cur != LAST_METHOD; cur++) {
				fprintf(stderr, "\t%s\n", methodNames[*cur]);
			}
		}
	}
	exit(1);
	return NULL;
}