Commits

illume committed 8749d7c

Changes from Marcus for ref counting bug fixes and
Also using METH_NOARGS for functions with no arguments.
Which should make some functions slightly faster.

Comments (0)

Files changed (31)

 /*
-    pygame - Python Game Library
-    Copyright (C) 2000-2001  Pete Shinners
+  pygame - Python Game Library
+  Copyright (C) 2000-2001  Pete Shinners
 
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
 
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-    Pete Shinners
-    pete@shinners.org
+  Pete Shinners
+  pete@shinners.org
 */
 #define NO_PYGAME_C_API
 #define PYGAMEAPI_BASE_INTERNAL
 
 /* This file controls all the initialization of
  * the module and the various SDL subsystems
-*/
+ */
 
 /*platform specific init stuff*/
 
 #define WIN32_LEAN_AND_MEAN
 #define VC_EXTRALEAN
 #include<windows.h>
-extern int SDL_RegisterApp(char*, Uint32, void*);
+extern int SDL_RegisterApp (char*, Uint32, void*);
 #endif
 
 #if defined(macintosh)
 
 static PyObject* quitfunctions = NULL;
 static PyObject* PyExc_SDLError;
-static void install_parachute(void);
-static void uninstall_parachute(void);
-static void atexit_quit(void);
+static void install_parachute (void);
+static void uninstall_parachute (void);
+static void atexit_quit (void);
+static int PyGame_Video_AutoInit (void);
+static void PyGame_Video_AutoQuit (void);
 
