コード例 #1
0
void *
_MALLOC(
	size_t		size,
	int		type,
	int		flags)
{
	MDECL(size)	*mem;
	size_t		memsize = sizeof (*mem);

	if (type >= M_LAST)
		panic("_malloc TYPE");

	if (size == 0)
		return (NULL);

	if (flags & M_NOWAIT) {
		mem = (void *)kalloc_noblock(memsize);
	} else {
		mem = (void *)kalloc(memsize);
	}
	if (!mem)
		return (0);

	mem->hdr.mlen = memsize;

	if (flags & M_ZERO)
		bzero(mem->hdr.dat, size);

	return  (mem->hdr.dat);
}
コード例 #2
0
    int loopIdx;
    if (!PyArg_ParseTuple(args, "i", &loopIdx)) return NULL;
    g_music->deactivateAll(loopIdx);
    RetNone;
}
DECL(sc_loop_playing) // (int loopIdx, int tf)
{
    int loopIdx, tf;
    if (!PyArg_ParseTuple(args, "ii", &loopIdx, &tf )) return NULL;
    g_music->playing(loopIdx, tf);
    RetNone;
}

#define MDECL(s) {""#s, s, METH_VARARGS, "documentation of "#s"... nothing!"}
static PyMethodDef SpamMethods[] = {
    MDECL(sc_destroy),
    MDECL(sc_initialize),
    MDECL(sc_start),
    MDECL(sc_stop),

    MDECL(sc_setChannel),
    MDECL(sc_inputMessage),
    MDECL(sc_scoreEvent),

    MDECL(sc_getTickf),
    MDECL(sc_adjustTick),
    MDECL(sc_setTickDuration),

    MDECL(sc_loop_new),
    MDECL(sc_loop_delete),
    MDECL(sc_loop_getTickf),