diff options
author | CNLohr <charles@cnlohr.com> | 2017-03-16 15:30:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 15:30:21 -0400 |
commit | d9412e4252c176583b5b737608acb4e60d47c00a (patch) | |
tree | c339acbb982d1f2d67977be98a4ae7cac85f8057 /include | |
parent | 6daf2506fcfbfcd26d63a8bddba319d67ecc33e5 (diff) | |
parent | ccaa625c6161e14f5c2281cc43134d1928094620 (diff) | |
download | libsurvive-d9412e4252c176583b5b737608acb4e60d47c00a.tar.gz libsurvive-d9412e4252c176583b5b737608acb4e60d47c00a.tar.bz2 |
Merge pull request #37 from mwturvey/WinSupport2
VS2017 CE Support
Diffstat (limited to 'include')
-rw-r--r-- | include/libsurvive/survive.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index e6bc68d..e3e167a 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -138,8 +138,12 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode void RegisterDriver( const char * name, void * data ); +#ifdef _WIN32 +#define REGISTER_LINKTIME( func ) +#else #define REGISTER_LINKTIME( func ) \ - void __attribute__((constructor)) REGISTER##func() { RegisterDriver( #func, &func ); } + void __attribute__((constructor)) REGISTER##func() { RegisterDriver(#func, &func); } +#endif @@ -151,18 +155,28 @@ void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb po //For lightcap, etc. Don't change this structure at all. Regular vive is dependent on it being exactly as-is. //When you write drivers, you can use this to send survive lightcap data. +#ifdef _WIN32 +#pragma pack(push,1) +#endif typedef struct { uint8_t sensor_id; uint16_t length; uint32_t timestamp; -} __attribute__((packed)) LightcapElement; +} +#ifdef __linux__ +__attribute__((packed)) +#endif +LightcapElement; +#ifdef _WIN32 +#pragma pack(pop) +#endif //This is the disambiguator function, for taking light timing and figuring out place-in-sweep for a given photodiode. void handle_lightcap( SurviveObject * so, LightcapElement * le ); -#define SV_INFO( x... ) { char stbuff[1024]; sprintf( stbuff, x ); ctx->notefunction( ctx, stbuff ); } -#define SV_ERROR( x... ) { char stbuff[1024]; sprintf( stbuff, x ); ctx->faultfunction( ctx, stbuff ); } +#define SV_INFO( ... ) { char stbuff[1024]; sprintf( stbuff, __VA_ARGS__ ); ctx->notefunction( ctx, stbuff ); } +#define SV_ERROR( ... ) { char stbuff[1024]; sprintf( stbuff, __VA_ARGS__ ); ctx->faultfunction( ctx, stbuff ); } #define SV_KILL() exit(0) //XXX This should likely be re-defined. #endif |