+static int
+CheckSDLVersions (void) /*compare compiled to linked*/
+{
+    SDL_version compiled;
+    const SDL_version* linked;
+    SDL_VERSION (&compiled);
+    linked = SDL_Linked_Version ();
 
-static int PyGame_Video_AutoInit(void);
-static void PyGame_Video_AutoQuit(void);
+    /*only check the major and minor version numbers.
+      we will relax any differences in 'patch' version.*/
 
-
-
-
-static int CheckSDLVersions(void) /*compare compiled to linked*/
-{
-	SDL_version compiled;
-	const SDL_version* linked;
-	SDL_VERSION(&compiled);
-	linked = SDL_Linked_Version();
-
-	/*only check the major and minor version numbers.
-	  we will relax any differences in 'patch' version.*/
-
-	if(compiled.major != linked->major || compiled.minor != linked->minor)
-	{
-		char err[1024];
-		sprintf(err, "SDL compiled with version %d.%d.%d, linked to %d.%d.%d",
-					compiled.major, compiled.minor, compiled.patch,
-					linked->major, linked->minor, linked->patch);
-		PyErr_SetString(PyExc_RuntimeError, err);
-		return 0;
-	}
-	return 1;
+    if (compiled.major != linked->major || compiled.minor != linked->minor)
+    {
+        char err[1024];
+        sprintf (err, "SDL compiled with version %d.%d.%d, linked to %d.%d.%d",
+                 compiled.major, compiled.minor, compiled.patch,
+                 linked->major, linked->minor, linked->patch);
+        PyErr_SetString (PyExc_RuntimeError, err);
+        return 0;
+    }
+    return 1;
 }
 
-
-void PyGame_RegisterQuit(void(*func)(void))
+void
+PyGame_RegisterQuit (void(*func)(void))
 {
-	PyObject* obj;
-	if(!quitfunctions)
-	{
-		quitfunctions = PyList_New(0);
-		if(!quitfunctions) return;
-	}
-	if(func)
-	{
-		obj = PyCObject_FromVoidPtr(func, NULL);
-		PyList_Append(quitfunctions, obj);
-	}
+    PyObject* obj;
+    if (!quitfunctions)
+    {
+        quitfunctions = PyList_New (0);
+        if (!quitfunctions)
+            return;
+    }
+    if (func)
+    {
+        obj = PyCObject_FromVoidPtr (func, NULL);
+        PyList_Append (quitfunctions, obj);
+        Py_DECREF (obj);
+    }
 }
 
-static PyObject* register_quit(PyObject* self, PyObject* arg)
+static PyObject*
+register_quit (PyObject* self, PyObject* arg)
 {
-	PyObject* quitfunc;
+    PyObject* quitfunc;
 
-	if(!PyArg_ParseTuple(arg, "O", &quitfunc))
-		return NULL;
+    if (!PyArg_ParseTuple (arg, "O", &quitfunc))
+        return NULL;
 
-	if(!quitfunctions)
-	{
-		quitfunctions = PyList_New(0);
-		if(!quitfunctions) return NULL;
-	}
-	PyList_Append(quitfunctions, quitfunc);
+    if (!quitfunctions)
+    {
+        quitfunctions = PyList_New (0);
+        if (!quitfunctions)
+            return NULL;
+    }
+    PyList_Append (quitfunctions, quitfunc);
 
-	Py_RETURN_NONE;
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+init (PyObject* self)
+{
+    PyObject *allmodules, *moduleslist, *dict, *func, *result, *mod;
+    int loop, num;
+    int success=0, fail=0;
 
-static PyObject* init(PyObject* self,PyObject* args)
-{
-	PyObject *allmodules, *moduleslist, *dict, *func, *result, *mod;
-	int loop, num;
-	int success=0, fail=0;
+    if (!CheckSDLVersions ())
+        return NULL;
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-	if(!CheckSDLVersions())
-		return NULL;
 
+    /*nice to initialize timer, so startup time will reflec init() time*/
+    SDL_Init (
+#if defined(WITH_THREAD) && !defined(MS_WIN32) && defined(SDL_INIT_EVENTTHREAD)
+        SDL_INIT_EVENTTHREAD |
+#endif
+        SDL_INIT_TIMER |
+        SDL_INIT_NOPARACHUTE);
 
-	/*nice to initialize timer, so startup time will reflec init() time*/
-	SDL_Init(
-#if defined(WITH_THREAD) && !defined(MS_WIN32) && defined(SDL_INIT_EVENTTHREAD)
-		SDL_INIT_EVENTTHREAD |
-#endif
-		SDL_INIT_TIMER |
-		SDL_INIT_NOPARACHUTE);
 
+    /* initialize all pygame modules */
+    allmodules = PyImport_GetModuleDict ();
+    moduleslist = PyDict_Values (allmodules);
+    if (!allmodules || !moduleslist)
+        return Py_BuildValue ("(ii)", 0, 0);
 
-/* initialize all pygame modules */
-	allmodules = PyImport_GetModuleDict();
-	moduleslist = PyDict_Values(allmodules);
-	if(!allmodules || !moduleslist)
-		return Py_BuildValue("(ii)", 0, 0);
+    if (PyGame_Video_AutoInit ())
+        ++success;
+    else
+        ++fail;
 
-	if(PyGame_Video_AutoInit())
-		++success;
-	else
-		++fail;
+    num = PyList_Size (moduleslist);
+    for (loop = 0; loop < num; ++loop)
+    {
+        mod = PyList_GET_ITEM (moduleslist, loop);
+        if (!mod || !PyModule_Check (mod))
+            continue;
+        dict = PyModule_GetDict (mod);
+        func = PyDict_GetItemString (dict, "__PYGAMEinit__");
+        if(func && PyCallable_Check (func))
+        {
+            result = PyObject_CallObject (func, NULL);
+            if (result && PyObject_IsTrue (result))
+                ++success;
+            else
+            {
+                PyErr_Clear ();
+                ++fail;
+            }
+            Py_XDECREF (result);
+        }
+    }
+    Py_DECREF (moduleslist);
 
-	num = PyList_Size(moduleslist);
-	for(loop = 0; loop < num; ++loop)
-	{
-		mod = PyList_GET_ITEM(moduleslist, loop);
-		if(!mod || !PyModule_Check(mod))
-			continue;
-		dict = PyModule_GetDict(mod);
-		func = PyDict_GetItemString(dict, "__PYGAMEinit__");
-		if(func && PyCallable_Check(func))
-		{
-			result = PyObject_CallObject(func, NULL);
-			if(result && PyObject_IsTrue(result))
-				++success;
-			else
-			{
-				PyErr_Clear();
-				++fail;
-			}
-			Py_XDECREF(result);
-		}
-	}
-	Py_DECREF(moduleslist);
-
-	return Py_BuildValue("(ii)", success, fail);
+    return Py_BuildValue ("(ii)", success, fail);
 }
 
+static void
+atexit_quit (void)
+{
+    PyObject* quit;
+    PyObject* privatefuncs;
+    int num;
 
-static void atexit_quit(void)
-{
-	PyObject* quit;
-	PyObject* privatefuncs;
-	int num;
+    if (!quitfunctions)
+        return;
 
-	if(!quitfunctions)
-		return;
+    privatefuncs = quitfunctions;
+    quitfunctions = NULL;
 
-	privatefuncs = quitfunctions;
-	quitfunctions = NULL;
+    uninstall_parachute ();
+    num = PyList_Size (privatefuncs);
 
-	uninstall_parachute();
-	num = PyList_Size(privatefuncs);
+    while (num--) /*quit in reverse order*/
+    {
+        quit = PyList_GET_ITEM (privatefuncs, num);
+        if (PyCallable_Check (quit))
+            PyObject_CallObject (quit, NULL);
+        else if (PyCObject_Check (quit))
+        {
+            void* ptr = PyCObject_AsVoidPtr (quit);
+            (*(void(*)(void)) ptr) ();
+        }
+    }
+    Py_DECREF (privatefuncs);
 
-	while(num--) /*quit in reverse order*/
-	{
-		quit = PyList_GET_ITEM(privatefuncs, num);
-		if(PyCallable_Check(quit))
-			PyObject_CallObject(quit, NULL);
-		else if(PyCObject_Check(quit))
-		{
-			void* ptr = PyCObject_AsVoidPtr(quit);
-			(*(void(*)(void))ptr)();
-		}
-	}
-	Py_DECREF(privatefuncs);
-
-        PyGame_Video_AutoQuit();
-	SDL_Quit();
+    PyGame_Video_AutoQuit ();
+    SDL_Quit ();
 }
 
-
-static PyObject* get_sdl_version(PyObject* self, PyObject* args)
+static PyObject*
+get_sdl_version (PyObject* self)
 {
-	const SDL_version *v;
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
+    const SDL_version *v;
 	
-	v = SDL_Linked_Version();
-	return Py_BuildValue("iii", v->major, v->minor, v->patch);
+    v = SDL_Linked_Version ();
+    return Py_BuildValue ("iii", v->major, v->minor, v->patch);
 }
 
-
-static PyObject* quit(PyObject* self, PyObject* args)
+static PyObject*
+quit (PyObject* self)
 {
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	atexit_quit();
-
-	Py_INCREF(Py_None);
-	return Py_None;
+    atexit_quit ();
+    Py_RETURN_NONE;
 }
 
+/* internal C API utility functions */
+static int
+IntFromObj (PyObject* obj, int* val)
+{
+    PyObject* intobj;
 
-
-
-/* internal C API utility functions */
-static int IntFromObj(PyObject* obj, int* val)
-{
-	PyObject* intobj;
-
-	if(PyNumber_Check(obj))
-	{
-		if(!(intobj = PyNumber_Int(obj)))
-                {
-                        PyErr_Clear();
-			return 0;
-                }
-		*val = PyInt_AsLong(intobj);
-		Py_DECREF(intobj);
-                if(PyErr_Occurred())
-                {
-                    PyErr_Clear();
-                    return 0;
-                }
-		return 1;
-	}
-	return 0;
+    if (PyNumber_Check (obj))
+    {
+        if (!(intobj = PyNumber_Int (obj)))
+        {
+            PyErr_Clear ();
+            return 0;
+        }
+        *val = PyInt_AsLong (intobj);
+        Py_DECREF (intobj);
+        if (PyErr_Occurred ())
+        {
+            PyErr_Clear ();
+            return 0;
+        }
+        return 1;
+    }
+    return 0;
 }
 
-static int IntFromObjIndex(PyObject* obj, int _index, int* val)
+static int
+IntFromObjIndex (PyObject* obj, int _index, int* val)
 {
-	int result = 0;
-	PyObject* item;
-	item = PySequence_GetItem(obj, _index);
-	if(item)
-	{
-		result = IntFromObj(item, val);
-		Py_DECREF(item);
-	}
-	return result;
+    int result = 0;
+    PyObject* item;
+    item = PySequence_GetItem (obj, _index);
+    if (item)
+    {
+        result = IntFromObj (item, val);
+        Py_DECREF (item);
+    }
+    return result;
 }
 
-static int TwoIntsFromObj(PyObject* obj, int* val1, int* val2)
+static int
+TwoIntsFromObj (PyObject* obj, int* val1, int* val2)
 {
-	if(PyTuple_Check(obj) && PyTuple_Size(obj)==1)
-		return TwoIntsFromObj(PyTuple_GET_ITEM(obj, 0), val1, val2);
+    if (PyTuple_Check (obj) && PyTuple_Size (obj) == 1)
+        return TwoIntsFromObj (PyTuple_GET_ITEM (obj, 0), val1, val2);
 
-	if(!PySequence_Check(obj) || PySequence_Length(obj) != 2)
-		return 0;
+    if (!PySequence_Check (obj) || PySequence_Length (obj) != 2)
+        return 0;
 
-	if(!IntFromObjIndex(obj, 0, val1) || !IntFromObjIndex(obj, 1, val2))
-		return 0;
+    if (!IntFromObjIndex (obj, 0, val1) || !IntFromObjIndex (obj, 1, val2))
+        return 0;
 
-	return 1;
+    return 1;
 }
 
+static int FloatFromObj (PyObject* obj, float* val)
+{
+    PyObject* floatobj;
 
-static int FloatFromObj(PyObject* obj, float* val)
-{
-	PyObject* floatobj;
-
-	if(PyNumber_Check(obj))
-	{
-		if(!(floatobj = PyNumber_Float(obj)))
-			return 0;
-		*val = (float)PyFloat_AsDouble(floatobj);
-		Py_DECREF(floatobj);
-		return 1;
-	}
-	return 0;
+    if (PyNumber_Check (obj))
+    {
+        if (!(floatobj = PyNumber_Float (obj)))
+            return 0;
+        *val = (float) PyFloat_AsDouble (floatobj);
+        Py_DECREF (floatobj);
+        return 1;
+    }
+    return 0;
 }
 
-static int FloatFromObjIndex(PyObject* obj, int _index, float* val)
+static int
+FloatFromObjIndex (PyObject* obj, int _index, float* val)
 {
-	int result = 0;
-	PyObject* item;
-	item = PySequence_GetItem(obj, _index);
-	if(item)
-	{
-		result = FloatFromObj(item, val);
-		Py_DECREF(item);
-	}
-	return result;
+    int result = 0;
+    PyObject* item;
+    item = PySequence_GetItem (obj, _index);
+    if (item)
+    {
+        result = FloatFromObj (item, val);
+        Py_DECREF (item);
+    }
+    return result;
 }
 
-static int TwoFloatsFromObj(PyObject* obj, float* val1, float* val2)
+static int
+TwoFloatsFromObj (PyObject* obj, float* val1, float* val2)
 {
-	if(PyTuple_Check(obj) && PyTuple_Size(obj)==1)
-		return TwoFloatsFromObj(PyTuple_GET_ITEM(obj, 0), val1, val2);
+    if (PyTuple_Check (obj) && PyTuple_Size (obj) == 1)
+        return TwoFloatsFromObj (PyTuple_GET_ITEM (obj, 0), val1, val2);
 
-	if(!PySequence_Check(obj) || PySequence_Length(obj) != 2)
-		return 0;
+    if (!PySequence_Check (obj) || PySequence_Length (obj) != 2)
+        return 0;
 
-	if(!FloatFromObjIndex(obj, 0, val1) || !FloatFromObjIndex(obj, 1, val2))
-		return 0;
+    if (!FloatFromObjIndex (obj, 0, val1) || !FloatFromObjIndex (obj, 1, val2))
+        return 0;
 
-	return 1;
+    return 1;
 }
 
+static int
+UintFromObj (PyObject* obj, Uint32* val)
+{
+    PyObject* intobj;
 
-static int UintFromObj(PyObject* obj, Uint32* val)
-{
-	PyObject* intobj;
-
-	if(PyNumber_Check(obj))
-	{
-		if(!(intobj = PyNumber_Int(obj)))
-			return 0;
-		*val = (Uint32)PyInt_AsLong(intobj);
-		Py_DECREF(intobj);
-		return 1;
-	}
-	return 0;
+    if (PyNumber_Check (obj))
+    {
+        if (!(intobj = PyNumber_Int (obj)))
+            return 0;
+        *val = (Uint32) PyInt_AsLong (intobj);
+        Py_DECREF (intobj);
+        return 1;
+    }
+    return 0;
 }
 
-static Uint32 UintFromObjIndex(PyObject* obj, int _index, Uint32* val)
+static Uint32
+UintFromObjIndex (PyObject* obj, int _index, Uint32* val)
 {
-	int result = 0;
-	PyObject* item;
-	item = PySequence_GetItem(obj, _index);
-	if(item)
-	{
-		result = UintFromObj(item, val);
-		Py_DECREF(item);
-	}
-	return result;
+    int result = 0;
+    PyObject* item;
+    item = PySequence_GetItem (obj, _index);
+    if (item)
+    {
+        result = UintFromObj (item, val);
+        Py_DECREF (item);
+    }
+    return result;
 }
 
-static int RGBAFromObj(PyObject* obj, Uint8* RGBA)
+static int
+RGBAFromObj (PyObject* obj, Uint8* RGBA)
 {
-	int length;
-	Uint32 val;
-	if(PyTuple_Check(obj) && PyTuple_Size(obj)==1)
-		return RGBAFromObj(PyTuple_GET_ITEM(obj, 0), RGBA);
+    int length;
+    Uint32 val;
+    if (PyTuple_Check (obj) && PyTuple_Size (obj) == 1)
+        return RGBAFromObj (PyTuple_GET_ITEM (obj, 0), RGBA);
 
-	if(!PySequence_Check(obj))
-		return 0;
+    if (!PySequence_Check (obj))
+        return 0;
 
-	length = PySequence_Length(obj);
-	if(length < 3 || length > 4)
-		return 0;
+    length = PySequence_Length (obj);
+    if (length < 3 || length > 4)
+        return 0;
 
-	if(!UintFromObjIndex(obj, 0, &val) || val > 255)
-		return 0;
-	RGBA[0] = (Uint8)val;
-	if(!UintFromObjIndex(obj, 1, &val) || val > 255)
-		return 0;
-	RGBA[1] = (Uint8)val;
-	if(!UintFromObjIndex(obj, 2, &val) || val > 255)
-		return 0;
-	RGBA[2] = (Uint8)val;
-	if(length == 4)
-	{
-		if(!UintFromObjIndex(obj, 3, &val) || val > 255)
-			return 0;
-		RGBA[3] = (Uint8)val;
-	}
-	else RGBA[3] = (Uint8)255;
+    if (!UintFromObjIndex (obj, 0, &val) || val > 255)
+        return 0;
+    RGBA[0] = (Uint8) val;
+    if (!UintFromObjIndex (obj, 1, &val) || val > 255)
+        return 0;
+    RGBA[1] = (Uint8) val;
+    if (!UintFromObjIndex (obj, 2, &val) || val > 255)
+        return 0;
+    RGBA[2] = (Uint8) val;
+    if (length == 4)
+    {
+        if (!UintFromObjIndex (obj, 3, &val) || val > 255)
+            return 0;
+        RGBA[3] = (Uint8) val;
+    }
+    else RGBA[3] = (Uint8) 255;
 
-	return 1;
+    return 1;
 }
 
-
-
-static PyObject* get_error(PyObject* self, PyObject* arg)
+static PyObject*
+get_error (PyObject* self)
 {
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-	return PyString_FromString(SDL_GetError());
+    return PyString_FromString (SDL_GetError ());
 }
 
-
-
-
 /*video init needs to be here, because of it's
  *important init order priority
  */
-static void PyGame_Video_AutoQuit(void)
+static void
+PyGame_Video_AutoQuit (void)
 {
-	if(SDL_WasInit(SDL_INIT_VIDEO))
-		SDL_QuitSubSystem(SDL_INIT_VIDEO);
+    if (SDL_WasInit (SDL_INIT_VIDEO))
+        SDL_QuitSubSystem (SDL_INIT_VIDEO);
 }
 
-static int PyGame_Video_AutoInit(void)
+static int
+PyGame_Video_AutoInit (void)
 {
-	if(!SDL_WasInit(SDL_INIT_VIDEO))
-	{
-		int status;
+    if (!SDL_WasInit (SDL_INIT_VIDEO))
+    {
+        int status;
 #if defined(__APPLE__) && defined(darwin)
-		PyObject *module;
-		PyObject *rval;
-		module = PyImport_ImportModule("pygame.macosx");
-		if (!module) {
-			return -1;
-		}
-		rval = PyObject_CallMethod(module, "init", "");
-		Py_DECREF(module);
-		if (!rval) {
-			return -1;
-		}
-		status = PyObject_IsTrue(rval);
-		Py_DECREF(rval);
-		if (status != 1) {
-			return 0;
-		}
+        PyObject *module;
+        PyObject *rval;
+        module = PyImport_ImportModule ("pygame.macosx");
+        if (!module)
+            return -1;
+
+        rval = PyObject_CallMethod (module, "init", "");
+        Py_DECREF (module);
+        if (!rval)
+            return -1;
+
+        status = PyObject_IsTrue (rval);
+        Py_DECREF (rval);
+        if (status != 1)
+            return 0;
 #endif
-		status = SDL_InitSubSystem(SDL_INIT_VIDEO);
-		if(status)
-			return 0;
-		SDL_EnableUNICODE(1);
-                /*we special case the video quit to last now*/
-		/*PyGame_RegisterQuit(PyGame_Video_AutoQuit);*/
-	}
-	return 1;
+        status = SDL_InitSubSystem (SDL_INIT_VIDEO);
+        if (status)
+            return 0;
+        SDL_EnableUNICODE (1);
+        /*we special case the video quit to last now*/
+        /*PyGame_RegisterQuit(PyGame_Video_AutoQuit);*/
+    }
+    return 1;
 }
 
-
-#if 0
-#include<pystate.h>
-#include<compile.h>
-#include<frameobject.h>
-
-#ifdef MPW
-	/* This is needed by MPW's File and Line commands */
-#define FMT "  File \"%.500s\"; line %d # in %.500s\n"
-#else
-	/* This is needed by Emacs' compile command */
-#define FMT "  File \"%.500s\", line %d, in %.500s\n"
-#endif
-
-static void print_traceback(PyObject *tb)
+/*error signal handlers (replacing SDL parachute)*/
+static void
+pygame_parachute (int sig)
 {
-    PyObject *next;
-    while(tb && tb != Py_None)
+    char* signaltype;
+    
+    signal (sig, SIG_DFL);
+    switch (sig)
     {
-	    PyFrameObject *frame;
-	    PyObject *getobj;
-	    int line, lasti;
-	    const char *filename, *name;
-
-	    frame = (PyFrameObject*)PyObject_GetAttrString(tb, "tb_frame");
-	    Py_DECREF(frame); //won't really kill it
-	    getobj = PyObject_GetAttrString(tb, "tb_lineno");
-	    line = PyInt_AsLong(getobj);
-	    Py_DECREF(getobj);
-
-	    filename = PyString_AsString(frame->f_code->co_filename);
-	    name = PyString_AsString(frame->f_code->co_name);
-	    if (Py_OptimizeFlag)
-	    {
-		    getobj = PyObject_GetAttrString(tb, "tb_lasti");
-		    lasti = PyInt_AsLong(getobj);
-		    Py_DECREF(getobj);
-		    line = PyCode_Addr2Line(frame->f_code, lasti);
-	    }
-	    fprintf(stderr, FMT, filename, line, name);
-	    next = PyObject_GetAttrString(tb, "tb_next");
-	    Py_DECREF(tb);
-	    tb = next;
-    }
-}
-#endif
-
-/*error signal handlers (replacing SDL parachute)*/
-static void pygame_parachute(int sig)
-{
-	char* signaltype;
-#if 0
-	PyThreadState* thread;
-	PyInterpreterState *interp;
-	int thread_id;
-#endif
-    
-	signal(sig, SIG_DFL);
-	switch (sig)
-	{
-		case SIGSEGV:
-			signaltype = "(pygame parachute) Segmentation Fault"; break;
+    case SIGSEGV:
+        signaltype = "(pygame parachute) Segmentation Fault";
+        break;
 #ifdef SIGBUS
 #if SIGBUS != SIGSEGV
-		case SIGBUS:
-			signaltype = "(pygame parachute) Bus Error"; break;
+    case SIGBUS:
+        signaltype = "(pygame parachute) Bus Error";
+        break;
 #endif
 #endif
 #ifdef SIGFPE
-		case SIGFPE:
-			signaltype = "(pygame parachute) Floating Point Exception"; break;
+    case SIGFPE:
+        signaltype = "(pygame parachute) Floating Point Exception";
+        break;
 #endif
 #ifdef SIGQUIT
-		case SIGQUIT:
-			signaltype = "(pygame parachute) Keyboard Abort"; break;
+    case SIGQUIT:
+        signaltype = "(pygame parachute) Keyboard Abort";
+        break;
 #endif
-		default:
-			signaltype = "(pygame parachute) Unknown Signal"; break;
-	}
+    default:
+        signaltype = "(pygame parachute) Unknown Signal";
+        break;
+    }
 
-#if 0
-/*this traceback hacking has gotten a bit treacherous*/
-	printf("Pygame Parachute Traceback:\n");
-	interp = PyInterpreterState_Head();
-	thread=PyInterpreterState_ThreadHead(interp);
-	if(PyThreadState_Next(thread)) /*multithreaded*/
-	    thread_id = 0;
-	else
-	    thread_id = -1; /*no threads, don't print thread info*/
-	for(; thread; thread = PyThreadState_Next(thread))
-	{
-	    if(thread_id >= 0)
-	    {
-		printf("Thread-%p\n", thread);
-		thread_id++;
-	    }
-	    PyTraceBack_Here(thread->frame);
-	    Py_INCREF(thread->curexc_traceback);
-	    print_traceback(thread->curexc_traceback);
-	}
-#endif
-	atexit_quit();
-	Py_FatalError(signaltype);
+    atexit_quit ();
+    Py_FatalError (signaltype);
 }
 
-
 static int fatal_signals[] =
 {
-	SIGSEGV,
+    SIGSEGV,
 #ifdef SIGBUS
-	SIGBUS,
+    SIGBUS,
 #endif
 #ifdef SIGFPE
-	SIGFPE,
+    SIGFPE,
 #endif
 #ifdef SIGQUIT
-	SIGQUIT,
+    SIGQUIT,
 #endif
-	0 /*end of list*/
+    0 /*end of list*/
 };
 
 static int parachute_installed = 0;
-static void install_parachute(void)
+static void
+install_parachute (void)
 {
-	int i;
-	void (*ohandler)(int);
+    int i;
+    void (*ohandler)(int);
 
-	if(parachute_installed)
-	    return;
-	parachute_installed = 1;
+    if (parachute_installed)
+        return;
+    parachute_installed = 1;
 
-	/* Set a handler for any fatal signal not already handled */
-	for ( i=0; fatal_signals[i]; ++i )
-	{
-		ohandler = signal(fatal_signals[i], pygame_parachute);
-		if ( ohandler != SIG_DFL )
-			signal(fatal_signals[i], ohandler);
-	}
+    /* Set a handler for any fatal signal not already handled */
+    for (i = 0; fatal_signals[i]; ++i)
+    {
+        ohandler = signal (fatal_signals[i], pygame_parachute);
+        if (ohandler != SIG_DFL)
+            signal (fatal_signals[i], ohandler);
+    }
 #ifdef SIGALRM
-	{/* Set SIGALRM to be ignored -- necessary on Solaris */
-		struct sigaction action, oaction;
-		/* Set SIG_IGN action */
-		memset(&action, 0, (sizeof action));
-		action.sa_handler = SIG_IGN;
-		sigaction(SIGALRM, &action, &oaction);
-		/* Reset original action if it was already being handled */
-		if ( oaction.sa_handler != SIG_DFL )
-			sigaction(SIGALRM, &oaction, NULL);
-	}
+    {/* Set SIGALRM to be ignored -- necessary on Solaris */
+        struct sigaction action, oaction;
+        /* Set SIG_IGN action */
+        memset (&action, 0, (sizeof action));
+        action.sa_handler = SIG_IGN;
+        sigaction (SIGALRM, &action, &oaction);
+        /* Reset original action if it was already being handled */
+        if (oaction.sa_handler != SIG_DFL)
+            sigaction (SIGALRM, &oaction, NULL);
+    }
 #endif
-	return;
+    return;
 }
 
+static void
+uninstall_parachute (void)
+{
+    int i;
+    void (*ohandler)(int);
 
-static void uninstall_parachute(void)
-{
-	int i;
-	void (*ohandler)(int);
+    if (!parachute_installed)
+        return;
+    parachute_installed = 0;
 
-	if(!parachute_installed)
-	    return;
-	parachute_installed = 0;
-
-	/* Remove a handler for any fatal signal handled */
-	for ( i=0; fatal_signals[i]; ++i ) {
-		ohandler = signal(fatal_signals[i], SIG_DFL);
-		if ( ohandler != pygame_parachute )
-			signal(fatal_signals[i], ohandler);
-	}
+    /* Remove a handler for any fatal signal handled */
+    for (i = 0; fatal_signals[i]; ++i)
+    {
+        ohandler = signal (fatal_signals[i], SIG_DFL);
+        if (ohandler != pygame_parachute)
+            signal (fatal_signals[i], ohandler);
+    }
 }
 
-
-
-
 /* bind functions to python */
 
-static PyObject* do_segfault(PyObject* self, PyObject* args)
+static PyObject*
+do_segfault (PyObject* self)
 {
     //force crash
     *((int*)1) = 45;
-    memcpy((char*)2, (char*)3, 10);
+    memcpy ((char*)2, (char*)3, 10);
     Py_RETURN_NONE;
 }
 
-
 static PyMethodDef init__builtins__[] =
 {
-	{ "init", init, 1, DOC_PYGAMEINIT },
-	{ "quit", quit, 1, DOC_PYGAMEQUIT },
-	{ "register_quit", register_quit, 1, DOC_PYGAMEREGISTERQUIT },
-	{ "get_error", get_error, 1, DOC_PYGAMEGETERROR },
-	{ "get_sdl_version", get_sdl_version, 1, DOC_PYGAMEGETSDLVERSION },
+    { "init", (PyCFunction) init, METH_NOARGS, DOC_PYGAMEINIT },
+    { "quit", (PyCFunction) quit, METH_NOARGS, DOC_PYGAMEQUIT },
+    { "register_quit", register_quit, METH_VARARGS, DOC_PYGAMEREGISTERQUIT },
+    { "get_error", (PyCFunction) get_error, METH_NOARGS, DOC_PYGAMEGETERROR },
+    { "get_sdl_version", (PyCFunction) get_sdl_version, METH_NOARGS,
+      DOC_PYGAMEGETSDLVERSION },
 
-	{ "segfault", do_segfault, 1, "crash" },
-	{ NULL, NULL, 0, NULL }
+    { "segfault", (PyCFunction) do_segfault, METH_NOARGS, "crash" },
+    { NULL, NULL, 0, NULL }
 };
 
-
-
 PYGAME_EXPORT
-void initbase(void)
+void initbase (void)
 {
-	PyObject *module, *dict, *apiobj;
-	static void* c_api[PYGAMEAPI_BASE_NUMSLOTS];
+    PyObject *module, *dict, *apiobj;
+    static void* c_api[PYGAMEAPI_BASE_NUMSLOTS];
 
     /* create the module */
-	module = Py_InitModule3("base", init__builtins__, DOC_PYGAME);
-	dict = PyModule_GetDict(module);
+    module = Py_InitModule3 ("base", init__builtins__, DOC_PYGAME);
+    dict = PyModule_GetDict (module);
 
-	/* create the exceptions */
-	PyExc_SDLError = PyErr_NewException("pygame.error", PyExc_RuntimeError, NULL);
-	PyDict_SetItemString(dict, "error", PyExc_SDLError);
-	Py_DECREF(PyExc_SDLError);
+    /* create the exceptions */
+    PyExc_SDLError = PyErr_NewException ("pygame.error", PyExc_RuntimeError,
+                                         NULL);
+    PyDict_SetItemString (dict, "error", PyExc_SDLError);
+    Py_DECREF (PyExc_SDLError);
 
-	/* export the c api */
-	c_api[0] = PyExc_SDLError;
-	c_api[1] = PyGame_RegisterQuit;
-	c_api[2] = IntFromObj;
-	c_api[3] = IntFromObjIndex;
-	c_api[4] = TwoIntsFromObj;
-	c_api[5] = FloatFromObj;
-	c_api[6] = FloatFromObjIndex;
-	c_api[7] = TwoFloatsFromObj;
-	c_api[8] = UintFromObj;
-	c_api[9] = UintFromObjIndex;
-	c_api[10] = PyGame_Video_AutoQuit;
-	c_api[11] = PyGame_Video_AutoInit;
-	c_api[12] = RGBAFromObj;
-	apiobj = PyCObject_FromVoidPtr(c_api, NULL);
-	PyDict_SetItemString(dict, PYGAMEAPI_LOCAL_ENTRY, apiobj);
-	Py_DECREF(apiobj);
+    /* export the c api */
+    c_api[0] = PyExc_SDLError;
+    c_api[1] = PyGame_RegisterQuit;
+    c_api[2] = IntFromObj;
+    c_api[3] = IntFromObjIndex;
+    c_api[4] = TwoIntsFromObj;
+    c_api[5] = FloatFromObj;
+    c_api[6] = FloatFromObjIndex;
+    c_api[7] = TwoFloatsFromObj;
+    c_api[8] = UintFromObj;
+    c_api[9] = UintFromObjIndex;
+    c_api[10] = PyGame_Video_AutoQuit;
+    c_api[11] = PyGame_Video_AutoInit;
+    c_api[12] = RGBAFromObj;
+    apiobj = PyCObject_FromVoidPtr (c_api, NULL);
+    PyDict_SetItemString (dict, PYGAMEAPI_LOCAL_ENTRY, apiobj);
+    Py_DECREF (apiobj);
 
-	/*some intiialization*/
-	Py_AtExit(atexit_quit);
-	install_parachute();
+    /*some intiialization*/
+    Py_AtExit (atexit_quit);
+    install_parachute ();
 #ifdef MS_WIN32
-	SDL_RegisterApp("pygame", 0, GetModuleHandle(NULL));
+    SDL_RegisterApp ("pygame", 0, GetModuleHandle (NULL));
 #endif
 #if defined(macintosh)
 #if(!defined(__MWERKS__) && !TARGET_API_MAC_CARBON)
-	SDL_InitQuickDraw(&qd);
+    SDL_InitQuickDraw (&qd);
 #endif
 #endif
 }
-
 /*
-    pygame - Python Game Library
-    Copyright (C) 2000-2001  Pete Shinners
+  pygame - Python Game Library
+  Copyright (C) 2000-2001  Pete Shinners
 
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
 
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-    Pete Shinners
-    pete@shinners.org
+  Pete Shinners
+  pete@shinners.org
 */
 
 #define PYGAMEAPI_CDROM_INTERNAL
 #include "pygame.h"
 #include "pygamedocs.h"
 
-
 #define CDROM_MAXDRIVES 32
 static SDL_CD* cdrom_drivedata[CDROM_MAXDRIVES] = {NULL};
-
-
 staticforward PyTypeObject PyCD_Type;
 static PyObject* PyCD_New(int id);
 #define PyCD_Check(x) ((x)->ob_type == &PyCD_Type)
 
+static void
+cdrom_autoquit (void)
+{
+    int loop;
+    for (loop = 0; loop < CDROM_MAXDRIVES; ++loop)
+    {
+        if (cdrom_drivedata[loop])
+        {
+            SDL_CDClose (cdrom_drivedata[loop]);
+            cdrom_drivedata[loop] = NULL;
+        }
+    }
 
-
-static void cdrom_autoquit(void)
-{
-	int loop;
-	for(loop = 0; loop < CDROM_MAXDRIVES; ++loop)
-	{
-		if(cdrom_drivedata[loop])
-		{
-			SDL_CDClose(cdrom_drivedata[loop]);
-			cdrom_drivedata[loop] = NULL;
-		}
-	}
-
-	if(SDL_WasInit(SDL_INIT_CDROM))
-		SDL_QuitSubSystem(SDL_INIT_CDROM);
+    if (SDL_WasInit (SDL_INIT_CDROM))
+        SDL_QuitSubSystem (SDL_INIT_CDROM);
 }
 
-static PyObject* cdrom_autoinit(PyObject* self, PyObject* arg)
+static PyObject*
+cdrom_autoinit (PyObject* self)
 {
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	if(!SDL_WasInit(SDL_INIT_CDROM))
-	{
-		if(SDL_InitSubSystem(SDL_INIT_CDROM))
-			return PyInt_FromLong(0);
-		PyGame_RegisterQuit(cdrom_autoquit);
-	}
-	return PyInt_FromLong(1);
+    if (!SDL_WasInit (SDL_INIT_CDROM))
+    {
+        if (SDL_InitSubSystem (SDL_INIT_CDROM))
+            return PyInt_FromLong (0);
+        PyGame_RegisterQuit (cdrom_autoquit);
+    }
+    return PyInt_FromLong (1);
 }
 
-
-static PyObject* cdrom_quit(PyObject* self, PyObject* arg)
+static PyObject*
+cdrom_quit (PyObject* self)
 {
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	cdrom_autoquit();
-
-	Py_RETURN_NONE;
+    cdrom_autoquit ();
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cdrom_init (PyObject* self)
+{
+    PyObject* result;
+    int istrue;
 
-static PyObject* cdrom_init(PyObject* self, PyObject* arg)
-{
-	PyObject* result;
-	int istrue;
-
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	result = cdrom_autoinit(self, arg);
-	istrue = PyObject_IsTrue(result);
-	Py_DECREF(result);
-	if(!istrue)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    result = cdrom_autoinit (self);
+    istrue = PyObject_IsTrue (result);
+    Py_DECREF (result);
+    if (!istrue)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
+    Py_RETURN_NONE;
 }
 
-
-static PyObject* get_init(PyObject* self, PyObject* arg)
+static PyObject*
+get_init (PyObject* self)
 {
-	if(!PyArg_ParseTuple(arg, ""))
-		return NULL;
-
-	return PyInt_FromLong(SDL_WasInit(SDL_INIT_CDROM)!=0);
+    return PyInt_FromLong (SDL_WasInit (SDL_INIT_CDROM) != 0);
 }
 
-
-static void cd_dealloc(PyObject* self)
+static void
+cd_dealloc (PyObject* self)
 {
-	PyObject_DEL(self);
+    PyObject_DEL (self);
 }
 
+static PyObject*
+CD (PyObject* self, PyObject* args)
+{
+    int id;
+    if (!PyArg_ParseTuple (args, "i", &id))
+        return NULL;
 
-static PyObject* CD(PyObject* self, PyObject* args)
-{
-	int id;
-	if(!PyArg_ParseTuple(args, "i", &id))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-
-	return PyCD_New(id);
+    CDROM_INIT_CHECK ();
+    return PyCD_New (id);
 }
 
-
-static PyObject* get_count(PyObject* self, PyObject* args)
+static PyObject*
+get_count (PyObject* self)
 {
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-
-	return PyInt_FromLong(SDL_CDNumDrives());
+    CDROM_INIT_CHECK ();
+    return PyInt_FromLong (SDL_CDNumDrives ());
 }
 
+static PyObject*
+cd_init (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
 
-static PyObject* cd_init(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom_drivedata[cd_id])
-	{
-		cdrom_drivedata[cd_id] = SDL_CDOpen(cd_id);
-                if(!cdrom_drivedata[cd_id])
-			return RAISE(PyExc_SDLError, "Cannot initialize device");
-	}
-	Py_RETURN_NONE;
+    CDROM_INIT_CHECK ();
+    if (!cdrom_drivedata[cd_id])
+    {
+        cdrom_drivedata[cd_id] = SDL_CDOpen (cd_id);
+        if (!cdrom_drivedata[cd_id])
+            return RAISE (PyExc_SDLError, "Cannot initialize device");
+    }
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_quit (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
 
-static PyObject* cd_quit(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
+    CDROM_INIT_CHECK ();
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-
-	if(cdrom_drivedata[cd_id])
-	{
-		SDL_CDClose(cdrom_drivedata[cd_id]);
-		cdrom_drivedata[cd_id] = NULL;
-	}
-	Py_RETURN_NONE;
+    if (cdrom_drivedata[cd_id])
+    {
+        SDL_CDClose (cdrom_drivedata[cd_id]);
+        cdrom_drivedata[cd_id] = NULL;
+    }
+    Py_RETURN_NONE;
 }
 
-
-static PyObject* cd_get_init(PyObject* self, PyObject* args)
+static PyObject*
+cd_get_init (PyObject* self)
 {
-	int cd_id = PyCD_AsID(self);
-
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	return PyInt_FromLong(cdrom_drivedata[cd_id] != NULL);
+    int cd_id = PyCD_AsID (self);
+    return PyInt_FromLong (cdrom_drivedata[cd_id] != NULL);
 }
 
+static PyObject*
+cd_play (PyObject* self, PyObject* args)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int result, track, startframe, numframes, playforever=0;
+    float start=0.0f, end=0.0f;
+    PyObject *endobject=NULL;
 
-static PyObject* cd_play(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int result, track, startframe, numframes, playforever=0;
-	float start=0.0f, end=0.0f;
-	PyObject *endobject=NULL;
+    if (!PyArg_ParseTuple (args, "i|fO", &track, &start, &endobject))
+        return NULL;
+    if (endobject == Py_None)
+        playforever = 1;
+    else if (!PyArg_ParseTuple (args, "i|ff", &track, &start, &end))
+        return NULL;
 
-	if(!PyArg_ParseTuple(args, "i|fO", &track, &start, &endobject))
-	    return NULL;
-	if(endobject == Py_None)
-	    playforever = 1;
-	else if(!PyArg_ParseTuple(args, "i|ff", &track, &start, &end))
-	    return NULL;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
+    SDL_CDStatus (cdrom);
+    if (track < 0 || track >= cdrom->numtracks)
+        return RAISE (PyExc_IndexError, "Invalid track number");
+    if (cdrom->track[track].type != SDL_AUDIO_TRACK)
+        return RAISE (PyExc_SDLError, "CD track type is not audio");
+	
+    /*validate times*/
+    if (playforever)
+        end = start;
+    else if (start == end && start != 0.0f)
+        Py_RETURN_NONE;
+	
+    startframe = (int)(start * CD_FPS);
+    numframes = 0;
+    if (startframe < 0)
+        startframe = 0;
+    if (end)
+        numframes = (int) ((end-start) * CD_FPS);
+    else
+        numframes = cdrom->track[track].length - startframe;
+    if (numframes < 0 ||
+        startframe > (int) (cdrom->track[track].length * CD_FPS))
+        Py_RETURN_NONE;
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-	SDL_CDStatus(cdrom);
-	if(track < 0 || track >= cdrom->numtracks)
-		return RAISE(PyExc_IndexError, "Invalid track number");
-	if(cdrom->track[track].type != SDL_AUDIO_TRACK)
-		return RAISE(PyExc_SDLError, "CD track type is not audio");
-	
-	/*validate times*/
-	if(playforever)
-	    end = start;
-	else if(start == end && start != 0.0f)
-	    Py_RETURN_NONE;;
-	
-	startframe = (int)(start * CD_FPS);
-	numframes = 0;
-	if(startframe < 0)
-		startframe = 0;
-	if(end)
-		numframes = (int)((end-start) * CD_FPS);
-	else
-		numframes = cdrom->track[track].length - startframe;
-	if(numframes < 0 || startframe > (int)(cdrom->track[track].length * CD_FPS))
-		Py_RETURN_NONE;;
+    result = SDL_CDPlayTracks (cdrom, track, startframe, 0, numframes);
+    if (result == -1)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
 
-	result = SDL_CDPlayTracks(cdrom, track, startframe, 0, numframes);
-	if(result == -1)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_pause (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int result;
 
-static PyObject* cd_pause(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int result;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	result = SDL_CDPause(cdrom);
-	if(result == -1)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    result = SDL_CDPause (cdrom);
+    if (result == -1)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_resume (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int result;
 
-static PyObject* cd_resume(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int result;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	result = SDL_CDResume(cdrom);
-	if(result == -1)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    result = SDL_CDResume (cdrom);
+    if (result == -1)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_stop (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int result;
 
-static PyObject* cd_stop(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int result;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	result = SDL_CDStop(cdrom);
-	if(result == -1)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    result = SDL_CDStop (cdrom);
+    if (result == -1)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_eject (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int result;
 
-static PyObject* cd_eject(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int result;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
+    result = SDL_CDEject (cdrom);
+    if (result == -1)
+        return RAISE (PyExc_SDLError, SDL_GetError ());
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	result = SDL_CDEject(cdrom);
-	if(result == -1)
-		return RAISE(PyExc_SDLError, SDL_GetError());
-
-	Py_RETURN_NONE;
+    Py_RETURN_NONE;
 }
 
+static PyObject*
+cd_get_empty (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int status;
 
-static PyObject* cd_get_empty(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int status;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	status = SDL_CDStatus(cdrom);
-	return PyInt_FromLong(status == CD_TRAYEMPTY);
+    status = SDL_CDStatus (cdrom);
+    return PyInt_FromLong (status == CD_TRAYEMPTY);
 }
 
+static PyObject*
+cd_get_busy (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int status;
 
-static PyObject* cd_get_busy(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int status;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	status = SDL_CDStatus(cdrom);
-	return PyInt_FromLong(status == CD_PLAYING);
+    status = SDL_CDStatus (cdrom);
+    return PyInt_FromLong (status == CD_PLAYING);
 }
 
+static PyObject*
+cd_get_paused (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int status;
 
-static PyObject* cd_get_paused(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int status;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	status = SDL_CDStatus(cdrom);
-	return PyInt_FromLong(status == CD_PAUSED);
+    status = SDL_CDStatus (cdrom);
+    return PyInt_FromLong (status == CD_PAUSED);
 }
 
 
-static PyObject* cd_get_current(PyObject* self, PyObject* args)
+static PyObject*
+cd_get_current (PyObject* self)
 {
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int track;
-	float seconds;
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int track;
+    float seconds;
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
+    SDL_CDStatus (cdrom);
+    track = cdrom->cur_track;
+    seconds = cdrom->cur_frame / (float) CD_FPS;
 
-	SDL_CDStatus(cdrom);
-	track = cdrom->cur_track;
-	seconds = cdrom->cur_frame / (float)CD_FPS;
-
-	return Py_BuildValue("(if)", track, seconds);
+    return Py_BuildValue ("(if)", track, seconds);
 }
 
+static PyObject*
+cd_get_numtracks (PyObject* self)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
 
-static PyObject* cd_get_numtracks(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	SDL_CDStatus(cdrom);
-	return PyInt_FromLong(cdrom->numtracks);
+    SDL_CDStatus (cdrom);
+    return PyInt_FromLong (cdrom->numtracks);
 }
 
-
-static PyObject* cd_get_id(PyObject* self, PyObject* args)
+static PyObject*
+cd_get_id (PyObject* self)
 {
-	int cd_id = PyCD_AsID(self);
-
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-	return PyInt_FromLong(cd_id);
+    int cd_id = PyCD_AsID (self);
+    return PyInt_FromLong (cd_id);
 }
 
-
-static PyObject* cd_get_name(PyObject* self, PyObject* args)
+static PyObject*
+cd_get_name (PyObject* self)
 {
-	int cd_id = PyCD_AsID(self);
-
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-
-	return PyString_FromString(SDL_CDName(cd_id));
+    int cd_id = PyCD_AsID (self);
+    CDROM_INIT_CHECK ();
+    return PyString_FromString (SDL_CDName (cd_id));
 }
 
+static PyObject*
+cd_get_track_audio (PyObject* self, PyObject* args)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int track;
 
-static PyObject* cd_get_track_audio(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int track;
+    if (!PyArg_ParseTuple (args, "i", &track))
+        return NULL;
 
-	if(!PyArg_ParseTuple(args, "i", &track))
-		return NULL;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
+    SDL_CDStatus (cdrom);
+    if (track < 0 || track >= cdrom->numtracks)
+        return RAISE (PyExc_IndexError, "Invalid track number");
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-	SDL_CDStatus(cdrom);
-	if(track < 0 || track >= cdrom->numtracks)
-		return RAISE(PyExc_IndexError, "Invalid track number");
-
-	return PyInt_FromLong(cdrom->track[track].type == SDL_AUDIO_TRACK);
+    return PyInt_FromLong (cdrom->track[track].type == SDL_AUDIO_TRACK);
 }
 
+static PyObject*
+cd_get_track_length (PyObject* self, PyObject* args)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int track;
 
-static PyObject* cd_get_track_length(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int track;
+    if (!PyArg_ParseTuple (args, "i", &track))
+        return NULL;
 
-	if(!PyArg_ParseTuple(args, "i", &track))
-		return NULL;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
+    SDL_CDStatus (cdrom);
+    if (track < 0 || track >= cdrom->numtracks)
+        return RAISE (PyExc_IndexError, "Invalid track number");
+    if (cdrom->track[track].type != SDL_AUDIO_TRACK)
+        return PyFloat_FromDouble (0.0);
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-	SDL_CDStatus(cdrom);
-	if(track < 0 || track >= cdrom->numtracks)
-		return RAISE(PyExc_IndexError, "Invalid track number");
-	if(cdrom->track[track].type != SDL_AUDIO_TRACK)
-		return PyFloat_FromDouble(0.0);
-
-	return PyFloat_FromDouble(cdrom->track[track].length / (double)CD_FPS);
+    return PyFloat_FromDouble (cdrom->track[track].length / (double) CD_FPS);
 }
 
-static PyObject* cd_get_track_start(PyObject* self, PyObject* args)
+static PyObject*
+cd_get_track_start (PyObject* self, PyObject* args)
 {
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int track;
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int track;
 
-	if(!PyArg_ParseTuple(args, "i", &track))
-		return NULL;
+    if (!PyArg_ParseTuple (args, "i", &track))
+        return NULL;
 
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-	SDL_CDStatus(cdrom);
-	if(track < 0 || track >= cdrom->numtracks)
-		return RAISE(PyExc_IndexError, "Invalid track number");
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
+    SDL_CDStatus (cdrom);
+    if (track < 0 || track >= cdrom->numtracks)
+        return RAISE (PyExc_IndexError, "Invalid track number");
 
-	return PyFloat_FromDouble(cdrom->track[track].offset / (double)CD_FPS);
+    return PyFloat_FromDouble (cdrom->track[track].offset / (double) CD_FPS);
 }
 
+static PyObject*
+cd_get_all (PyObject* self, PyObject* args)
+{
+    int cd_id = PyCD_AsID (self);
+    SDL_CD* cdrom = cdrom_drivedata[cd_id];
+    int track;
+    PyObject *tuple, *item;
 
-static PyObject* cd_get_all(PyObject* self, PyObject* args)
-{
-	int cd_id = PyCD_AsID(self);
-	SDL_CD* cdrom = cdrom_drivedata[cd_id];
-	int track;
-	PyObject *tuple, *item;
+    CDROM_INIT_CHECK ();
+    if (!cdrom)
+        return RAISE (PyExc_SDLError, "CD drive not initialized");
 
-	if(!PyArg_ParseTuple(args, ""))
-		return NULL;
-
-	CDROM_INIT_CHECK();
-	if(!cdrom)
-		return RAISE(PyExc_SDLError, "CD drive not initialized");
-
-	SDL_CDStatus(cdrom);
-	tuple = PyTuple_New(cdrom->numtracks);
-	if(!tuple)
-		return NULL;
-	for(track=0; track < cdrom->numtracks; track++)
-	{
-		int audio = cdrom->track[track].type == SDL_AUDIO_TRACK;
-		double start = cdrom->track[track].offset / (double)CD_FPS;
-		double length = cdrom->track[track].length / (double)CD_FPS;
-		double end = start + length;
-		item = PyTuple_New(4);
-		if(!item)
-		{
-			Py_DECREF(tuple);
-			return NULL;
-		}
-		PyTuple_SET_ITEM(item, 0, PyInt_FromLong(audio));
-		PyTuple_SET_ITEM(item, 1, PyFloat_FromDouble(start));
-		PyTuple_SET_ITEM(item, 2, PyFloat_FromDouble(end));
-		PyTuple_SET_ITEM(item, 3, PyFloat_FromDouble(length));
-		PyTuple_SET_ITEM(tuple, track, item);
-	}
-
-	return tuple;
+    SDL_CDStatus (cdrom);
+    tuple = PyTuple_New (cdrom->numtracks);
+    if (!tuple)
+        return NULL;
+    for (track=0; track < cdrom->numtracks; track++)
+    {
+        int audio = cdrom->track[track].type == SDL_AUDIO_TRACK;
+        double start = cdrom->track[track].offset / (double) CD_FPS;
+        double length = cdrom->track[track].length / (double) CD_FPS;
+        double end = start + length;
+        item = PyTuple_New (4);
+        if (!item)
+        {
+            Py_DECREF (tuple);
+            return NULL;
+        }
+        PyTuple_SET_ITEM (item, 0, PyInt_FromLong (audio));
+        PyTuple_SET_ITEM (item, 1, PyFloat_FromDouble (start));
+        PyTuple_SET_ITEM (item, 2, PyFloat_FromDouble (end));
+        PyTuple_SET_ITEM (item, 3, PyFloat_FromDouble (length));
+        PyTuple_SET_ITEM (tuple, track, item);
+    }
+    return tuple;
 }
 
-
-
-
 static PyMethodDef cd_builtins[] =
 {
-	{ "init", cd_init, 1, DOC_CDINIT },
-	{ "quit", cd_quit, 1, DOC_CDQUIT },
-	{ "get_init", cd_get_init, 1, DOC_CDGETINIT },
+    { "init", (PyCFunction) cd_init, METH_NOARGS, DOC_CDINIT },
+    { "quit", (PyCFunction) cd_quit, METH_NOARGS, DOC_CDQUIT },
+    { "get_init", (PyCFunction) cd_get_init, METH_NOARGS, DOC_CDGETINIT },
 
-	{ "play", cd_play, 1, DOC_CDINIT },
-	{ "pause", cd_pause, 1, DOC_CDPAUSE },
-	{ "resume", cd_resume, 1, DOC_CDRESUME },
-	{ "stop", cd_stop, 1, DOC_CDSTOP },
-	{ "eject", cd_eject, 1, DOC_CDEJECT },
+    { "play", cd_play, METH_VARARGS, DOC_CDINIT },
+    { "pause", (PyCFunction) cd_pause, METH_NOARGS, DOC_CDPAUSE },
+    { "resume", (PyCFunction) cd_resume, METH_NOARGS, DOC_CDRESUME },
+    { "stop", (PyCFunction) cd_stop, METH_NOARGS, DOC_CDSTOP },
+    { "eject", (PyCFunction) cd_eject, METH_NOARGS, DOC_CDEJECT },
 
-	{ "get_empty", cd_get_empty, 1, DOC_CDGETEMPTY },
-	{ "get_busy", cd_get_busy, 1, DOC_CDGETBUSY },
-	{ "get_paused", cd_get_paused, 1, DOC_CDGETPAUSED },
-	{ "get_current", cd_get_current, 1, DOC_CDGETCURRENT },
-	{ "get_numtracks", cd_get_numtracks, 1, DOC_CDGETNUMTRACKS },
-	{ "get_id", cd_get_id, 1, DOC_CDGETINIT },
-	{ "get_name", cd_get_name, 1, DOC_CDGETNAME },
-	{ "get_all", cd_get_all, 1, DOC_CDGETALL },
+    { "get_empty", (PyCFunction) cd_get_empty, METH_NOARGS, DOC_CDGETEMPTY },
+    { "get_busy", (PyCFunction) cd_get_busy, METH_NOARGS, DOC_CDGETBUSY },
+    { "get_paused", (PyCFunction) cd_get_paused, METH_NOARGS, DOC_CDGETPAUSED },
+    { "get_current", (PyCFunction) cd_get_current, METH_NOARGS,
+      DOC_CDGETCURRENT },
+    { "get_numtracks", (PyCFunction) cd_get_numtracks, METH_NOARGS,
+      DOC_CDGETNUMTRACKS },
+    { "get_id", (PyCFunction) cd_get_id, METH_NOARGS, DOC_CDGETINIT },
+    { "get_name", (PyCFunction) cd_get_name, METH_NOARGS, DOC_CDGETNAME },
+    { "get_all", (PyCFunction) cd_get_all, METH_NOARGS, DOC_CDGETALL },
 
-	{ "get_track_audio", cd_get_track_audio, 1, DOC_CDGETTRACKAUDIO },
-	{ "get_track_length", cd_get_track_length, 1, DOC_CDGETTRACKLENGTH },
-	{ "get_track_start", cd_get_track_start, 1, DOC_CDGETTRACKSTART },
+    { "get_track_audio", cd_get_track_audio, METH_VARARGS,
+      DOC_CDGETTRACKAUDIO },
+    { "get_track_length", cd_get_track_length, METH_VARARGS,
+      DOC_CDGETTRACKLENGTH },
+    { "get_track_start", cd_get_track_start, METH_VARARGS,
+      DOC_CDGETTRACKSTART },
 
-	{ NULL, NULL, 0, NULL }
+    { NULL, NULL, 0, NULL }
 };
 
-static PyObject* cd_getattr(PyObject* self, char* attrname)
+static PyObject*
+cd_getattr (PyObject* self, char* attrname)
 {
-	return Py_FindMethod(cd_builtins, self, attrname);
+    return Py_FindMethod (cd_builtins, self, attrname);
 }
 
-
-
 static PyTypeObject PyCD_Type =
 {
-	PyObject_HEAD_INIT(NULL)
-	0,
-	"CD",
-	sizeof(PyCDObject),
-	0,
-	cd_dealloc,
-	0,
-	cd_getattr,
-	0,
-	0,
-	0,
-	0,
-	NULL,
-	0,
-	(hashfunc)NULL,
-	(ternaryfunc)NULL,
-	(reprfunc)NULL,
-	0L,0L,0L,0L,
-	DOC_PYGAMECDROMCD /* Documentation string */
+    PyObject_HEAD_INIT(NULL)
+    0,
+    "CD",
+    sizeof(PyCDObject),
+    0,
+    cd_dealloc,
+    0,
+    cd_getattr,
+    0,
+    0,
+    0,
+    0,
+    NULL,
+    0,
+    (hashfunc)NULL,
+    (ternaryfunc)NULL,
+    (reprfunc)NULL,
+    0L,0L,0L,0L,
+    DOC_PYGAMECDROMCD /* Documentation string */
 };
 
+static PyObject*
+PyCD_New (int id)
+{
+    PyCDObject* cd;
 
+    if (id < 0 || id >= CDROM_MAXDRIVES || id >= SDL_CDNumDrives ())
+        return RAISE (PyExc_SDLError, "Invalid cdrom device number");
 
-static PyObject* PyCD_New(int id)
-{
-	PyCDObject* cd;
+    cd = PyObject_NEW (PyCDObject, &PyCD_Type);
+    if(!cd)
+        return NULL;
 
-	if(id < 0 || id >= CDROM_MAXDRIVES || id >= SDL_CDNumDrives())
-		return RAISE(PyExc_SDLError, "Invalid cdrom device number");
+    cd->id = id;
 
-	cd = PyObject_NEW(PyCDObject, &PyCD_Type);
-	if(!cd) return NULL;
-
-	cd->id = id;
-
-	return (PyObject*)cd;
+    return (PyObject*)cd;
 }
 
-
-
-
-
 static PyMethodDef cdrom_builtins[] =
 {
-	{ "__PYGAMEinit__", cdrom_autoinit, 1, "auto initialize function" },
-	{ "init", cdrom_init, 1, DOC_PYGAMECDROMINIT },
-	{ "quit", cdrom_quit, 1, DOC_PYGAMECDROMQUIT },
-	{ "get_init", get_init, 1, DOC_PYGAMECDROMGETINIT },
-	{ "get_count", get_count, 1, DOC_PYGAMECDROMGETCOUNT },
-	{ "CD", CD, 1, DOC_PYGAMECDROMCD },
-	{ NULL, NULL, 0, NULL }
+    { "__PYGAMEinit__", (PyCFunction) cdrom_autoinit, METH_NOARGS,
+      "auto initialize function" },
+    { "init", (PyCFunction) cdrom_init, METH_NOARGS, DOC_PYGAMECDROMINIT },
+    { "quit", (PyCFunction) cdrom_quit, METH_NOARGS, DOC_PYGAMECDROMQUIT },
+    { "get_init", (PyCFunction) get_init, METH_NOARGS, DOC_PYGAMECDROMGETINIT },
+    { "get_count", (PyCFunction) get_count, METH_NOARGS,
+      DOC_PYGAMECDROMGETCOUNT },
+    { "CD", CD, METH_VARARGS, DOC_PYGAMECDROMCD },
+    { NULL, NULL, 0, NULL }
 };
 
+PYGAME_EXPORT
+void initcdrom (void)
+{
+    PyObject *module, *dict, *apiobj;
+    static void* c_api[PYGAMEAPI_CDROM_NUMSLOTS];
 
-
-PYGAME_EXPORT
-void initcdrom(void)
-{
-	PyObject *module, *dict, *apiobj;
-	static void* c_api[PYGAMEAPI_CDROM_NUMSLOTS];
-
-	PyType_Init(PyCD_Type);
-
+    PyType_Init (PyCD_Type);
 
     /* create the module */
-	module = Py_InitModule3("cdrom", cdrom_builtins, DOC_PYGAMECDROM);
-	dict = PyModule_GetDict(module);
+    module = Py_InitModule3 ("cdrom", cdrom_builtins, DOC_PYGAMECDROM);
+    dict = PyModule_GetDict (module);
 
-	PyDict_SetItemString(dict, "CDType", (PyObject *)&PyCD_Type);
+    PyDict_SetItemString (dict, "CDType", (PyObject *)&PyCD_Type);
 
-	/* export the c api */
-	c_api[0] = &PyCD_Type;
-	c_api[1] = PyCD_New;
-	apiobj = PyCObject_FromVoidPtr(c_api, NULL);
-	PyDict_SetItemString(dict, PYGAMEAPI_LOCAL_ENTRY, apiobj);
-	Py_DECREF(apiobj);
+    /* export the c api */
+    c_api[0] = &PyCD_Type;
+    c_api[1] = PyCD_New;
+    apiobj = PyCObject_FromVoidPtr (c_api, NULL);
+    PyDict_SetItemString (dict, PYGAMEAPI_LOCAL_ENTRY, apiobj);
+    Py_DECREF (apiobj);
 
-	/*imported needed apis*/
-	import_pygame_base();
+    /*imported needed apis*/
+    import_pygame_base ();
 }
-
 };
 
 PYGAME_EXPORT
-void initconstants(void)
+void initconstants (void)
 {
     PyObject* module;
     
 /*
-    pygame - Python Game Library
-    Copyright (C) 2000-2001  Pete Shinners
+  pygame - Python Game Library
+  Copyright (C) 2000-2001  Pete Shinners
 
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Library General Public License for more details.
 
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-    Pete Shinners
-    pete@shinners.org
+  Pete Shinners
+  pete@shinners.org
 */
 
 /*
 
 
 static PyObject* self_module = NULL;
-
-
 staticforward PyTypeObject PyVidInfo_Type;
-static PyObject* PyVidInfo_New(const SDL_VideoInfo* info);
-static void do_set_icon(PyObject *surface);
+static PyObject* PyVidInfo_New (const SDL_VideoInfo* info);