Initial SWIG work.

This commit is contained in:
Ryan C. Gordon 2010-01-29 04:17:44 -05:00
parent aa7126619e
commit a09a54d0f2
1 changed files with 29 additions and 0 deletions

View File

@ -212,12 +212,21 @@
#ifndef _INCLUDE_PHYSFS_H_ #ifndef _INCLUDE_PHYSFS_H_
#define _INCLUDE_PHYSFS_H_ #define _INCLUDE_PHYSFS_H_
#ifdef SWIG
%module physfs
%{
#include "physfs.h"
%}
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if defined(PHYSFS_DECL) #if defined(PHYSFS_DECL)
/* do nothing. */ /* do nothing. */
#elif (defined SWIG)
#define PHYSFS_DECL extern
#elif (defined _MSC_VER) #elif (defined _MSC_VER)
#define PHYSFS_DECL __declspec(dllexport) #define PHYSFS_DECL __declspec(dllexport)
#elif (defined __SUNPRO_C) #elif (defined __SUNPRO_C)
@ -303,6 +312,7 @@ typedef signed long long PHYSFS_sint64;
#endif #endif
#ifndef SWIG
#ifndef DOXYGEN_SHOULD_IGNORE_THIS #ifndef DOXYGEN_SHOULD_IGNORE_THIS
/* Make sure the types really have the right sizes */ /* Make sure the types really have the right sizes */
#define PHYSFS_COMPILE_TIME_ASSERT(name, x) \ #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
@ -323,6 +333,7 @@ PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
#undef PHYSFS_COMPILE_TIME_ASSERT #undef PHYSFS_COMPILE_TIME_ASSERT
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
#endif /* SWIG */
/** /**
@ -412,6 +423,10 @@ typedef struct PHYSFS_Version
PHYSFS_uint8 patch; /**< patchlevel */ PHYSFS_uint8 patch; /**< patchlevel */
} PHYSFS_Version; } PHYSFS_Version;
#ifndef SWIG /* not available from scripting languages. */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS #ifndef DOXYGEN_SHOULD_IGNORE_THIS
#define PHYSFS_VER_MAJOR 2 #define PHYSFS_VER_MAJOR 2
#define PHYSFS_VER_MINOR 1 #define PHYSFS_VER_MINOR 1
@ -444,6 +459,8 @@ typedef struct PHYSFS_Version
(x)->patch = PHYSFS_VER_PATCH; \ (x)->patch = PHYSFS_VER_PATCH; \
} }
#endif /* SWIG */
/** /**
* \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver) * \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver)
@ -1373,6 +1390,8 @@ PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle);
/* Byteorder stuff... */ /* Byteorder stuff... */
#ifndef SWIG /* not available from scripting languages. */
/** /**
* \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val) * \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val)
* \brief Swap littleendian signed 16 to platform's native byte order. * \brief Swap littleendian signed 16 to platform's native byte order.
@ -1537,6 +1556,8 @@ PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
*/ */
PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val); PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
#endif /* SWIG */
/** /**
* \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val) * \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val)
@ -1972,6 +1993,8 @@ PHYSFS_DECL int PHYSFS_isInit(void);
PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void); PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void);
#ifndef SWIG /* not available from scripting languages. */
/** /**
* \struct PHYSFS_Allocator * \struct PHYSFS_Allocator
* \brief PhysicsFS allocation function pointers. * \brief PhysicsFS allocation function pointers.
@ -2031,6 +2054,8 @@ typedef struct PHYSFS_Allocator
*/ */
PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator); PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
#endif /* SWIG */
/** /**
* \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath)
@ -2101,6 +2126,8 @@ PHYSFS_DECL int PHYSFS_mount(const char *newDir,
PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir); PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir);
#ifndef SWIG /* not available from scripting languages. */
/** /**
* \typedef PHYSFS_StringCallback * \typedef PHYSFS_StringCallback
* \brief Function signature for callbacks that report strings. * \brief Function signature for callbacks that report strings.
@ -2440,6 +2467,8 @@ PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst,
*/ */
PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void); PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void);
#endif /* SWIG */
/* Everything above this line is part of the PhysicsFS 2.1 API. */ /* Everything above this line is part of the PhysicsFS 2.1 API. */