Joystick: use weak functions

This commit is contained in:
Ilari Liusvaara 2013-01-21 13:35:37 +02:00
parent ad997c36bd
commit 8770824c15
4 changed files with 12 additions and 27 deletions

View file

@ -1,6 +1,12 @@
#ifndef _joystickapi__hpp__included__
#define _joystickapi__hpp__included__
#ifdef JOYSTICK_WEAK
#define JOYSTICK_DRV_ATTRIBUTE __attribute__((weak))
#else
#define JOYSTICK_DRV_ATTRIBUTE
#endif
/**
* Joystick initialization function.
*
@ -8,7 +14,7 @@
* - The call occurs in the main thread.
* - Implemented by the joystick plugin.
*/
void joystick_driver_init() throw();
void joystick_driver_init() throw() JOYSTICK_DRV_ATTRIBUTE ;
/**
* Joystick quit function.
*
@ -16,21 +22,21 @@ void joystick_driver_init() throw();
* - The call occurs in the main thread.
* - Implemented by the joystick plugin.
*/
void joystick_driver_quit() throw();
void joystick_driver_quit() throw() JOYSTICK_DRV_ATTRIBUTE ;
/**
* This thread becomes the joystick polling thread.
*
* - Called in joystick polling thread.
*/
void joystick_driver_thread_fn() throw();
void joystick_driver_thread_fn() throw() JOYSTICK_DRV_ATTRIBUTE ;
/**
* Signal the joystick thread to quit.
*/
void joystick_driver_signal() throw();
void joystick_driver_signal() throw() JOYSTICK_DRV_ATTRIBUTE ;
/**
* Identification for joystick plugin.
*/
const char* joystick_driver_name;
extern const char* joystick_driver_name JOYSTICK_DRV_ATTRIBUTE ;
#endif

View file

@ -1,3 +1,4 @@
#define JOYSTICK_WEAK
#include "core/joystickapi.hpp"
void joystick_driver_init() throw()

View file

@ -2,9 +2,6 @@ OBJECTS=
ifeq ($(SOUND),DUMMY)
OBJECTS += sound.$(OBJECT_SUFFIX)
endif
ifeq ($(JOYSTICK),DUMMY)
OBJECTS += joystick.$(OBJECT_SUFFIX)
endif
.PRECIOUS: %.$(OBJECT_SUFFIX) %.files

View file

@ -1,19 +0,0 @@
#include "core/joystickapi.hpp"
void joystick_driver_init() throw()
{
}
void joystick_driver_quit() throw()
{
}
void joystick_driver_thread_fn() throw()
{
}
void joystick_driver_signal() throw()
{
}
const char* joystick_driver_name = "Dummy joystick plugin";