mirror of https://github.com/mgba-emu/mgba.git
Python: Reduce boilerplate in builder
This commit is contained in:
parent
7b66a702cf
commit
fe2854db79
|
@ -29,8 +29,11 @@ void free(void*);
|
|||
|
||||
#include <mgba/core/core.h>
|
||||
#include <mgba/core/tile-cache.h>
|
||||
|
||||
#define PYEXPORT extern "Python+C"
|
||||
#include "platform/python/vfs-py.h"
|
||||
#include "platform/python/log.h"
|
||||
#undef PYEXPORT
|
||||
|
||||
#ifdef USE_PNG
|
||||
#include <mgba-util/png-io.h>
|
||||
|
|
|
@ -32,19 +32,10 @@ ffi.set_source("mgba._pylib", """
|
|||
#include <mgba-util/png-io.h>
|
||||
#include <mgba-util/vfs.h>
|
||||
|
||||
struct VFile* VFileFromPython(void* fileobj);
|
||||
|
||||
struct VFilePy {
|
||||
struct VFile d;
|
||||
void* fileobj;
|
||||
};
|
||||
|
||||
struct mLogger* mLoggerPythonCreate(void* pyobj);
|
||||
|
||||
struct mLoggerPy {
|
||||
struct mLogger d;
|
||||
void* pyobj;
|
||||
};
|
||||
#define PYEXPORT
|
||||
#include "platform/python/log.h"
|
||||
#include "platform/python/vfs-py.h"
|
||||
#undef PYEXPORT
|
||||
""", include_dirs=[incdir, srcdir],
|
||||
extra_compile_args=cppflags,
|
||||
libraries=["mgba"],
|
||||
|
|
|
@ -12,4 +12,4 @@ struct mLoggerPy {
|
|||
|
||||
struct mLogger* mLoggerPythonCreate(void* pyobj);
|
||||
|
||||
extern "Python+C" void _pyLog(void* logger, int category, enum mLogLevel level, const char* message);
|
||||
PYEXPORT void _pyLog(void* logger, int category, enum mLogLevel level, const char* message);
|
||||
|
|
|
@ -13,16 +13,12 @@ struct VFilePy {
|
|||
|
||||
struct VFile* VFileFromPython(void* fileobj);
|
||||
|
||||
extern "Python+C" {
|
||||
|
||||
bool _vfpClose(struct VFile* vf);
|
||||
off_t _vfpSeek(struct VFile* vf, off_t offset, int whence);
|
||||
ssize_t _vfpRead(struct VFile* vf, void* buffer, size_t size);
|
||||
ssize_t _vfpWrite(struct VFile* vf, const void* buffer, size_t size);
|
||||
void* _vfpMap(struct VFile* vf, size_t size, int flags);
|
||||
void _vfpUnmap(struct VFile* vf, void* memory, size_t size);
|
||||
void _vfpTruncate(struct VFile* vf, size_t size);
|
||||
ssize_t _vfpSize(struct VFile* vf);
|
||||
bool _vfpSync(struct VFile* vf, const void* buffer, size_t size);
|
||||
|
||||
}
|
||||
PYEXPORT bool _vfpClose(struct VFile* vf);
|
||||
PYEXPORT off_t _vfpSeek(struct VFile* vf, off_t offset, int whence);
|
||||
PYEXPORT ssize_t _vfpRead(struct VFile* vf, void* buffer, size_t size);
|
||||
PYEXPORT ssize_t _vfpWrite(struct VFile* vf, const void* buffer, size_t size);
|
||||
PYEXPORT void* _vfpMap(struct VFile* vf, size_t size, int flags);
|
||||
PYEXPORT void _vfpUnmap(struct VFile* vf, void* memory, size_t size);
|
||||
PYEXPORT void _vfpTruncate(struct VFile* vf, size_t size);
|
||||
PYEXPORT ssize_t _vfpSize(struct VFile* vf);
|
||||
PYEXPORT bool _vfpSync(struct VFile* vf, const void* buffer, size_t size);
|
||||
|
|
Loading…
Reference in New Issue