[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Documenting the pygame C API and making the API consistent
- To: Pygame Mail List <pygame-users@xxxxxxxx>
- Subject: [pygame] Documenting the pygame C API and making the API consistent
- From: Lenard Lindstrom <len-l@xxxxxxxxx>
- Date: Fri, 15 Jun 2018 14:45:33 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 15 Jun 2018 17:53:46 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=neo; t=1529099136; bh=x1EEc/uCzVc9NCjlz6UoLWU7ByBBiPUmaecQ3F+oPNE=; h=To:From:Subject:Date; b=sOUJBejhBx7vjXca9dDXvMd5YxQSCewSbIpjIkLtSQIXOkwE7wc7PkTjFQZ6YmOjM 8TutgToBctQ8fHYuxzbuZYBSz9RyEZdfD2rHDq5Z0vyZ7B0kijH3HnWnluzTYRWfi8 pYSlGH3RRixweetZZkkc+F588Jktg2RYYl33SbiM4/oFUftmoo4u0e0I2Z1U7WFpaT YKWQ+gekQTMAdtFlgb8jy9Cxw3nDp8ql47fQuA0D3GAcB0MppFAjQ7PaNpiCA+98F3 zmggBXqByKZJFOa8tjB5t+JI1YZ12ad+iyGolrmsSQlbqcR3cJ23xNpaLYWrxD4vPg F7ENTJdkIVP0g==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
Hi everyone,
A part of the preparation for pygame 2 I have documented the functions
and types exported by various pygame extension modules. For instance,
the pygame.surface module exports C functions for creating and accessing
pygame.Surface instances. These are used in other modules, such as
pygame.display and pygame.image, where surfaces are created. In total,
twelve extension modules make C functions available for use in other
extension modules.
While documenting the C API I renamed C types, functions, and variables
to be consistent with Python's PEP 7. Names starting with 'Py' and 'Pg'
were changed to use the 'pg' prefix. This avoids conflicts with possible
future Python C functions as well as make the pygame naming convention
consistent. I have also found other inconsistencies in the pygame C API.
Functions that return a Python object are consistent in returning NULL
to indicate an error. However, for functions that return an error code,
some may use -1 to indicate an error, while others use 0. Should I make
an effort to make pygame error handling consistent within the C API?
Would it make sense to do this before pygame 1.9.4 is released, or wait
until pygame 2? Python is not much help since it has mixed error codes
within its C API.
Lenard Lindstrom