Example #1
0
IoMap *getOpTable(IoObject *self, const char *slotName, IoMap *create(IoState *state))
{
	IoSymbol *symbol = IoState_symbolWithCString_(IOSTATE, slotName);
	IoObject *operators = IoObject_rawGetSlot_(self, symbol);

	if (operators && ISMAP(operators))
	{
		return operators;
	}
	else
	{
		// Not strictly correct as if the message has it's own empty
		// OperatorTable slot, we'll create one for it instead of using
		// Core Message OperatorTable operators. Oh well.

		IoMap *result = create(IOSTATE);
		IoObject_setSlot_to_(self, symbol, result);
		return result;
	}
}
Example #2
0
IoObject *IoMessage_locals_mapArgAt_(IoMessage *self, IoObject *locals, int n)
{
	IoObject *v = IoMessage_locals_valueArgAt_(self, locals, n);
	if (!ISMAP(v)) IoMessage_locals_numberArgAt_errorForType_(self, locals, n, "Map");
	return v;
}