input device add hotplug support

This commit is contained in:
houzh 2023-09-20 09:33:16 +08:00
parent 40255bc373
commit d970d3d7b4
162 changed files with 31895 additions and 159 deletions

View File

@ -19,7 +19,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
endif()
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
add_link_options("LINKER:-rpath-link,${CMAKE_SOURCE_DIR}/src/porting/${CDROID_CHIPSET}/lib")
add_link_options("LINKER:-rpath-link,${CMAKE_SOURCE_DIR}/src/porting/${CDROID_CHIPSET}/lib")
endif()
add_subdirectory(src/porting)
add_subdirectory(src/gui)

View File

@ -26,7 +26,7 @@ find_package(Python)
function(CreatePAK project ResourceDIR PakPath rhpath)
add_custom_target(${project}_assets
COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/idgen.py ${project} ${ResourceDIR} ${rhpath}
COMMAND zip -q -r -D -1 ${PakPath} ./ -x "*.swp" ".*" "*.png" "*.jpg" "*.jpeg"
COMMAND zip -q -r -D -1 ${PakPath} ./ -i "*.xml"
COMMAND zip -q -r -D -0 ${PakPath} ./ -i "*.png" "*.jpg" "*.jpeg" "*.ttf" "*.otf" "*.ttc"
WORKING_DIRECTORY ${ResourceDIR}
COMMENT "Pckage Assets from ${ResourceDIR} to:${PakPath}")

View File

@ -49,6 +49,10 @@
#define EV_MAX 0x1f
#define EV_CNT (EV_MAX+1)
#ifndef EV_ADD
#define EV_ADD 0xFE/*added by zhhou,used by INPUTEVENT's type, for device add*/
#define EV_REMOVE 0xFF/*added by zhhou,used by INPUTEVENT's type, for device remove*/
#endif
/*
* Synchronization events.
*/

View File

@ -35,11 +35,12 @@ InputDevice::InputDevice(int fdev):listener(nullptr){
InputDeviceIdentifier di;
Point sz;
mDeviceClasses=0;
mDeviceClasses= 0;
mKeyboardType = KEYBOARD_TYPE_NONE;
InputGetDeviceInfo(fdev,&devInfos);
di.name=devInfos.name;
di.product=devInfos.product;
di.vendor=devInfos.vendor;
di.name = devInfos.name;
di.product = devInfos.product;
di.vendor = devInfos.vendor;
mDeviceInfo.initialize(fdev,0,0,di,devInfos.name,0,0);
WindowManager::getInstance().getDefaultDisplay().getRealSize(sz);
@ -47,8 +48,8 @@ InputDevice::InputDevice(int fdev):listener(nullptr){
mScreenHeight = sz.y;//ScreenSize is screen size in no roration
for(int j=0;(j<ABS_CNT) && (j<sizeof(devInfos.axis)/sizeof(INPUTAXISINFO));j++){
const INPUTAXISINFO*axis=devInfos.axis+j;
if(axis->maximum!=axis->minimum)
const INPUTAXISINFO*axis = devInfos.axis+j;
if(axis->maximum != axis->minimum)
mDeviceInfo.addMotionRange(axis->axis,0/*source*/,axis->minimum,axis->maximum,axis->flat,axis->fuzz,axis->resolution);
LOGV_IF(axis->maximum!=axis->minimum,"devfd=%d axis[%d] range=%d,%d",fdev,axis->axis,axis->minimum,axis->maximum);
}
@ -64,7 +65,7 @@ InputDevice::InputDevice(int fdev):listener(nullptr){
}
if(TEST_BIT(BTN_MOUSE,devInfos.keyBitMask) &&TEST_BIT(REL_X,devInfos.relBitMask) &&TEST_BIT(REL_Y,devInfos.relBitMask))
mDeviceClasses=INPUT_DEVICE_CLASS_CURSOR;
mDeviceClasses = INPUT_DEVICE_CLASS_CURSOR;
if(TEST_BIT(ABS_MT_POSITION_X, devInfos.absBitMask) && TEST_BIT(ABS_MT_POSITION_Y, devInfos.absBitMask)) {
// Some joysticks such as the PS3 controller report axes that conflict
// with the ABS_MT range. Try to confirm that the device really is a touch screen.
@ -121,7 +122,7 @@ InputDevice::InputDevice(int fdev):listener(nullptr){
mDeviceClasses |= INPUT_DEVICE_CLASS_KEYBOARD;
}
}
kmap=nullptr;
kmap = nullptr;
}
uint32_t getAbsAxisUsage(int32_t axis, uint32_t mDeviceClasses) {
@ -171,18 +172,31 @@ int InputDevice::getId()const{
return mDeviceInfo.getId();
}
int InputDevice::getSource()const{
int InputDevice::getSources()const{
return mDeviceInfo.getSources();
}
int InputDevice::getVendor()const{
int InputDevice::getVendorId()const{
return mDeviceInfo.getIdentifier().vendor;
}
int InputDevice::getProduct()const{
int InputDevice::getProductId()const{
return mDeviceInfo.getIdentifier().product;
}
bool InputDevice::isVirtual()const{
return getId()<0;
}
bool InputDevice::isFullKeyboard()const{
return ((getSources() & SOURCE_KEYBOARD) == SOURCE_KEYBOARD)
&& (mKeyboardType == KEYBOARD_TYPE_ALPHABETIC);
}
bool InputDevice::supportsSource(int source)const{
return (getSources() & source) == source;
}
int InputDevice::getClasses()const{
return mDeviceClasses;
}
@ -216,7 +230,7 @@ int KeyDevice::putRawEvent(const struct timeval&tv,int type,int code,int value){
else
mRepeatCount=0;
mEvent.initialize(getId(),getSource(),(value?KeyEvent::ACTION_DOWN:KeyEvent::ACTION_UP)/*action*/,flags,
mEvent.initialize(getId(),getSources(),(value?KeyEvent::ACTION_DOWN:KeyEvent::ACTION_UP)/*action*/,flags,
keycode,code/*scancode*/,0/*metaState*/,mRepeatCount, mDownTime,SystemClock::uptimeMicros()/*eventtime*/);
LOGV("fd[%d] keycode:%08x->%04x[%s] action=%d flags=%d",getId(),code,keycode, mEvent.getLabel(),value,flags);
if(listener)listener(mEvent);
@ -224,7 +238,7 @@ int KeyDevice::putRawEvent(const struct timeval&tv,int type,int code,int value){
case EV_SYN:
LOGV("fd[%d].SYN value=%d code=%d",getId(),value,code);
break;
default:LOGD("event type %x source=%x",type,getSource());break;
default:LOGD("event type %x source=%x",type,getSources());break;
}
return 0;
}
@ -351,7 +365,7 @@ int TouchDevice::putRawEvent(const struct timeval&tv,int type,int code,int value
case EV_REL:
switch(code){
case REL_X:
case REL_Y:
case REL_Y://LOGD("EV_REL code %x,%x",code,value);
case REL_Z:setAxisValue(0,code,value,true);break;
}break;
case EV_SYN:
@ -359,7 +373,7 @@ int TouchDevice::putRawEvent(const struct timeval&tv,int type,int code,int value
case SYN_REPORT:
case SYN_MT_REPORT:
mMoveTime =(tv.tv_sec * 1000000 + tv.tv_usec);
mEvent.initialize(getId(),getSource(),mEvent.getAction(),mEvent.getActionButton(),
mEvent.initialize(getId(),getSources(),mEvent.getAction(),mEvent.getActionButton(),
0/*flags*/, 0/*edgeFlags*/, 0/*metaState*/, mEvent.getButtonState() ,
0/*xOffset*/,0/*yOffset*/ , 0/*xPrecision*/, 0/*yPrecision*/ ,
mDownTime , mMoveTime , 0 , nullptr , nullptr);

View File

@ -100,7 +100,7 @@ private:
};
/* Input device classes. */
enum {
enum InputDeviceClass{
/* The input device is a keyboard or has buttons. */
INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001,
@ -173,9 +173,14 @@ public:
static constexpr int SOURCE_JOYSTICK = 0x01000000 | SOURCE_CLASS_JOYSTICK;
static constexpr int SOURCE_HDMI = 0x02000000 | SOURCE_CLASS_BUTTON;
static constexpr int SOURCE_ANY = 0xffffff00;
static constexpr int KEYBOARD_TYPE_NONE = 0;
static constexpr int KEYBOARD_TYPE_NON_ALPHABETIC = 1;
static constexpr int KEYBOARD_TYPE_ALPHABETIC = 2;
typedef std::function<void(const InputEvent&)>EventListener;
protected:
int mDeviceClasses;
int mKeyboardType;
unsigned int mScreenWidth;
unsigned int mScreenHeight;
InputDeviceInfo mDeviceInfo;
@ -187,9 +192,12 @@ public:
virtual int putRawEvent(const struct timeval&tv,int type,int code,int value){return 0;}//PENDING need more rawevent OK,wecan getevent now
void setEventConsumeListener(EventListener ls){listener=ls;}
int getId()const;
int getSource()const;
int getVendor()const;
int getProduct()const;
int getProductId()const;
int getVendorId()const;
bool isVirtual()const;
bool isFullKeyboard()const;
bool supportsSource(int source)const;
int getSources()const;
int getClasses()const;
const std::string&getName()const;
};

View File

@ -22,12 +22,17 @@ InputEventSource::InputEventSource(){
auto func=[this](){
while(1){
INPUTEVENT es[32];
const int count=InputGetEvents(es,32,10);
const int count = InputGetEvents(es,32,10);
std::lock_guard<std::mutex> lock(mtxEvents);
if(count)mLastInputEventTime = SystemClock::uptimeMillis();
LOGV_IF(count,"rcv %d rawEvents",count);
for(int i=0;i<count;i++)
for(int i = 0 ; i < count ; i ++){
if(es[i].type > EV_CNT){
onDeviceChanged(es+i);
continue;
}
mRawEvents.push(es[i]);
}
}
};
std::thread th(func);
@ -40,9 +45,26 @@ InputEventSource::~InputEventSource(){
LOGD("%p Destroied",this);
}
void InputEventSource::onDeviceChanged(const INPUTEVENT*es){
auto itr = mDevices.find(es->device);
std::shared_ptr<InputDevice>dev = nullptr;
switch(es->type){
case EV_ADD:
/*noting todo*/
LOGI("device %d is added",es->device);
break;
case EV_REMOVE:
if(itr!=mDevices.end())dev = itr->second;
LOGI("device %s:%d/%d is removed",
dev->getName().c_str(), es->device,dev->getId());
mDevices.erase(itr);
break;
}
}
InputEventSource& InputEventSource::getInstance(){
static InputEventSource* mInst = nullptr;
if(mInst == nullptr)mInst=new InputEventSource();
if(mInst == nullptr)mInst = new InputEventSource();
return *mInst;
}
@ -53,8 +75,8 @@ void InputEventSource::setScreenSaver(ScreenSaver func,int timeout){
std::shared_ptr<InputDevice>InputEventSource::getdevice(int fd){
std::shared_ptr<InputDevice>dev;
auto itr=devices.find(fd);
if(itr==devices.end()){
auto itr = mDevices.find(fd);
if(itr == mDevices.end()){
InputDevice tmpdev(fd);LOGD("device %d classes=%x",fd,tmpdev.getClasses());
if(tmpdev.getClasses()&(INPUT_DEVICE_CLASS_TOUCH|INPUT_DEVICE_CLASS_TOUCH_MT)){
dev.reset(new MouseDevice(fd));
@ -69,7 +91,7 @@ std::shared_ptr<InputDevice>InputEventSource::getdevice(int fd){
mInputEvents.push(key);
});
}
devices.emplace(fd,dev);
mDevices.emplace(fd,dev);
return dev;
}
return itr->second;
@ -122,11 +144,11 @@ int InputEventSource::handleEvents(){
int InputEventSource::process(){
LOGV_IF(mRawEvents.size(),"%p recv %d events ",this,mRawEvents.size());
while(mRawEvents.size()){
const INPUTEVENT e=mRawEvents.front();
struct timeval tv={(time_t)e.tv_sec,e.tv_usec};
std::shared_ptr<InputDevice>dev=getdevice(e.device);
const INPUTEVENT e = mRawEvents.front();
struct timeval tv = {(time_t)e.tv_sec,e.tv_usec};
std::shared_ptr<InputDevice>dev = getdevice(e.device);
mRawEvents.pop();
if(dev==nullptr){
if(dev == nullptr){
LOGD("%d,%d,%d device=%d ",e.type,e.code,e.value,e.device);
continue;
}
@ -143,7 +165,7 @@ int InputEventSource::pushEvent(InputEvent*evt){
void InputEventSource::playback(const std::string&fname){
#define DELIMITERS "(),"
auto func=[this](const std::string&fname){
auto func = [this](const std::string&fname){
std::fstream in(fname);
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
LOGD_IF(in.good(),"play key from %s",fname.c_str());
@ -156,25 +178,25 @@ void InputEventSource::playback(const std::string&fname){
in.getline(line,255);
Tokenizer::fromContents("",line,&tok);
std::string word=tok->nextToken(DELIMITERS);
std::string word = tok->nextToken(DELIMITERS);
tok->skipDelimiters(DELIMITERS);
if(word.compare("delay")==0){
word=tok->nextToken(DELIMITERS);
word = tok->nextToken(DELIMITERS);
std::chrono::milliseconds dur(strtoul(word.c_str(),&ps,10));
std::this_thread::sleep_for(dur);
}else if(word.compare("key")==0){
word =tok->nextToken(DELIMITERS);
int action =(word.find("DOWN")!=std::string::npos)?KeyEvent::ACTION_DOWN:KeyEvent::ACTION_UP;
word = tok->nextToken(DELIMITERS);
int action = (word.find("DOWN")!=std::string::npos)?KeyEvent::ACTION_DOWN:KeyEvent::ACTION_UP;
tok->skipDelimiters(DELIMITERS);
word =tok->nextToken(DELIMITERS);
nsecs_t evttime=SystemClock::uptimeMillis();
int keycode=KeyEvent::getKeyCodeFromLabel(word.c_str());
KeyEvent*key=KeyEvent::obtain(evttime,evttime,action,keycode,1,0/*metastate*/,
word = tok->nextToken(DELIMITERS);
nsecs_t evttime = SystemClock::uptimeMillis();
int keycode = KeyEvent::getKeyCodeFromLabel(word.c_str());
KeyEvent*key= KeyEvent::obtain(evttime,evttime,action,keycode,1,0/*metastate*/,
0/*deviceid*/,keycode/*scancode*/,0/*flags*/,0/*source*/);
mInputEvents.push(key);
}
if(in.gcount()==0){
if(in.gcount() == 0){
in.close();
in.open(fname);
}

View File

@ -25,13 +25,14 @@ private:
nsecs_t mLastInputEventTime;/*for screensaver*/
std::ofstream frecord;
std::queue<InputEvent*>mInputEvents;
std::queue<INPUTEVENT>mRawEvents;
std::unordered_map<int,std::shared_ptr<InputDevice>>devices;
std::queue<INPUTEVENT> mRawEvents;
std::unordered_map<int,std::shared_ptr<InputDevice>>mDevices;
std::shared_ptr<InputDevice>getdevice(int fd);
protected:
InputEventSource();
int pushEvent(InputEvent*evt);
int process();
InputEventSource();
void onDeviceChanged(const INPUTEVENT*es);
public:
static InputEventSource& getInstance();
~InputEventSource();

View File

@ -1,18 +0,0 @@
#include <core/soundeffect.h>
#include <view/view.h>
namespace cdroid{
int SoundEffectConstants::getContantForFocusDirection(int direction) {
switch (direction) {
case View::FOCUS_RIGHT: return SoundEffectConstants::NAVIGATION_RIGHT;
case View::FOCUS_FORWARD:
case View::FOCUS_DOWN: return SoundEffectConstants::NAVIGATION_DOWN;
case View::FOCUS_LEFT: return SoundEffectConstants::NAVIGATION_LEFT;
case View::FOCUS_BACKWARD:
case View::FOCUS_UP: return SoundEffectConstants::NAVIGATION_UP;
default:
throw "direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.";
}
return SoundEffectConstants::NAVIGATION_DOWN;//NOT REACHED
}
}//namespace

View File

@ -0,0 +1,168 @@
#ifndef __HAPTIC_FEEDBACK_CONSTANTS_H__
#define __HAPTIC_FEEDBACK_CONSTANTS_H__
namespace cdroid{
class HapticFeedbackConstants {
public:
/**
* The user has performed a long press on an object that is resulting
* in an action being performed.
*/
static constexpr int LONG_PRESS = 0;
/**
* The user has pressed on a virtual on-screen key.
*/
static constexpr int VIRTUAL_KEY = 1;
/**
* The user has pressed a soft keyboard key.
*/
static constexpr int KEYBOARD_TAP = 3;
/**
* The user has pressed either an hour or minute tick of a Clock.
*/
static constexpr int CLOCK_TICK = 4;
/**
* The user has pressed either a day or month or year date of a Calendar.
* @hide
*/
static constexpr int CALENDAR_DATE = 5;
/**
* The user has performed a context click on an object.
*/
static constexpr int CONTEXT_CLICK = 6;
/**
* The user has pressed a virtual or software keyboard key.
*/
static constexpr int KEYBOARD_PRESS = KEYBOARD_TAP;
/**
* The user has released a virtual keyboard key.
*/
static constexpr int KEYBOARD_RELEASE = 7;
/**
* The user has released a virtual key.
*/
static constexpr int VIRTUAL_KEY_RELEASE = 8;
/**
* The user has performed a selection/insertion handle move on text field.
*/
static constexpr int TEXT_HANDLE_MOVE = 9;
/**
* The user unlocked the device
* @hide
*/
static constexpr int ENTRY_BUMP = 10;
/**
* The user has moved the dragged object within a droppable area.
* @hide
*/
static constexpr int DRAG_CROSSING = 11;
/**
* The user has started a gesture (e.g. on the soft keyboard).
*/
static constexpr int GESTURE_START = 12;
/**
* The user has finished a gesture (e.g. on the soft keyboard).
*/
static constexpr int GESTURE_END = 13;
/**
* The user's squeeze crossed the gesture's initiation threshold.
* @hide
*/
static constexpr int EDGE_SQUEEZE = 14;
/**
* The user's squeeze crossed the gesture's release threshold.
* @hide
*/
static constexpr int EDGE_RELEASE = 15;
/**
* A haptic effect to signal the confirmation or successful completion of a user
* interaction.
*/
static constexpr int CONFIRM = 16;
/**
* A haptic effect to signal the rejection or failure of a user interaction.
*/
static constexpr int REJECT = 17;
/**
* A haptic effect to provide texture while a rotary input device is being scrolled.
*
* @hide
*/
static constexpr int ROTARY_SCROLL_TICK = 18;
/**
* A haptic effect to signal that a list element has been focused while scrolling using a rotary
* input device.
*
* @hide
*/
static constexpr int ROTARY_SCROLL_ITEM_FOCUS = 19;
/**
* A haptic effect to signal reaching the scrolling limits of a list while scrolling using a
* rotary input device.
*
* @hide
*/
static constexpr int ROTARY_SCROLL_LIMIT = 20;
/**
* The phone has booted with safe mode enabled.
* This is a private constant. Feel free to renumber as desired.
* @hide
*/
static constexpr int SAFE_MODE_ENABLED = 10001;
/**
* Invocation of the voice assistant via hardware button.
* This is a private constant. Feel free to renumber as desired.
* @hide
*/
static constexpr int ASSISTANT_BUTTON = 10002;
/**
* The user has performed a long press on the power button hardware that is resulting
* in an action being performed.
* This is a private constant. Feel free to renumber as desired.
* @hide
*/
static constexpr int LONG_PRESS_POWER_BUTTON = 10003;
/**
* Flag for {@link View#performHapticFeedback(int, int)
* View.performHapticFeedback(int, int)}: Ignore the setting in the
* view for whether to perform haptic feedback, do it always.
*/
static constexpr int FLAG_IGNORE_VIEW_SETTING = 0x0001;
/**
* Flag for {@link View#performHapticFeedback(int, int)
* View.performHapticFeedback(int, int)}: Ignore the global setting
* for whether to perform haptic feedback, do it always.
*
* @deprecated Starting from {@link android.os.Build.VERSION_CODES#TIRAMISU} only privileged
* apps can ignore user settings for touch feedback.
*/
static constexpr int FLAG_IGNORE_GLOBAL_SETTING = 0x0002;
};
}/*endof namespace*/
#endif

View File

@ -73,7 +73,7 @@ View* LayoutInflater::inflate(const std::string&resource,ViewGroup*root,bool att
if(mContext) {
std::string package;
std::unique_ptr<std::istream>stream = mContext->getInputStream(resource,&package);
LOGD("inflate from %s",resource.c_str());
LOGV("inflate from %s",resource.c_str());
if(stream && stream->good()) {
v = inflate(package,*stream,root,attachToRoot && (root!=nullptr),atts);
} else {

View File

@ -0,0 +1,57 @@
#include <view/soundeffectconstants.h>
#include <view/view.h>
namespace cdroid{
int SoundEffectConstants::sLastNavigationRepeatSoundEffectId = -1;
int SoundEffectConstants::getContantForFocusDirection(int direction) {
switch (direction) {
case View::FOCUS_RIGHT: return SoundEffectConstants::NAVIGATION_RIGHT;
case View::FOCUS_FORWARD:
case View::FOCUS_DOWN: return SoundEffectConstants::NAVIGATION_DOWN;
case View::FOCUS_LEFT: return SoundEffectConstants::NAVIGATION_LEFT;
case View::FOCUS_BACKWARD:
case View::FOCUS_UP: return SoundEffectConstants::NAVIGATION_UP;
default:
throw "direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.";
}
return SoundEffectConstants::NAVIGATION_DOWN;//NOT REACHED
}
int SoundEffectConstants::getConstantForFocusDirection(int direction, bool repeating){
if (repeating) {
switch (direction) {
case View::FOCUS_RIGHT:
return SoundEffectConstants::NAVIGATION_REPEAT_RIGHT;
case View::FOCUS_FORWARD:
case View::FOCUS_DOWN:
return SoundEffectConstants::NAVIGATION_REPEAT_DOWN;
case View::FOCUS_LEFT:
return SoundEffectConstants::NAVIGATION_REPEAT_LEFT;
case View::FOCUS_BACKWARD:
case View::FOCUS_UP:
return SoundEffectConstants::NAVIGATION_REPEAT_UP;
}
LOGE("direction must be one of {FOCUS_UP, FOCUS_DOWN,"
"FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.");
}
return getContantForFocusDirection(direction);
}
bool SoundEffectConstants::isNavigationRepeat(int effectId){
return effectId == SoundEffectConstants::NAVIGATION_REPEAT_DOWN
|| effectId == SoundEffectConstants::NAVIGATION_REPEAT_LEFT
|| effectId == SoundEffectConstants::NAVIGATION_REPEAT_RIGHT
|| effectId == SoundEffectConstants::NAVIGATION_REPEAT_UP;
}
int SoundEffectConstants::nextNavigationRepeatSoundEffectId(){
int next = 0;//NAVIGATION_REPEAT_RANDOMIZER.nextInt(AudioManager.NUM_NAVIGATION_REPEAT_SOUND_EFFECTS - 1);
if (next >= sLastNavigationRepeatSoundEffectId) {
next++;
}
sLastNavigationRepeatSoundEffectId = next;
return next;//AudioManager.getNthNavigationRepeatSoundEffect(next);
}
}//namespace

View File

@ -3,6 +3,7 @@
namespace cdroid{
class SoundEffectConstants {
private:
static int sLastNavigationRepeatSoundEffectId;
SoundEffectConstants() {}
public:
static constexpr int CLICK = 0;
@ -10,8 +11,15 @@ public:
static constexpr int NAVIGATION_UP = 2;
static constexpr int NAVIGATION_RIGHT = 3;
static constexpr int NAVIGATION_DOWN = 4;
static constexpr int NAVIGATION_REPEAT_LEFT = 5;
static constexpr int NAVIGATION_REPEAT_UP = 6;
static constexpr int NAVIGATION_REPEAT_RIGHT = 7;
static constexpr int NAVIGATION_REPEAT_DOWN = 8;
static int getContantForFocusDirection(int direction);
static int getConstantForFocusDirection(int direction, bool repeating);
static bool isNavigationRepeat(int effectId);
static int nextNavigationRepeatSoundEffectId();
};
}//namespace
#endif

View File

@ -33,7 +33,7 @@ public:
TintInfo(){
mTintList=nullptr;
mHasTintList = false;
mHasTintMode = false;
mHasTintMode = false;
mTintMode = SRC_IN;
};
~TintInfo(){
@ -5895,9 +5895,9 @@ bool View::performContextClick() {
if (mListenerInfo && mListenerInfo->mOnContextClickListener) {
handled = mListenerInfo->mOnContextClickListener(*this);
}
/*if (handled) {
performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK);
}*/
if (handled) {
performHapticFeedback(HapticFeedbackConstants::CONTEXT_CLICK);
}
return handled;
}
@ -6513,10 +6513,39 @@ void View::setMinimumWidth(int minWidth) {
requestLayout();
}
void View::playSoundEffect(int soundConstant){
void View::setSoundEffectsEnabled(bool soundEffectsEnabled) {
setFlags(soundEffectsEnabled ? SOUND_EFFECTS_ENABLED: 0, SOUND_EFFECTS_ENABLED);
}
bool View::isSoundEffectsEnabled()const{
return SOUND_EFFECTS_ENABLED == (mViewFlags & SOUND_EFFECTS_ENABLED);
}
void View::playSoundEffect(int soundConstant){
if(mAttachInfo==nullptr||mAttachInfo->mPlaySoundEffect==nullptr||isSoundEffectsEnabled()==false)
return ;
mAttachInfo->mPlaySoundEffect(soundConstant);
}
bool View::performHapticFeedback(int feedbackConstant, int flags){
return false;
if (mAttachInfo == nullptr) {
return false;
}
//noinspection SimplifiableIfStatement
if ((flags & HapticFeedbackConstants::FLAG_IGNORE_VIEW_SETTING) == 0
&& !isHapticFeedbackEnabled()) {
return false;
}
return mAttachInfo->mPerformHapticFeedback(feedbackConstant,
(flags & HapticFeedbackConstants::FLAG_IGNORE_GLOBAL_SETTING) != 0);
}
void View::setHapticFeedbackEnabled(bool hapticFeedbackEnabled) {
setFlags(hapticFeedbackEnabled ? HAPTIC_FEEDBACK_ENABLED: 0, HAPTIC_FEEDBACK_ENABLED);
}
bool View::isHapticFeedbackEnabled() const{
return HAPTIC_FEEDBACK_ENABLED == (mViewFlags & HAPTIC_FEEDBACK_ENABLED);
}
void View::setMeasuredDimensionRaw(int measuredWidth, int measuredHeight) {

View File

@ -18,6 +18,8 @@
#include <view/viewconfiguration.h>
#include <view/measurespec.h>
#include <view/viewtreeobserver.h>
#include <view/soundeffectconstants.h>
#include <view/hapticfeedbackconstants.h>
#include <animation/animation.h>
#include <animation/statelistanimator.h>
#include <set>
@ -191,7 +193,9 @@ protected:
bool mKeepScreenOn;
bool mDebugLayout;
bool mDisplayState;/*true display is on*/
Cairo::RefPtr<Canvas> mCanvas;
std::function<void(int)>mPlaySoundEffect;
std::function<bool(int,bool)>mPerformHapticFeedback;
Cairo::RefPtr<Canvas> mCanvas;
Drawable*mAutofilledDrawable;
View* mTooltipHost;
View* mViewRequestingLayout;
@ -604,7 +608,11 @@ protected:
int getSuggestedMinimumHeight();
void setMeasuredDimension(int measuredWidth, int measuredHeight);
bool handleScrollBarDragging(MotionEvent& event);
void setSoundEffectsEnabled(bool soundEffectsEnabled);
bool isSoundEffectsEnabled()const;
void playSoundEffect(int soundConstant);
void setHapticFeedbackEnabled(bool hapticFeedbackEnabled);
bool isHapticFeedbackEnabled()const;
bool performHapticFeedback(int feedbackConstant, int flags=0);
bool performButtonActionOnTouchDown(MotionEvent&);

View File

@ -1,5 +1,4 @@
#include <widget/adapterview.h>
#include <core/soundeffect.h>
#include <cdtypes.h>
#include <cdlog.h>
#include <systemclock.h>

View File

@ -1,5 +1,4 @@
#include <widget/compoundbutton.h>
#include <core/soundeffect.h>
#include <cdlog.h>
namespace cdroid{

View File

@ -1,5 +1,4 @@
#include <widget/expandablelistview.h>
#include <core/soundeffect.h>
namespace cdroid{
DECLARE_WIDGET(ExpandableListView)

View File

@ -1,6 +1,5 @@
#include <widget/gridview.h>
#include <widget/checkable.h>
#include <core/soundeffect.h>
#include <cdlog.h>
namespace cdroid {

View File

@ -1,5 +1,4 @@
#include <widget/switch.h>
#include <core/soundeffect.h>
#include <core/mathutils.h>
#include <view/viewgroup.h>

View File

@ -1,5 +1,4 @@
#include <widget/tablayout.h>
#include <core/soundeffect.h>
#include <widget/R.h>
#include <cdlog.h>

View File

@ -1,7 +1,6 @@
#include <widget/tablelayout.h>
#include <cdlog.h>
namespace cdroid{
DECLARE_WIDGET(TableLayout)

View File

@ -1,5 +1,4 @@
#include <widget/viewpager.h>
#include <core/soundeffect.h>
#include <focusfinder.h>
#include <cdtypes.h>
#include <cdlog.h>

View File

@ -58,18 +58,14 @@ void LogPrintf(int level,const char*file,const char*func,int line,const char*for
va_list args;
const std::string tag=splitFileName(file);
auto it=sModules.find(tag);
int module_loglevel=(it==sModules.end())?sLogLevel:it->second;
const int module_loglevel=(it==sModules.end())?sLogLevel:it->second;
#if 1
const char*colors[]= {"\033[0m","\033[1m","\033[0;32m","\033[0;36m","\033[1;31m","\033[5;31m"};
if(level<module_loglevel||level<0||level>LOG_FATAL)
return;
LogInit();
struct timespec ts;
#ifdef _WIN32
(void)timespec_get(&ts,0);
#else
clock_gettime(CLOCK_MONOTONIC,&ts);
#endif
int len1=snprintf(msgBoddy,kMaxMessageSize,"%010ld.%06ld \033[0;32m[%s]\033[0;34m \%s:%d %s",
ts.tv_sec,ts.tv_nsec/1000, tag.c_str(),func,line, colors[level]);
va_start(args, format);
@ -90,8 +86,8 @@ void LogPrintf(int level,const char*file,const char*func,int line,const char*for
void LogDump(int level,const char*tag,const char*func,int line,const char*label,const BYTE*data,int len) {
char buff[128];
int i,j,taglen=0;
taglen=sprintf(buff,"%s[%d]",label,len);
int i,taglen=0;
taglen = sprintf(buff,"%s[%d]",label,len);
cdlog::LogMessage log(tag,line,func,level);
std::ostringstream &oss=log.messageStream();
oss<<buff;
@ -103,7 +99,6 @@ void LogDump(int level,const char*tag,const char*func,int line,const char*label,
void LogSetModuleLevel(const char*module,int level) {
if(module==NULL) {
int i;
sLogLevel=(LogLevel)level;
for(auto it=sModules.begin(); it!=sModules.end(); it++) {
it->second=level;
@ -116,7 +111,7 @@ void LogSetModuleLevel(const char*module,int level) {
void LogParseModule(const char*log) {
char module[128];
const char*p=strchr(log,':');
const char*p = strchr(log,':');
if(p==NULL)return;
strncpy(module,log,p-log);
module[p-log]=0;
@ -147,8 +142,7 @@ void LogParseModule(const char*log) {
}
void LogParseModules(int argc,const char*argv[]) {
int i;
for ( i = 1; i <argc; i++) {
for (int i = 1; i <argc; i++) {
if(strchr(argv[i],':')) {
LogParseModule(argv[i]);
}
@ -161,16 +155,12 @@ static const std::string kTruncatedWarningText = "[...truncated...]";
LogMessage::LogMessage(const std::string& file, const int line, const std::string& function,int level)
: file_(splitFileName(file)),function_(function), line_(line),level_message(level) {
struct timespec ts;
#ifdef _WIN32
(void)timespec_get(&ts,0);
#else
clock_gettime(CLOCK_MONOTONIC,&ts);
#endif
timestamp_ =ts.tv_sec;
timeusec_ =ts.tv_nsec/1000 ;
timestamp_ = ts.tv_sec;
timeusec_ = ts.tv_nsec/1000 ;
LogInit();
const std::string tag=splitFileName(file);
auto it=sModules.find(tag);
auto it = sModules.find(tag);
level_module=(it==sModules.end())?sLogLevel:it->second;
}

View File

@ -198,7 +198,7 @@ INT GFXCreateSurface(int dispid,HANDLE*surface,UINT width,UINT height,INT format
img=(XImage*)malloc(sizeof(XImage));
img->width=width;
img->height=height;
img->bits_per_pixel=24;
img->bits_per_pixel=32;
img->bytes_per_line=width*4;
}
img->data=(char*)malloc(width*height*img->bytes_per_line);

View File

@ -13,21 +13,22 @@
#define EV_FF 0x15
#endif
#ifdef HAVE_POLL_H
#include<poll.h>
#include <poll.h>
#endif
#ifdef HAVE_EPOLL_H
#include<sys/epoll.h>
#include <sys/epoll.h>
#endif
#include<cdtypes.h>
#include<cdinput.h>
#include<map>
#include<iostream>
#include<fstream>
#include<vector>
#include<cdlog.h>
#include<ngl_msgq.h>
#include<ngl_timer.h>
#include<string.h>
#include <cdtypes.h>
#include <cdinput.h>
#include <map>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cdlog.h>
#include <ngl_msgq.h>
#include <ngl_timer.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
@ -36,43 +37,58 @@
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/inotify.h>
typedef struct{
int fd;
std::string name;
}DEVICENODE;
typedef struct {
int maxfd;
int nfd;
int inotify;
int pipe[2];
int fds[128];
std::map<int,int>keymap;
std::vector<DEVICENODE> fds;
std::vector<DEVICENODE>::iterator findByFd(int fd){
for(auto it=fds.begin();it!=fds.end();it++)
if(it->fd==fd)return it;
return fds.end();
}
std::vector<DEVICENODE>::iterator findByPath(const std::string&path){
for(auto it=fds.begin();it!=fds.end();it++)
if(it->name==path)return it;
return fds.end();
}
} INPUTDEVICE;
static INPUTDEVICE dev= {0,0};
#define WATCHED_PATH "/dev/input"
INT InputInit() {
if(dev.pipe[0]>0)
return 0;
pipe(dev.pipe);
dev.nfd=0;
dev.fds[dev.nfd++]=dev.pipe[0];
dev.maxfd=dev.pipe[0];
int rc=fcntl(dev.pipe[0],F_SETFL,O_NONBLOCK);
dev.fds.push_back({dev.pipe[0],"pipe"});
dev.maxfd = dev.pipe[0];
int rc = fcntl(dev.pipe[0],F_SETFL,O_NONBLOCK);
struct dirent **namelist=nullptr;
LOGD("cplusplus=%di nfd=%d fcntl=%d fd[0]=%d input_event.size=%d %d",__cplusplus,dev.nfd,rc,dev.fds[0],sizeof(struct input_event),sizeof(struct timeval));
int nf=scandir("/dev/input",&namelist,[&dev](const struct dirent * ent)->int{
LOGD("cplusplus=%di fcntl=%d fd[0]=%d input_event.size=%d %d",__cplusplus,rc,dev.fds[0],sizeof(struct input_event),sizeof(struct timeval));
int nf=scandir(WATCHED_PATH,&namelist,[&dev](const struct dirent * ent)->int{
char fname[256];
int fd=-1;
snprintf(fname,sizeof(fname),"/dev/input/%s",ent->d_name);
int fd = -1;
snprintf(fname,sizeof(fname),WATCHED_PATH"/%s",ent->d_name);
if(ent->d_type!=DT_DIR) {
fd=open(fname,O_RDWR);
fd = open(fname,O_RDWR);
LOGD("%s fd=%d",fname,fd);
if(fd>0) {
dev.maxfd=std::max(dev.maxfd,fd);
dev.fds[dev.nfd++]=fd;
dev.fds.push_back({fd,fname});
}
}
return fd>0;
},nullptr);
free(namelist);
dev.inotify = inotify_init();
dev.maxfd = std::max(dev.maxfd,dev.inotify);
inotify_add_watch (dev.inotify,WATCHED_PATH,IN_CREATE | IN_DELETE);
LOGD("maxfd=%d numfd=%d\r\n",dev.maxfd,nf+1);
return 0;
}
@ -99,8 +115,8 @@ INT InputGetDeviceInfo(int device,INPUTDEVICEINFO*devinfo) {
LOGI_IF(a->maximum-a->minimum||1,"dev %d axis[%d]=[%d,%d,%d]",device,a->axis, a->minimum,a->maximum,a->resolution);
}
}
devinfo->product=id.product;
devinfo->vendor=id.vendor;
devinfo->product= id.product;
devinfo->vendor = id.vendor;
ioctl(device, EVIOCGBIT(EV_KEY, sizeof(devinfo->keyBitMask)), devinfo->keyBitMask);
ioctl(device, EVIOCGBIT(EV_ABS, sizeof(devinfo->absBitMask)), devinfo->absBitMask);
ioctl(device, EVIOCGBIT(EV_REL, sizeof(devinfo->relBitMask)), devinfo->relBitMask);
@ -111,23 +127,23 @@ INT InputGetDeviceInfo(int device,INPUTDEVICEINFO*devinfo) {
switch(device) {
case INJECTDEV_TOUCH:
strcpy(devinfo->name,"Touch-Inject");
devinfo->vendor=INJECTDEV_TOUCH>>16;
devinfo->product=INJECTDEV_TOUCH&0xFF;
devinfo->vendor = INJECTDEV_TOUCH>>16;
devinfo->product= INJECTDEV_TOUCH&0xFF;
SET_BIT(devinfo->absBitMask,ABS_X);
SET_BIT(devinfo->absBitMask,ABS_Y);
SET_BIT(devinfo->keyBitMask,BTN_TOUCH);
break;
case INJECTDEV_MOUSE:
strcpy(devinfo->name,"Touch-Inject");
devinfo->vendor=INJECTDEV_MOUSE>>16;
devinfo->product=INJECTDEV_MOUSE&0xFF;
devinfo->vendor = INJECTDEV_MOUSE>>16;
devinfo->product= INJECTDEV_MOUSE&0xFF;
SET_BIT(devinfo->relBitMask,REL_X);
SET_BIT(devinfo->relBitMask,REL_Y);
break;
case INJECTDEV_KEY:
strcpy(devinfo->name,"qwerty");
devinfo->vendor=INJECTDEV_KEY>>16;
devinfo->product=INJECTDEV_KEY&0xFF;
devinfo->vendor = INJECTDEV_KEY>>16;
devinfo->product= INJECTDEV_KEY&0xFF;
SET_BIT(devinfo->keyBitMask,BTN_MISC);
SET_BIT(devinfo->keyBitMask,KEY_OK);
break;
@ -138,13 +154,13 @@ INT InputGetDeviceInfo(int device,INPUTDEVICEINFO*devinfo) {
}
INT InputInjectEvents(const INPUTEVENT*es,UINT count,DWORD timeout) {
const char*evtnames[]= {"SYN","KEY","REL","ABS","MSC","SW"};
const char*evtnames[] = {"SYN","KEY","REL","ABS","MSC","SW"};
struct timespec tv;
INPUTEVENT*events=(INPUTEVENT*)malloc(count*sizeof(INPUTEVENT));
INPUTEVENT*events = (INPUTEVENT*)malloc(count*sizeof(INPUTEVENT));
memcpy(events,es,count*sizeof(INPUTEVENT));
if(dev.pipe[1]>0) {
int rc=write(dev.pipe[1],events,count*sizeof(INPUTEVENT));
int rc = write(dev.pipe[1],events,count*sizeof(INPUTEVENT));
LOGV_IF(count&&(es->type<=EV_SW),"pipe=%d %s,%x,%x write=%d",dev.pipe[1],evtnames[es->type],es->code,es->value,rc);
}
free(events);
@ -152,43 +168,69 @@ INT InputInjectEvents(const INPUTEVENT*es,UINT count,DWORD timeout) {
}
INT InputGetEvents(INPUTEVENT*outevents,UINT max,DWORD timeout) {
int rc,count=0;
int rc,count = 0,event_pos = 0;
struct timeval tv;
struct input_event events[64];
INPUTEVENT*e=outevents;
char inotifyBuffer[512];
INPUTEVENT*e = outevents;
fd_set rfds;
static const char*type2name[]= {"SYN","KEY","REL","ABS","MSC","SW"};
tv.tv_usec=(timeout%1000)*1000;//1000L*timeout;
tv.tv_sec=timeout/1000;
tv.tv_usec= (timeout%1000)*1000;//1000L*timeout;
tv.tv_sec = timeout/1000;
FD_ZERO(&rfds);
for(int i=0; i<dev.nfd; i++) {
FD_SET(dev.fds[i],&rfds);
for(int i = 0; i < dev.fds.size(); i++) {
FD_SET(dev.fds[i].fd,&rfds);
}
rc=select(dev.maxfd+1,&rfds,NULL,NULL,&tv);
if(rc<0) {
if((rc = select(dev.maxfd+1,&rfds,NULL,NULL,&tv))<0) {
LOGD("select error");
return E_ERROR;
}
for(int i=0; i<dev.nfd; i++) {
if(!FD_ISSET(dev.fds[i],&rfds))continue;
if(dev.fds[i]!=dev.pipe[0]) {
rc=read(dev.fds[i],events, sizeof(events)/sizeof(struct input_event));
std::vector<DEVICENODE> fds = dev.fds;
for(int i=0; i < fds.size(); i++) {
if(!FD_ISSET(dev.fds[i].fd,&rfds))continue;
if(dev.fds[i].fd == dev.pipe[0]){ //for pipe
rc = read(dev.fds[i].fd,e, (max-count)*sizeof(INPUTEVENT));
e += rc/sizeof(INPUTEVENT);
count += rc/sizeof(INPUTEVENT);
}else if(dev.fds[i].fd == dev.inotify){
struct inotify_event*ievent=(struct inotify_event*)inotifyBuffer;
rc = read(dev.inotify,inotifyBuffer,sizeof(inotifyBuffer));
if(rc<sizeof(struct inotify_event))
continue;
while(rc>=sizeof(struct inotify_event)){
ievent = (struct inotify_event*)(inotifyBuffer+event_pos);
std::string path = WATCHED_PATH;
path.append("/").append(ievent->name);
LOGI("device %s:%d %s",path.c_str(),ievent->wd,((ievent->mask&IN_CREATE)?"added":"removed"));
const int eventsize = sizeof(struct inotify_event)+ievent->len;
rc -= eventsize;
event_pos += eventsize;
e->type = (ievent->mask & IN_CREATE) ? EV_ADD : EV_REMOVE;
if(ievent->mask & IN_DELETE){
auto it = dev.findByPath(path);
if(it!=dev.fds.end())dev.fds.erase(it);
e->device = it->fd;
}else{
e->device = open(path.c_str(),O_RDWR);
dev.fds.push_back({e->device,path});
LOGE_IF(e->device<0,"%s open failed",path.c_str());
}
e++;
}
}else {/*for input devices*/
rc = read(dev.fds[i].fd,events, sizeof(events)/sizeof(struct input_event));
for(int j=0; j<rc/sizeof(struct input_event)&&(count<max); j++,e++,count++) {
e->tv_sec = events[j].time.tv_sec;
e->tv_usec= events[j].time.tv_usec;
e->type = events[j].type;
e->code = events[j].code;
e->value= events[j].value;
e->device=dev.fds[i];
LOGV_IF(e->type<EV_SW,"fd:%d [%s]%02x,%02x,%02x time=%ld.%ld time2=%ld.%ld",dev.fds[i],
type2name[e->type],e->type,e->code,e->value,e->tv_sec,e->tv_usec,events[j].time.tv_sec,events[j].time.tv_usec);
e->device = dev.fds[i].fd;
LOGV_IF(e->type<EV_SW,"fd:%d [%s]%02x,%02x,%02x time=%ld.%ld time2=%ld.%ld",dev.fds[i].fd,
type2name[e->type],e->type,e->code,e->value,e->tv_sec,e->tv_usec,events[j].time.tv_sec,events[j].time.tv_usec);
}
} else { //for pipe
rc=read(dev.fds[i],e, (max-count)*sizeof(INPUTEVENT));
e+=rc/sizeof(INPUTEVENT);
count+=rc/sizeof(INPUTEVENT);
}
LOGV_IF(rc,"fd %d read %d bytes ispipe=%d",dev.fds[i],rc,dev.fds[i]==dev.pipe[0]);
LOGV_IF(rc,"fd %d read %d bytes ispipe=%d",dev.fds[i],rc,dev.fds[i].fd==dev.pipe[0]);
}
return e-outevents;
}

56
src/porting/d211/CMakeLists.txt Executable file
View File

@ -0,0 +1,56 @@
project (d211 C CXX)
set(D211_SRCS ../common/cdlog.cc
../common/input_linux.cc
mediaplayer.c
)
find_package(DirectFB)
include(CheckIncludeFile)
check_include_file(poll.h HAVE_POLL_H)
check_include_file(sys/epoll.h HAVE_EPOLL_H)
check_include_file(linux/input.h HAVE_INPUT_H)
check_include_file(execinfo.h HAVE_EXECINFO_H)
if(HAVE_POLL_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_POLL_H)
endif()
if(HAVE_EPOLL_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_EPOLL_H)
endif()
if(HAVE_INPUT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_INPUT_H)
endif()
if(HAVE_EXECINFO_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_EXECINFO_H)
endif()
list(APPEND D211_INCLUDE_DIRS ../common)
list(APPEND D211_INCLUDE_DIRS ../include ./include ./ge ./ge/include )
if(DIRECTFB_FOUND)
list(APPEND D211_SRCS ../common/graph_dfb.c)
list(APPEND D211_INCLUDE_DIRS ${DIRECTFB_INCLUDE_DIRS})
list(APPEND D211_LIBS ${DIRECTFB_LIBRARIES})
else()
list(APPEND D211_SRCS graph_gfx.c)
endif()
list(APPEND D211_INCLUDE_DIRS ./inc)
list(APPEND D211_LIBS pthread dl)
include_directories(./
../common ../include
${PIXMAN_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/src/gui/
${CMAKE_SOURCE_DIR}/src/gui/core
${D211_INCLUDE_DIRS}
)
set(PREFIX ${CMAKE_INSTALL_PREFIX})
configure_file(cdroidhal.pc.in cdroidhal.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cdroidhal.pc
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
add_library(tvhal SHARED ${D211_SRCS} )
target_link_libraries(tvhal ${D211_LIBS})
file(GLOB MILIBS ${PROJECT_SOURCE_DIR}/libs/*.so)
install (TARGETS tvhal DESTINATION lib)
install (FILES ${MILIBS} DESTINATION lib)

View File

@ -0,0 +1,608 @@
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generic key character map for full alphabetic US English PC style external keyboards.
#
# This file is intentionally very generic and is intended to support a broad rang of keyboards.
# Do not edit the generic key character map to support a specific keyboard; instead, create
# a new key character map file with the required keyboard configuration.
#
type FULL
### Basic QWERTY keys ###
key A {
label: 'A'
base: 'a'
shift, capslock: 'A'
}
key B {
label: 'B'
base: 'b'
shift, capslock: 'B'
}
key C {
label: 'C'
base: 'c'
shift, capslock: 'C'
alt: '\u00e7'
shift+alt: '\u00c7'
}
key D {
label: 'D'
base: 'd'
shift, capslock: 'D'
}
key E {
label: 'E'
base: 'e'
shift, capslock: 'E'
alt: '\u0301'
}
key F {
label: 'F'
base: 'f'
shift, capslock: 'F'
}
key G {
label: 'G'
base: 'g'
shift, capslock: 'G'
}
key H {
label: 'H'
base: 'h'
shift, capslock: 'H'
}
key I {
label: 'I'
base: 'i'
shift, capslock: 'I'
alt: '\u0302'
}
key J {
label: 'J'
base: 'j'
shift, capslock: 'J'
}
key K {
label: 'K'
base: 'k'
shift, capslock: 'K'
}
key L {
label: 'L'
base: 'l'
shift, capslock: 'L'
}
key M {
label: 'M'
base: 'm'
shift, capslock: 'M'
}
key N {
label: 'N'
base: 'n'
shift, capslock: 'N'
alt: '\u0303'
}
key O {
label: 'O'
base: 'o'
shift, capslock: 'O'
}
key P {
label: 'P'
base: 'p'
shift, capslock: 'P'
}
key Q {
label: 'Q'
base: 'q'
shift, capslock: 'Q'
}
key R {
label: 'R'
base: 'r'
shift, capslock: 'R'
}
key S {
label: 'S'
base: 's'
shift, capslock: 'S'
alt: '\u00df'
}
key T {
label: 'T'
base: 't'
shift, capslock: 'T'
}
key U {
label: 'U'
base: 'u'
shift, capslock: 'U'
alt: '\u0308'
}
key V {
label: 'V'
base: 'v'
shift, capslock: 'V'
}
key W {
label: 'W'
base: 'w'
shift, capslock: 'W'
}
key X {
label: 'X'
base: 'x'
shift, capslock: 'X'
}
key Y {
label: 'Y'
base: 'y'
shift, capslock: 'Y'
}
key Z {
label: 'Z'
base: 'z'
shift, capslock: 'Z'
}
key 0 {
label: '0'
base: '0'
shift: ')'
}
key 1 {
label: '1'
base: '1'
shift: '!'
}
key 2 {
label: '2'
base: '2'
shift: '@'
}
key 3 {
label: '3'
base: '3'
shift: '#'
}
key 4 {
label: '4'
base: '4'
shift: '$'
}
key 5 {
label: '5'
base: '5'
shift: '%'
}
key 6 {
label: '6'
base: '6'
shift: '^'
alt+shift: '\u0302'
}
key 7 {
label: '7'
base: '7'
shift: '&'
}
key 8 {
label: '8'
base: '8'
shift: '*'
}
key 9 {
label: '9'
base: '9'
shift: '('
}
key SPACE {
label: ' '
base: ' '
alt, meta: fallback SEARCH
ctrl: fallback LANGUAGE_SWITCH
}
key ENTER {
label: '\n'
base: '\n'
}
key TAB {
label: '\t'
base: '\t'
}
key COMMA {
label: ','
base: ','
shift: '<'
}
key PERIOD {
label: '.'
base: '.'
shift: '>'
}
key SLASH {
label: '/'
base: '/'
shift: '?'
}
key GRAVE {
label: '`'
base: '`'
shift: '~'
alt: '\u0300'
alt+shift: '\u0303'
}
key MINUS {
label: '-'
base: '-'
shift: '_'
}
key EQUALS {
label: '='
base: '='
shift: '+'
}
key LEFTBRACE {
label: '['
base: '['
shift: '{'
}
key RIGHTBRACE {
label: ']'
base: ']'
shift: '}'
}
key BACKSLASH {
label: '\\'
base: '\\'
shift: '|'
}
key SEMICOLON {
label: ';'
base: ';'
shift: ':'
}
key APOSTROPHE {
label: '\''
base: '\''
shift: '"'
}
### Numeric keypad ###
key NUMPAD_0 {
label: '0'
base: fallback INSERT
numlock: '0'
}
key NUMPAD_1 {
label: '1'
base: fallback MOVE_END
numlock: '1'
}
key NUMPAD_2 {
label: '2'
base: fallback DPAD_DOWN
numlock: '2'
}
key NUMPAD_3 {
label: '3'
base: fallback PAGE_DOWN
numlock: '3'
}
key NUMPAD_4 {
label: '4'
base: fallback DPAD_LEFT
numlock: '4'
}
key NUMPAD_5 {
label: '5'
base: fallback DPAD_CENTER
numlock: '5'
}
key NUMPAD_6 {
label: '6'
base: fallback DPAD_RIGHT
numlock: '6'
}
key NUMPAD_7 {
label: '7'
base: fallback MOVE_HOME
numlock: '7'
}
key NUMPAD_8 {
label: '8'
base: fallback DPAD_UP
numlock: '8'
}
key NUMPAD_9 {
label: '9'
base: fallback PAGE_UP
numlock: '9'
}
key NUMPAD_LEFT_PAREN {
label: '('
base: '('
}
key NUMPAD_RIGHT_PAREN {
label: ')'
base: ')'
}
key NUMPAD_DIVIDE {
label: '/'
base: '/'
}
key NUMPAD_MULTIPLY {
label: '*'
base: '*'
}
key NUMPAD_SUBTRACT {
label: '-'
base: '-'
}
key NUMPAD_ADD {
label: '+'
base: '+'
}
key NUMPAD_DOT {
label: '.'
base: fallback FORWARD_DEL
numlock: '.'
}
key NUMPAD_COMMA {
label: ','
base: ','
}
key NUMPAD_EQUALS {
label: '='
base: '='
}
key NUMPAD_ENTER {
label: '\n'
base: '\n' fallback ENTER
ctrl, alt, meta: none fallback ENTER
}
### Special keys on phones ###
key AT {
label: '@'
base: '@'
}
key STAR {
label: '*'
base: '*'
}
key POUND {
label: '#'
base: '#'
}
key PLUS {
label: '+'
base: '+'
}
### Non-printing keys ###
key ESCAPE {
base: none
alt, meta: fallback HOME
ctrl: fallback MENU
}
key DEL {
ctrl+alt: fallback BACK
}
### Gamepad buttons ###
key BUTTON_A {
base: fallback DPAD_CENTER
}
key BUTTON_B {
base: fallback BACK
}
key BUTTON_C {
base: fallback DPAD_CENTER
}
key BUTTON_X {
base: fallback DEL
}
key BUTTON_Y {
base: fallback SPACE
}
key BUTTON_Z {
base: fallback DPAD_CENTER
}
key BUTTON_L1 {
base: none
}
key BUTTON_R1 {
base: none
}
key BUTTON_L2 {
base: none
}
key BUTTON_R2 {
base: none
}
key BUTTON_THUMBL {
base: fallback DPAD_CENTER
}
key BUTTON_THUMBR {
base: fallback DPAD_CENTER
}
key BUTTON_START {
base: fallback DPAD_CENTER
}
key BUTTON_SELECT {
base: fallback MENU
}
key BUTTON_MODE {
base: fallback MENU
}
key BUTTON_1 {
base: fallback DPAD_CENTER
}
key BUTTON_2 {
base: fallback DPAD_CENTER
}
key BUTTON_3 {
base: fallback DPAD_CENTER
}
key BUTTON_4 {
base: fallback DPAD_CENTER
}
key BUTTON_5 {
base: fallback DPAD_CENTER
}
key BUTTON_6 {
base: fallback DPAD_CENTER
}
key BUTTON_7 {
base: fallback DPAD_CENTER
}
key BUTTON_8 {
base: fallback DPAD_CENTER
}
key BUTTON_9 {
base: fallback DPAD_CENTER
}
key BUTTON_10 {
base: fallback DPAD_CENTER
}
key BUTTON_11 {
base: fallback DPAD_CENTER
}
key BUTTON_12 {
base: fallback DPAD_CENTER
}
key BUTTON_13 {
base: fallback DPAD_CENTER
}
key BUTTON_14 {
base: fallback DPAD_CENTER
}
key BUTTON_15 {
base: fallback DPAD_CENTER
}
key BUTTON_16 {
base: fallback DPAD_CENTER
}

419
src/porting/d211/Generic.kl Normal file
View File

@ -0,0 +1,419 @@
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generic key layout file for full alphabetic US English PC style external keyboards.
#
# This file is intentionally very generic and is intended to support a broad rang of keyboards.
# Do not edit the generic key layout to support a specific keyboard; instead, create
# a new key layout file with the required keyboard configuration.
#
key 1 SOFT_LEFT
key 2 SOFT_RIGHT
key 3 2
key 4 3
key 5 4
key 6 5
key 7 6
key 8 7
key 9 8
key 10 9
key 11 0
key 12 MINUS
key 13 EQUAL
key 14 DELETE
key 15 TAB
key 16 Q
key 17 W
key 18 E
key 19 R
key 20 T
key 21 Y
key 22 U
key 23 I
key 24 O
key 25 P
key 26 LEFT_BRACKET
key 27 RIGHT_BRACKET
key 28 ENTER
key 29 CTRL_LEFT
key 30 A
key 31 S
key 32 D
key 33 F
key 34 G
key 35 H
key 36 J
key 37 K
key 38 L
key 39 SEMICOLON
key 40 APOSTROPHE
key 41 GRAVE
key 42 SHIFT_LEFT
key 43 BACKSLASH
key 44 Z
key 45 X
key 46 C
key 47 V
key 48 B
key 49 N
key 50 M
key 51 COMMA
key 52 PERIOD
key 53 SLASH
key 54 SHIFT_RIGHT
key 55 NUMPAD_MULTIPLY
key 56 ALT_LEFT
key 57 SPACE
key 58 CAPS_LOCK
key 59 F1
key 60 F2
key 61 F3
key 62 F4
key 63 F5
key 64 F6
key 65 F7
key 66 F8
key 67 F9
key 68 F10
key 69 NUM_LOCK
key 70 SCROLL_LOCK
key 71 NUMPAD_7
key 72 NUMPAD_8
key 73 NUMPAD_9
key 74 NUMPAD_SUBTRACT
key 75 NUMPAD_4
key 76 NUMPAD_5
key 77 NUMPAD_6
key 78 NUMPAD_ADD
key 79 NUMPAD_1
key 80 NUMPAD_2
key 81 NUMPAD_3
key 82 NUMPAD_0
key 83 NUMPAD_DOT
# key 84 (undefined)
key 85 ZENKAKU_HANKAKU
key 86 BACKSLASH
key 87 F11
key 88 F12
key 89 RO
# key 90 "KEY_KATAKANA"
# key 91 "KEY_HIRAGANA"
key 92 HENKAN
key 93 KATAKANA_HIRAGANA
key 94 MUHENKAN
key 95 NUMPAD_COMMA
key 96 NUMPAD_ENTER
key 97 CTRL_RIGHT
key 98 NUMPAD_DIVIDE
key 99 SYSRQ
key 100 ALT_RIGHT
# key 101 "KEY_LINEFEED"
key 102 MOVE_HOME
key 103 DPAD_UP
key 104 PAGE_UP
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 107 MOVE_END
key 108 DPAD_DOWN
key 109 PAGE_DOWN
key 110 INSERT
key 111 FORWARD_DEL
# key 112 "KEY_MACRO"
key 113 VOLUME_MUTE
key 114 VOLUME_DOWN
key 115 VOLUME_UP
key 116 POWER
key 117 NUMPAD_EQUALS
# key 118 "KEY_KPPLUSMINUS"
key 119 BREAK
# key 120 (undefined)
key 121 NUMPAD_COMMA
key 122 KANA
key 123 EISU
key 124 YEN
key 125 META_LEFT
key 126 META_RIGHT
key 127 MENU
key 128 MEDIA_STOP
# key 129 "KEY_AGAIN"
# key 130 "KEY_PROPS"
# key 131 "KEY_UNDO"
# key 132 "KEY_FRONT"
#key 133 COPY
# key 134 "KEY_OPEN"
#key 135 PASTE
# key 136 "KEY_FIND"
#key 137 CUT
# key 138 "KEY_HELP"
key 139 MENU
key 140 CALCULATOR
# key 141 "KEY_SETUP"
key 142 SLEEP
key 143 WAKEUP
# key 144 "KEY_FILE"
# key 145 "KEY_SENDFILE"
# key 146 "KEY_DELETEFILE"
# key 147 "KEY_XFER"
# key 148 "KEY_PROG1"
# key 149 "KEY_PROG2"
key 150 EXPLORER
# key 151 "KEY_MSDOS"
key 152 POWER
# key 153 "KEY_DIRECTION"
# key 154 "KEY_CYCLEWINDOWS"
key 155 ENVELOPE
key 156 BOOKMARK
# key 157 "KEY_COMPUTER"
key 158 BACK
key 159 FORWARD
key 160 MEDIA_CLOSE
key 161 MEDIA_EJECT
key 162 MEDIA_EJECT
key 163 MEDIA_NEXT
key 164 MEDIA_PLAY_PAUSE
key 165 MEDIA_PREVIOUS
key 166 MEDIA_STOP
key 167 MEDIA_RECORD
key 168 MEDIA_REWIND
key 169 CALL
# key 170 "KEY_ISO"
key 171 MUSIC
key 172 HOME
# key 173 "KEY_REFRESH"
# key 174 "KEY_EXIT"
# key 175 "KEY_MOVE"
# key 176 "KEY_EDIT"
key 177 PAGE_UP
key 178 PAGE_DOWN
key 179 NUMPAD_LEFT_PAREN
key 180 NUMPAD_RIGHT_PAREN
# key 181 "KEY_NEW"
# key 182 "KEY_REDO"
# key 183 F13
# key 184 F14
# key 185 F15
# key 186 F16
# key 187 F17
# key 188 F18
# key 189 F19
# key 190 F20
# key 191 F21
# key 192 F22
# key 193 F23
# key 194 F24
# key 195 (undefined)
# key 196 (undefined)
# key 197 (undefined)
# key 198 (undefined)
# key 199 (undefined)
key 200 MEDIA_PLAY
key 201 MEDIA_PAUSE
# key 202 "KEY_PROG3"
# key 203 "KEY_PROG4"
# key 204 (undefined)
# key 205 "KEY_SUSPEND"
# key 206 "KEY_CLOSE"
key 207 MEDIA_PLAY
key 208 MEDIA_FAST_FORWARD
# key 209 "KEY_BASSBOOST"
# key 210 "KEY_PRINT"
# key 211 "KEY_HP"
key 212 CAMERA
key 213 MUSIC
# key 214 "KEY_QUESTION"
key 215 ENVELOPE
# key 216 "KEY_CHAT"
key 217 SEARCH
# key 218 "KEY_CONNECT"
# key 219 "KEY_FINANCE"
# key 220 "KEY_SPORT"
# key 221 "KEY_SHOP"
# key 222 "KEY_ALTERASE"
# key 223 "KEY_CANCEL"
key 224 BRIGHTNESS_DOWN
key 225 BRIGHTNESS_UP
key 226 HEADSETHOOK
key 256 BUTTON_1
key 257 BUTTON_2
key 258 BUTTON_3
key 259 BUTTON_4
key 260 BUTTON_5
key 261 BUTTON_6
key 262 BUTTON_7
key 263 BUTTON_8
key 264 BUTTON_9
key 265 BUTTON_10
key 266 BUTTON_11
key 267 BUTTON_12
key 268 BUTTON_13
key 269 BUTTON_14
key 270 BUTTON_15
key 271 BUTTON_16
key 288 BUTTON_1
key 289 BUTTON_2
key 290 BUTTON_3
key 291 BUTTON_4
key 292 BUTTON_5
key 293 BUTTON_6
key 294 BUTTON_7
key 295 BUTTON_8
key 296 BUTTON_9
key 297 BUTTON_10
key 298 BUTTON_11
key 299 BUTTON_12
key 300 BUTTON_13
key 301 BUTTON_14
key 302 BUTTON_15
key 303 BUTTON_16
key 304 BUTTON_A
key 305 BUTTON_B
key 306 BUTTON_C
key 307 BUTTON_X
key 308 BUTTON_Y
key 309 BUTTON_Z
key 310 BUTTON_L1
key 311 BUTTON_R1
key 312 BUTTON_L2
key 313 BUTTON_R2
key 314 BUTTON_SELECT
key 315 BUTTON_START
key 316 BUTTON_MODE
key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR
# key 352 "KEY_OK"
key 353 DPAD_CENTER
# key 354 "KEY_GOTO"
# key 355 "KEY_CLEAR"
# key 356 "KEY_POWER2"
# key 357 "KEY_OPTION"
# key 358 "KEY_INFO"
# key 359 "KEY_TIME"
# key 360 "KEY_VENDOR"
# key 361 "KEY_ARCHIVE"
key 362 GUIDE
# key 363 "KEY_CHANNEL"
# key 364 "KEY_FAVORITES"
# key 365 "KEY_EPG"
key 366 DVR
# key 367 "KEY_MHP"
# key 368 "KEY_LANGUAGE"
# key 369 "KEY_TITLE"
# key 370 "KEY_SUBTITLE"
# key 371 "KEY_ANGLE"
# key 372 "KEY_ZOOM"
# key 373 "KEY_MODE"
# key 374 "KEY_KEYBOARD"
# key 375 "KEY_SCREEN"
# key 376 "KEY_PC"
key 377 TV
# key 378 "KEY_TV2"
# key 379 "KEY_VCR"
# key 380 "KEY_VCR2"
# key 381 "KEY_SAT"
# key 382 "KEY_SAT2"
# key 383 "KEY_CD"
# key 384 "KEY_TAPE"
# key 385 "KEY_RADIO"
# key 386 "KEY_TUNER"
# key 387 "KEY_PLAYER"
# key 388 "KEY_TEXT"
# key 389 "KEY_DVD"
# key 390 "KEY_AUX"
# key 391 "KEY_MP3"
# key 392 "KEY_AUDIO"
# key 393 "KEY_VIDEO"
# key 394 "KEY_DIRECTORY"
# key 395 "KEY_LIST"
# key 396 "KEY_MEMO"
key 397 CALENDAR
# key 398 "KEY_RED"
# key 399 "KEY_GREEN"
# key 400 "KEY_YELLOW"
# key 401 "KEY_BLUE"
key 402 CHANNEL_UP
key 403 CHANNEL_DOWN
# key 404 "KEY_FIRST"
# key 405 "KEY_LAST"
# key 406 "KEY_AB"
# key 407 "KEY_NEXT"
# key 408 "KEY_RESTART"
# key 409 "KEY_SLOW"
# key 410 "KEY_SHUFFLE"
# key 411 "KEY_BREAK"
# key 412 "KEY_PREVIOUS"
# key 413 "KEY_DIGITS"
# key 414 "KEY_TEEN"
# key 415 "KEY_TWEN"
key 429 CONTACTS
# key 448 "KEY_DEL_EOL"
# key 449 "KEY_DEL_EOS"
# key 450 "KEY_INS_LINE"
# key 451 "KEY_DEL_LINE"
# key 497 KEY_BRL_DOT1
# key 498 KEY_BRL_DOT2
# key 499 KEY_BRL_DOT3
# key 500 KEY_BRL_DOT4
# key 501 KEY_BRL_DOT5
# key 502 KEY_BRL_DOT6
# key 503 KEY_BRL_DOT7
# key 504 KEY_BRL_DOT8
key 580 APP_SWITCH
key 582 VOICE_ASSIST
# Keys defined by HID usages
key usage 0x0c006F BRIGHTNESS_UP
key usage 0x0c0070 BRIGHTNESS_DOWN
# Joystick and game controller axes.
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x03 RX
axis 0x04 RY
axis 0x05 RZ
axis 0x06 THROTTLE
axis 0x07 RUDDER
axis 0x08 WHEEL
axis 0x09 GAS
axis 0x0a BRAKE
axis 0x10 HAT_X
axis 0x11 HAT_Y
# LEDs
led 0x00 NUM_LOCK
led 0x01 CAPS_LOCK
led 0x02 SCROLL_LOCK
led 0x03 COMPOSE
led 0x04 KANA
led 0x05 SLEEP
led 0x06 SUSPEND
led 0x07 MUTE
led 0x08 MISC
led 0x09 MAIL
led 0x0a CHARGING

View File

@ -0,0 +1,19 @@
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
sharedlibdir=${prefix}/lib
includedir=${prefix}/include
Name: tvhal
Description: cdroid porting layer
Version: 1.0.0
#Requires Requires.private libs that supported by pkgconfig
Requires: @PKGCONFIG_LIBS@
Requires.private: @PKGCONFIG_LIBS_PRIVATE@
#Libs& Libs.private libs that pkg-config cant support
Libs: @NONPKG_LIBS@
Libs.private: @NONPKG_LIBS_PRIVATE@
Cflags: -I"${includedir}/porting"

View File

@ -0,0 +1,130 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DFB_TYPES_H__
#define __DFB_TYPES_H__
#include <direct/types.h>
#ifdef WIN32
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the DIRECTFB_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// DIRECTFB_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef DIRECTFB_EXPORTS
#define DIRECTFB_API __declspec(dllexport)
#else
#define DIRECTFB_API __declspec(dllimport)
#endif
#else
#define DIRECTFB_API
#endif
#ifdef DIRECTFB_ENABLE_DEPRECATED
#define __u8 u8
#define __u16 u16
#define __u32 u32
#define __u64 u64
#define __s8 s8
#define __s16 s16
#define __s32 s32
#define __s64 s64
#endif
/*
* Return code of all interface methods and most functions
*
* Whenever a method has to return any information, it is done via output parameters. These are pointers to
* primitive types such as <i>int *ret_num</i>, enumerated types like <i>DFBBoolean *ret_enabled</i>, structures
* as in <i>DFBDisplayLayerConfig *ret_config</i>, just <i>void **ret_data</i> or other types...
*/
typedef enum {
/*
* Aliases for backward compatibility and uniform look in DirectFB code
*/
DFB_OK = DR_OK, /* No error occured. */
DFB_FAILURE = DR_FAILURE, /* A general or unknown error occured. */
DFB_INIT = DR_INIT, /* A general initialization error occured. */
DFB_BUG = DR_BUG, /* Internal bug or inconsistency has been detected. */
DFB_DEAD = DR_DEAD, /* Interface has a zero reference counter (available in debug mode). */
DFB_UNSUPPORTED = DR_UNSUPPORTED, /* The requested operation or an argument is (currently) not supported. */
DFB_UNIMPLEMENTED = DR_UNIMPLEMENTED, /* The requested operation is not implemented, yet. */
DFB_ACCESSDENIED = DR_ACCESSDENIED, /* Access to the resource is denied. */
DFB_INVAREA = DR_INVAREA, /* An invalid area has been specified or detected. */
DFB_INVARG = DR_INVARG, /* An invalid argument has been specified. */
DFB_NOSYSTEMMEMORY = DR_NOLOCALMEMORY, /* There's not enough system memory. */
DFB_NOSHAREDMEMORY = DR_NOSHAREDMEMORY, /* There's not enough shared memory. */
DFB_LOCKED = DR_LOCKED, /* The resource is (already) locked. */
DFB_BUFFEREMPTY = DR_BUFFEREMPTY, /* The buffer is empty. */
DFB_FILENOTFOUND = DR_FILENOTFOUND, /* The specified file has not been found. */
DFB_IO = DR_IO, /* A general I/O error occured. */
DFB_BUSY = DR_BUSY, /* The resource or device is busy. */
DFB_NOIMPL = DR_NOIMPL, /* No implementation for this interface or content type has been found. */
DFB_TIMEOUT = DR_TIMEOUT, /* The operation timed out. */
DFB_THIZNULL = DR_THIZNULL, /* 'thiz' pointer is NULL. */
DFB_IDNOTFOUND = DR_IDNOTFOUND, /* No resource has been found by the specified id. */
DFB_DESTROYED = DR_DESTROYED, /* The underlying object (e.g. a window or surface) has been destroyed. */
DFB_FUSION = DR_FUSION, /* Internal fusion error detected, most likely related to IPC resources. */
DFB_BUFFERTOOLARGE = DR_BUFFERTOOLARGE, /* Buffer is too large. */
DFB_INTERRUPTED = DR_INTERRUPTED, /* The operation has been interrupted. */
DFB_NOCONTEXT = DR_NOCONTEXT, /* No context available. */
DFB_TEMPUNAVAIL = DR_TEMPUNAVAIL, /* Temporarily unavailable. */
DFB_LIMITEXCEEDED = DR_LIMITEXCEEDED, /* Attempted to exceed limit, i.e. any kind of maximum size, count etc. */
DFB_NOSUCHMETHOD = DR_NOSUCHMETHOD, /* Requested method is not known, e.g. to remote site. */
DFB_NOSUCHINSTANCE = DR_NOSUCHINSTANCE, /* Requested instance is not known, e.g. to remote site. */
DFB_ITEMNOTFOUND = DR_ITEMNOTFOUND, /* No such item found. */
DFB_VERSIONMISMATCH = DR_VERSIONMISMATCH, /* Some versions didn't match. */
DFB_EOF = DR_EOF, /* Reached end of file. */
DFB_SUSPENDED = DR_SUSPENDED, /* The requested object is suspended. */
DFB_INCOMPLETE = DR_INCOMPLETE, /* The operation has been executed, but not completely. */
DFB_NOCORE = DR_NOCORE, /* Core part not available. */
/*
* DirectFB specific result codes starting at (after) this offset
*/
DFB__RESULT_BASE = D_RESULT_TYPE_CODE_BASE( 'D','F','B','1' ),
DFB_NOVIDEOMEMORY, /* There's not enough video memory. */
DFB_MISSINGFONT, /* No font has been set. */
DFB_MISSINGIMAGE, /* No image has been set. */
DFB_NOALLOCATION, /* No allocation. */
DFB_NOBUFFER, /* No buffer. */
DFB__RESULT_END
} DFBResult;
#endif

View File

@ -0,0 +1,63 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __DFIFF_H__
#define __DFIFF_H__
#include <inttypes.h>
#define DFIFF_FLAG_LITTLE_ENDIAN 0x01
#define DFIFF_FLAG_PREMULTIPLIED 0x02
typedef struct {
unsigned char magic[5]; /* "DFIFF" magic */
unsigned char major; /* Major version number */
unsigned char minor; /* Minor version number */
unsigned char flags; /* Some flags like endianess */
/* From now on endianess matters... */
uint32_t width;
uint32_t height;
DFBSurfacePixelFormat format;
uint32_t pitch;
} DFIFFHeader;
#endif

View File

@ -0,0 +1,103 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This file is subject to the terms and conditions of the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __DGIFF_H__
#define __DGIFF_H__
#include <inttypes.h>
#define DGIFF_FLAG_LITTLE_ENDIAN 0x01
typedef struct {
unsigned char magic[5]; /* "DGIFF" magic */
unsigned char major; /* Major version number */
unsigned char minor; /* Minor version number */
unsigned char flags; /* Some flags like endianess */
/* From now on endianess matters... */
uint32_t num_faces;
uint32_t __pad;
} DGIFFHeader;
typedef struct {
int32_t next_face; /* byte offset from this to next face */
int32_t size;
int32_t ascender;
int32_t descender;
int32_t height;
int32_t max_advance;
uint32_t pixelformat;
uint32_t num_glyphs;
uint32_t num_rows;
DFBSurfaceBlittingFlags blittingflags;
} DGIFFFaceHeader;
typedef struct {
uint32_t unicode;
uint32_t row;
int32_t offset;
int32_t width;
int32_t height;
int32_t left;
int32_t top;
int32_t advance;
} DGIFFGlyphInfo;
typedef struct {
int32_t width;
int32_t height;
int32_t pitch; /* Preferably 8 byte aligned */
uint32_t __pad;
/* Raw pixel data follows, "height * pitch" bytes. */
} DGIFFGlyphRow;
#endif

View File

@ -0,0 +1,341 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__Lists__H___
#define ___Direct__Lists__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#include <list>
#include <map>
#include <direct/LockWQ.h>
namespace Direct {
template <typename _Item>
class List
{
public:
virtual ~List()
{
}
virtual void Append ( const _Item &item ) = 0;
virtual void Prepend( const _Item &item ) = 0;
virtual void Remove ( const _Item &item ) = 0;
virtual size_t Length () const = 0;
virtual void Clear () = 0;
};
template <typename _Item>
class ListSimpleSlow : public List<_Item>
{
public:
ListSimpleSlow()
:
length( 0 )
{
}
virtual ~ListSimpleSlow()
{
D_ASSUME( list.empty() );
}
virtual void Append( const _Item &item )
{
list.push_back( item );
length++;
}
virtual void Prepend( const _Item &item )
{
list.push_front( item );
length++;
}
virtual void Remove( const _Item &item )
{
D_ASSERT( length > 0 );
list.remove( item );
length--;
}
virtual size_t Length() const
{
return length;
}
virtual void Clear()
{
list.clear();
}
typedef typename std::list<_Item>::const_iterator const_iterator;
inline const_iterator begin() const { return list.begin(); }
inline const_iterator end() const { return list.end(); }
private:
std::list<_Item> list;
size_t length;
};
template <typename _Item>
class ListSimple : public List<_Item>
{
public:
ListSimple()
{
}
virtual ~ListSimple()
{
D_ASSUME( map.empty() );
}
virtual void Append( const _Item &item )
{
map[ item ] = item;
}
virtual void Prepend( const _Item &item )
{
map[ item ] = item;
}
virtual void Remove( const _Item &item )
{
map.erase( item );
}
virtual size_t Length() const
{
return map.size();
}
virtual void Clear()
{
map.clear();
}
typedef typename std::map<_Item,_Item>::const_iterator const_iterator;
inline const_iterator begin() const { return map.begin(); }
inline const_iterator end() const { return map.end(); }
private:
std::map<_Item,_Item> map;
};
template <typename _Item>
class ListLockedSlow : public List<_Item>
{
public:
ListLockedSlow()
:
length( 0 )
{
}
virtual ~ListLockedSlow()
{
D_ASSUME( list.empty() );
}
virtual void Append( const _Item &item )
{
LockWQ::Lock l1( lwq );
list.push_back( item );
length++;
}
virtual void Prepend( const _Item &item )
{
LockWQ::Lock l1( lwq );
list.push_front( item );
length++;
}
virtual void Remove( const _Item &item )
{
D_ASSERT( length > 0 );
LockWQ::Lock l1( lwq );
list.remove( item );
length--;
if (length == 0)
lwq.notifyAll();
}
virtual size_t Length() const
{
return length;
}
virtual void Clear()
{
LockWQ::Lock l1( lwq );
if (length > 0) {
list.clear();
length = 0;
lwq.notifyAll();
}
}
void WaitEmpty()
{
LockWQ::Lock l1( lwq );
while (!list.empty())
l1.wait();
}
private:
LockWQ lwq;
std::list<_Item> list;
size_t length;
};
template <typename _Item>
class ListLocked : public List<_Item>
{
public:
ListLocked()
{
}
virtual ~ListLocked()
{
D_ASSUME( map.empty() );
}
virtual void Append( const _Item &item )
{
LockWQ::Lock l1( lwq );
map[ item ] = item;
}
virtual void Prepend( const _Item &item )
{
LockWQ::Lock l1( lwq );
map[ item ] = item;
}
virtual void Remove( const _Item &item )
{
LockWQ::Lock l1( lwq );
map.erase( item );
if (map.empty())
lwq.notifyAll();
}
virtual size_t Length() const
{
return map.size();
}
virtual void Clear()
{
LockWQ::Lock l1( lwq );
if (!map.empty()) {
map.clear();
lwq.notifyAll();
}
}
void WaitEmpty()
{
LockWQ::Lock l1( lwq );
while (!map.empty())
l1.wait();
}
private:
LockWQ lwq;
std::map<_Item,_Item> map;
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,142 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__LockWQ__H___
#define ___Direct__LockWQ__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <direct/os/mutex.h>
#include <direct/os/waitqueue.h>
#ifdef __cplusplus
}
namespace Direct {
class LockWQ
{
public:
LockWQ()
{
direct_mutex_init( &mutex );
direct_waitqueue_init( &wq );
}
~LockWQ()
{
direct_mutex_deinit( &mutex );
direct_waitqueue_deinit( &wq );
}
void lock()
{
direct_mutex_lock( &mutex );
}
void unlock()
{
direct_mutex_unlock( &mutex );
}
DirectResult wait( unsigned long timeout_us = 0 )
{
if (timeout_us > 0)
return direct_waitqueue_wait_timeout( &wq, &mutex, timeout_us );
return direct_waitqueue_wait( &wq, &mutex );
}
void notify()
{
direct_waitqueue_signal( &wq );
}
void notifyAll()
{
direct_waitqueue_broadcast( &wq );
}
class Lock {
public:
Lock( LockWQ &lwq )
:
lwq( lwq ),
unlocked( false )
{
lwq.lock();
}
~Lock()
{
if (!unlocked)
lwq.unlock();
}
DirectResult wait( unsigned long timeout_us = 0 )
{
return lwq.wait( timeout_us );
}
void unlock()
{
unlocked = true;
lwq.unlock();
}
private:
LockWQ &lwq;
bool unlocked;
};
private:
DirectMutex mutex;
DirectWaitQueue wq;
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,95 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__Magic__H___
#define ___Direct__Magic__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
namespace Direct {
template <typename _Entity>
class Magic {
private:
int magic;
#if D_DEBUG_ENABLED
public:
Magic()
:
magic(0)
{
D_MAGIC_SET( this, _Entity ); // FIXME: make overall macro to avoid using "_Entity" all over the place
}
~Magic()
{
D_MAGIC_ASSERT( this, _Entity );
D_MAGIC_CLEAR( this );
}
protected:
inline void CHECK_MAGIC() const {
D_MAGIC_ASSERT( this, _Entity );
}
#else
protected:
inline void CHECK_MAGIC() const {
}
#endif
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,105 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__Mutex__H___
#define ___Direct__Mutex__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <direct/os/mutex.h>
#ifdef __cplusplus
}
namespace Direct {
class Mutex
{
public:
Mutex()
{
direct_mutex_init( &mutex );
}
~Mutex()
{
direct_mutex_deinit( &mutex );
}
void lock()
{
direct_mutex_lock( &mutex );
}
void unlock()
{
direct_mutex_unlock( &mutex );
}
class Lock {
public:
Lock( Mutex &mutex )
:
mutex( mutex )
{
mutex.lock();
}
~Lock()
{
mutex.unlock();
}
private:
Mutex &mutex;
};
private:
DirectMutex mutex;
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,88 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__Performer__H___
#define ___Direct__Performer__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <direct/perf.h>
#ifdef __cplusplus
}
#include <direct/String.h>
namespace Direct {
class PerfCounter {
public:
DirectPerfCounterInstallation counter;
PerfCounter( const Direct::String &name = Direct::String(), bool reset_on_dump = false )
{
counter.counter_id = 0;
counter.reset_on_dump = reset_on_dump;
direct_snputs( counter.name, name.buffer(), sizeof(counter.name) );
}
};
class Performer
{
public:
Performer()
{
}
protected:
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,263 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__String__H___
#define ___Direct__String__H___
#ifdef __cplusplus
#include <direct/Types++.h>
extern "C" {
#endif
#include <direct/compiler.h>
#include <direct/log.h>
#include <direct/log_domain.h>
// C Wrapper
__dfb_no_instrument_function__
D_String *D_String_NewEmpty( void );
__dfb_no_instrument_function__
size_t D_String_PrintF( D_String *str, const char *format, ... ) D_FORMAT_PRINTF(2);
__dfb_no_instrument_function__
size_t D_String_PrintV( D_String *str, const char *format, va_list args );
__dfb_no_instrument_function__
const char *D_String_Buffer( D_String *str );
__dfb_no_instrument_function__
size_t D_String_Length( D_String *str );
__dfb_no_instrument_function__
void D_String_Delete( D_String *str );
__dfb_no_instrument_function__
const char *D_String_CopyTLS( D_String *str );
__dfb_no_instrument_function__
const char *D_String_PrintTLS( const char *format, ... ) D_FORMAT_PRINTF(1);
#ifdef __cplusplus
}
#include <ostream>
#include <string>
#include <vector>
namespace Direct {
template <class _CharT = char>
class StringBase
{
private:
std::basic_string<_CharT> _str;
std::basic_string<_CharT> &str;
public:
StringBase()
:
str( _str )
{
}
StringBase( const StringBase<_CharT> &other )
:
_str( other.str ),
str( _str )
{
}
StringBase( std::string &str )
:
str( str )
{
}
StringBase( const _CharT *str )
:
_str( str ),
str( _str )
{
}
/*
* Copies the string to a TLS buffer using fixed number of 32 buffers used in a circular way, so it should
* fit even for the heaviest legacy print (in C without management of String objects in parameter list).
*/
const _CharT *CopyTLS();
StringBase &
PrintF( const _CharT *format, ... ) D_FORMAT_PRINTF(2);
StringBase &
PrintF( const _CharT *format, va_list args, size_t stack_buffer = 300 );
static StringBase F( const _CharT *format, ... ) D_FORMAT_PRINTF(1);
void
Clear();
StringsBase<_CharT>
GetTokens( const StringBase<_CharT> &delimiter ) const;
inline std::string &
string()
{
return str;
}
inline const _CharT *
buffer() const
{
return str.c_str();
}
inline size_t
length() const
{
return str.size();
}
/*
* Use
*/
inline operator const std::string& () const {
return str;
}
inline const _CharT * operator *() const {
return buffer();
}
inline bool operator ==(const _CharT *buf) const {
return !strcmp( buffer(), buf );
}
/*
* Assign
*/
inline StringBase& operator= (const _CharT *buf) {
str = buf;
return *this;
}
inline StringBase& operator= (const StringBase &other) {
_str = other.str;
str = _str;
return *this;
}
/*
* Append
*/
inline StringBase& operator+= (const StringBase &other) {
str.append( other.str );
return *this;
}
inline StringBase& operator+= (const _CharT *buf) {
str.append( buf );
return *this;
}
inline StringBase operator+ (const _CharT *buf) {
StringBase<_CharT> result = *this;
result.str.append( buf );
return result;
}
/*
* Streams
*/
friend std::ostream &operator << (std::ostream &stream, const StringBase<_CharT> &string) {
stream << string.str;
return stream;
}
friend DirectLog *operator << (DirectLog *log, const StringBase<_CharT> &string) {
direct_log_write( log, string.buffer(), string.length() );
return log;
}
friend DirectLogDomain &operator << (DirectLogDomain &domain, const StringBase<_CharT> &string) {
direct_log_domain_log( &domain, DIRECT_LOG_VERBOSE, __FUNCTION__, __FILE__, __LINE__, "%s", string.buffer() );
return domain;
}
};
template <class _CharT = char>
class StringsBase : public std::vector<StringBase<_CharT> >
{
public:
Direct::String
Concatenated( const Direct::String &space ) const
{
Direct::String result;
const char *s = "";
for (typename StringsBase::const_iterator it = this->begin(); it != this->end(); it++) {
result.PrintF( "%s%s", s, **it );
s = *space;
}
return result;
}
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,193 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__TLSObject__H___
#define ___Direct__TLSObject__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <direct/os/thread.h>
#ifdef __cplusplus
}
#include <list>
#include <direct/Mutex.h>
namespace Direct {
template <typename Object, typename Params, typename Host>
class TLSObject
{
private:
void *ctx;
DirectTLS tls;
public:
TLSObject( void *ctx )
:
ctx( ctx )
{
direct_tls_register( &tls, Host::tls_destroy );
}
~TLSObject()
{
direct_tls_unregister( &tls );
}
Object *Get( Params &params )
{
Object *obj = (Object*) direct_tls_get( tls );
if (!obj) {
obj = Host::tls_create( ctx, params );
if (!obj)
return NULL;
direct_tls_set( tls, obj );
}
return obj;
}
void Delete()
{
Object *obj = (Object*) direct_tls_get( tls );
if (obj) {
direct_tls_set( tls, NULL );
delete obj;
}
}
};
template <typename Object, typename Creator=Object, typename Destroyer=Creator>
class TLSObject2
{
private:
void *ctx;
DirectTLS tls;
Mutex lock;
std::list<Object*> list;
public:
TLSObject2( void *ctx = NULL )
:
ctx( ctx )
{
direct_tls_register( &tls, TLSObject2::destructor );
}
~TLSObject2()
{
direct_tls_unregister( &tls );
}
Object *Get( void *params = NULL )
{
Object *obj = (Object*) direct_tls_get( tls );
if (!obj) {
obj = Creator::create( ctx, params );
if (!obj)
return NULL;
lock.lock();
list.push_back( obj );
lock.unlock();
direct_tls_set( tls, obj );
}
return obj;
}
void Delete()
{
Object *obj = (Object*) direct_tls_get( tls );
if (obj) {
direct_tls_set( tls, NULL );
lock.lock();
list.remove( obj );
lock.unlock();
delete obj;
}
}
void DeleteAll()
{
lock.lock();
std::list<Object*> list_copy = list;
list.clear();
direct_tls_unregister( &tls );
direct_tls_register( &tls, TLSObject2::destructor );
lock.unlock();
for (typename std::list<Object*>::iterator it=list_copy.begin(); it!=list_copy.end(); it++)
delete *it;
}
private:
static void destructor( void *ptr )
{
Destroyer::destroy( NULL, (Object*) ptr );
}
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,104 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ___Direct__ToString__H___
#define ___Direct__ToString__H___
#include <direct/Types++.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#include <direct/String.h>
/*
* In global namespace to allow universal usage without Direct::
*/
template <typename _Entity>
class ToString : public Direct::String
{
public:
ToString( const _Entity &entity );
};
class FromStringBase
{
public:
FromStringBase()
:
success( false )
{
}
operator bool() const {
return success;
}
protected:
bool success;
};
template <typename _Entity>
class FromString : public FromStringBase
{
public:
FromString( _Entity &entity, const Direct::String &string );
};
template<>
inline ToString<int>::ToString( const int &n )
{
PrintF( "%d", n );
}
#define D_FLAG_PRINTFn( __n, __flags, __FLAGS, __FLAG ) \
if ((__flags) & (__FLAGS##__FLAG)) \
PrintF( "%s" #__FLAG, (__n)++ ? "," : "" );
#endif // __cplusplus
#endif

View File

@ -0,0 +1,61 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__TYPESPP_H__
#define __DIRECT__TYPESPP_H__
extern "C" {
#include <direct/types.h>
}
#include <map>
namespace Direct {
// NOTE: if build fails here we most likely have the above error due to nested extern "C"
template <typename _Item> class List;
template <typename _Item> class ListLocked;
template <typename _Item> class ListSimple;
template <typename _CharT> class StringBase;
template <typename _CharT> class StringsBase;
typedef StringBase<char> String;
typedef StringsBase<char> Strings;
}
#define D_String Direct::String
#endif

View File

@ -0,0 +1,504 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__ATOMIC_H__
#define __DIRECT__ATOMIC_H__
#include <direct/types.h>
#if !DIRECT_BUILD_GCC_ATOMICS
#if defined (__SH4__) || defined (__SH4A__)
/*
* SH4 Atomic Operations
*/
#define D_SYNC_BOOL_COMPARE_AND_SWAP( ptr, old_value, new_value ) \
({ \
__typeof__(*(ptr)) __temp; \
__typeof__(*(ptr)) __result; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%2, %0 \n" \
" mov %0, %1 \n" \
" cmp/eq %1, %3 \n" \
" bf 2f \n" \
" mov %4, %0 \n" \
"2: \n" \
" movco.l %0, @%2 \n" \
" bf 1b \n" \
" synco \n" \
: "=&z" (__temp), "=&r" (__result) \
: "r" (ptr), "r" (old_value), "r" (new_value) \
: "t" \
); \
\
__result == (old_value); \
})
#define D_SYNC_ADD_AND_FETCH( ptr, value ) \
({ \
__typeof__(*(ptr)) __result; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%1, %0 \n" \
" add %2, %0 \n" \
" movco.l %0, @%1 \n" \
" bf 1b \n" \
" synco \n" \
: "=&z" (__result) \
: "r" (ptr), "r" (value) \
: "t" \
); \
\
__result; \
})
#define D_SYNC_FETCH_AND_CLEAR( ptr ) \
({ \
__typeof__(*(ptr)) __temp; \
__typeof__(*(ptr)) __result; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%2, %0 \n" \
" mov %0, %1 \n" \
" xor %0, %0 \n" \
" movco.l %0, @%2 \n" \
" bf 1b \n" \
" synco \n" \
: "=&z" (__temp), "=&r" (__result) \
: "r" (ptr) \
: "t" \
); \
\
__result; \
})
#define D_SYNC_ADD( ptr, value ) \
do { \
__typeof__(*(ptr)) __temp; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%1, %0 \n" \
" add %2, %0 \n" \
" movco.l %0, @%1 \n" \
" bf 1b \n" \
: "=&z" (__temp) \
: "r" (ptr), "r" (value) \
: "t" \
); \
} while (0)
/*
* FIFO Push
*
* *iptr = *fptr
* *fptr = iptr
*/
#define D_SYNC_PUSH_SINGLE( fptr, iptr ) \
do { \
unsigned long **__fptr = (unsigned long **)(fptr); \
unsigned long **__iptr = (unsigned long **)(iptr); \
unsigned long *__temp; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%1, %0 \n" \
" mov.l %0, @%2 \n" \
" mov %2, %0 \n" \
" movco.l %0, @%1 \n" \
" bf 1b \n" \
" synco \n" \
: "=&z" (__temp) \
: "r" (__fptr), "r" (__iptr) \
: "t" \
); \
} while (0)
/*
* FIFO Pop
*
* iptr = *fptr
* *fptr = *iptr <- if iptr != NULL
*
* return iptr
*/
#define D_SYNC_POP_SINGLE( fptr ) \
({ \
unsigned long **__fptr = (unsigned long **)(fptr); \
unsigned long **__iptr; \
unsigned long *__temp; \
\
__asm__ __volatile__ ( \
"1: \n" \
" movli.l @%2, %0 \n" \
" mov %0, %1 \n" \
" cmp/eq #0, %0 \n" \
" bt 2f \n" \
" mov.l @%1, %0 \n" \
"2: \n" \
" movco.l %0, @%2 \n" \
" bf 1b \n" \
" synco \n" \
: "=&z" (__temp), "=&r" (__iptr) \
: "r" (__fptr) \
: "t" \
); \
\
(__typeof__(*(fptr))) __iptr; \
})
#endif
#if defined(ARCH_ARMv7) && !defined(ARCH_IWMMXT)
static inline int _D__atomic_cmpxchg(volatile int *ptr, int old, int _new)
{
unsigned long oldval, res;
do {
__asm__ __volatile__("@ atomic_cmpxchg\n"
"ldrex %1, [%2]\n"
"mov %0, #0\n"
"teq %1, %3\n"
"strexeq %0, %4, [%2]\n"
: "=&r" (res), "=&r" (oldval)
: "r" (ptr), "Ir" (old), "r" (_new)
: "cc");
} while (res);
return oldval;
}
#define D_SYNC_BOOL_COMPARE_AND_SWAP( ptr, old_value, new_value ) \
(_D__atomic_cmpxchg( (void*) ptr, (int) old_value, (int) new_value ) == (int) old_value)
#define D_SYNC_FETCH_AND_CLEAR( ptr ) \
({ \
volatile __typeof__((ptr)) __ptr = (ptr); \
__typeof__(*(ptr)) __temp; \
\
do { \
__temp = (*__ptr); \
} while (!D_SYNC_BOOL_COMPARE_AND_SWAP( __ptr, __temp, 0 )); \
\
__temp; \
})
static inline int _D__atomic_add_return(int i, volatile int *v)
{
unsigned long tmp;
int result;
__asm__ __volatile__("@ atomic_add_return\n"
"1: ldrex %0, [%2]\n"
" add %0, %0, %3\n"
" strex %1, %0, [%2]\n"
" teq %1, #0\n"
" bne 1b"
: "=&r" (result), "=&r" (tmp)
: "r" (v), "Ir" (i)
: "cc");
return result;
}
#define D_SYNC_ADD_AND_FETCH( ptr, value ) \
(_D__atomic_add_return( (int) (value), (volatile int*) (ptr) ))
#endif
#if defined(ARCH_MIPS)
static inline int _D__atomic_cmpxchg(volatile int *ptr, int old, int _new)
{
unsigned long retval;
__asm__ __volatile__(
" .set push \n"
" .set noat \n"
" .set mips3 \n"
"1: ll %0, %2 # __cmpxchg_u32 \n"
" bne %0, %z3, 2f \n"
" .set mips0 \n"
" move $1, %z4 \n"
" .set mips3 \n"
" sc $1, %1 \n"
" beqz $1, 1b \n"
#ifdef CONFIG_SMP
" sync \n"
#endif
"2: \n"
" .set pop \n"
: "=&r" (retval), "=R" (*ptr)
: "R" (*ptr), "Jr" (old), "Jr" (_new)
: "memory");
return retval;
}
#define D_SYNC_BOOL_COMPARE_AND_SWAP( ptr, old_value, new_value ) \
(_D__atomic_cmpxchg( (void*) ptr, (int) old_value, (int) new_value ) == (int) old_value)
#define D_SYNC_FETCH_AND_CLEAR( ptr ) \
({ \
volatile __typeof__((ptr)) __ptr = (ptr); \
__typeof__(*(ptr)) __temp; \
\
do { \
__temp = (*__ptr); \
} while (!D_SYNC_BOOL_COMPARE_AND_SWAP( __ptr, __temp, 0 )); \
\
__temp; \
})
static inline int _D__atomic_add_return(int i, volatile int *v)
{
int temp;
__asm__ __volatile__(
" .set mips3 \n"
"1: ll %0, %1 # atomic_add \n"
" addu %0, %2 \n"
" sc %0, %1 \n"
" beqz %0, 2f \n"
" .subsection 2 \n"
"2: b 1b \n"
" .previous \n"
" .set mips0 \n"
: "=&r" (temp), "=m" (*v)
: "Ir" (i), "m" (*v));
return temp;
}
#define D_SYNC_ADD_AND_FETCH( ptr, value ) \
_D__atomic_add_return( (int) (value), (volatile int*) (ptr) )
#endif
#endif // !DIRECT_BUILD_GCC_ATOMICS
#ifdef WIN32
/*
* Win32
*/
#ifndef D_SYNC_BOOL_COMPARE_AND_SWAP
#define D_SYNC_BOOL_COMPARE_AND_SWAP( ptr, old_value, new_value ) \
0
#endif
#ifndef D_SYNC_FETCH_AND_CLEAR
#define D_SYNC_FETCH_AND_CLEAR( ptr ) \
0
#endif
#ifndef D_SYNC_ADD_AND_FETCH
#define D_SYNC_ADD_AND_FETCH( ptr, value ) \
0
#endif
#ifndef D_SYNC_ADD
#define D_SYNC_ADD( ptr, value ) \
0
#endif
#else //WIN32
#ifndef D_SYNC_BOOL_COMPARE_AND_SWAP
#define D_SYNC_BOOL_COMPARE_AND_SWAP( ptr, old_value, new_value ) \
__sync_bool_compare_and_swap( ptr, old_value, new_value )
#endif
#ifndef D_SYNC_FETCH_AND_CLEAR
#define D_SYNC_FETCH_AND_CLEAR( ptr ) \
__sync_fetch_and_and( ptr, 0 )
#endif
#ifndef D_SYNC_ADD_AND_FETCH
#define D_SYNC_ADD_AND_FETCH( ptr, value ) \
__sync_add_and_fetch( ptr, value )
#if 0
({ \
int __val; \
volatile int *__ptr = (volatile int *)(void*)(ptr); \
\
do { \
__val = *__ptr; \
} while (!D_SYNC_BOOL_COMPARE_AND_SWAP( __ptr, __val, __val + value )); \
\
__val + value; \
})
#endif
#endif
#ifndef D_SYNC_ADD
#define D_SYNC_ADD( ptr, value ) \
do { (void) D_SYNC_ADD_AND_FETCH( ptr, value ); } while (0)
#endif
#endif //!WIN32
/*
* FIFO Push
*
* *iptr = *fptr
* *fptr = iptr
*/
#ifndef D_SYNC_PUSH_SINGLE
#define D_SYNC_PUSH_SINGLE( fptr, iptr ) \
do { \
volatile long **__fptr = (volatile long **)(void*)(fptr); \
volatile long **__iptr = (volatile long **)(void*)(iptr); \
\
do { \
*__iptr = *__fptr; \
} while (!D_SYNC_BOOL_COMPARE_AND_SWAP( __fptr, *__iptr, __iptr )); \
} while (0)
#endif
#ifndef D_SYNC_PUSH_MULTI
#define D_SYNC_PUSH_MULTI( fptr, iptr ) \
do { \
volatile long **__fptr = (volatile long **)(void*)(fptr); \
volatile long **__iptr = (volatile long **)(void*)(iptr); \
volatile unsigned int n = 1; \
unsigned int r = 0; \
\
while (true) { \
*__iptr = *__fptr; \
\
if (D_SYNC_BOOL_COMPARE_AND_SWAP( __fptr, *__iptr, __iptr )) \
break; \
\
r = ((r + n) & 0x7f); \
\
for (n=0; n<r; n++); \
} \
} while (0)
#endif
/*
* FIFO Pop
*
* iptr = *fptr
* *fptr = *iptr
*
* return iptr
*/
#ifndef D_SYNC_POP_SINGLE
#ifdef WIN32
#define D_SYNC_POP_SINGLE( fptr ) \
0
#else
#define D_SYNC_POP_SINGLE( fptr ) \
({ \
volatile long **__fptr = (volatile long**)(void*)(fptr); \
volatile long *__iptr; \
\
do { \
__iptr = *__fptr; \
} while (__iptr && !D_SYNC_BOOL_COMPARE_AND_SWAP( __fptr, __iptr, *__iptr )); \
\
(__typeof__(*(fptr))) __iptr; \
})
#endif
#endif
#ifndef D_SYNC_POP_MULTI
#define D_SYNC_POP_MULTI( fptr ) \
({ \
volatile long **__fptr = (volatile long**)(void*)(fptr); \
volatile long *__iptr; \
volatile int n = 1; \
volatile int r = 0; \
\
while (true) { \
__iptr = *__fptr; \
\
if (D_SYNC_BOOL_COMPARE_AND_SWAP( __fptr, __iptr, *__iptr )) \
break; \
\
r = ((r + n) & 0x7f); \
\
for (n=0; n<r; n++); \
} \
\
(__typeof__(*(fptr))) __iptr; \
})
#endif
#ifndef D_SYNC_PUSH
#if DIRECT_BUILD_MULTICORE
#define D_SYNC_PUSH D_SYNC_PUSH_MULTI
#else
#define D_SYNC_PUSH D_SYNC_PUSH_SINGLE
#endif
#endif
#ifndef D_SYNC_POP
#if DIRECT_BUILD_MULTICORE
#define D_SYNC_POP D_SYNC_POP_MULTI
#else
#define D_SYNC_POP D_SYNC_POP_SINGLE
#endif
#endif
#endif

View File

@ -0,0 +1,65 @@
/*
(c) Copyright 2001-2011 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__BUILD_H__
#define __DIRECT__BUILD_H__
#define DIRECT_OS_LINUX_GNU_LIBC (0)
#define DIRECT_OS_LINUX_KERNEL (1)
#define DIRECT_OS_PSP (2)
#define DIRECT_OS_WIN32 (3)
#define DIRECT_OS_FAMOS (4)
#define DIRECT_BUILD_DEBUG (0)
#define DIRECT_BUILD_DEBUGS (1)
#define DIRECT_BUILD_TRACE (0)
#define DIRECT_BUILD_TEXT (1)
#define DIRECT_BUILD_GETTID (1)
#define DIRECT_BUILD_NETWORK (0)
#define DIRECT_BUILD_STDBOOL (1)
#define DIRECT_BUILD_DYNLOAD (0)
#define DIRECT_BUILD_MULTICORE (1)
#define DIRECT_BUILD_OSTYPE (DIRECT_OS_LINUX_GNU_LIBC)
#define DIRECT_BUILD_GCC_ATOMICS (0)
#if !DIRECT_BUILD_DEBUGS
#if defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
#define DIRECT_MINI_DEBUG
#endif
#undef DIRECT_ENABLE_DEBUG
#ifdef DIRECT_FORCE_DEBUG
#warning DIRECT_FORCE_DEBUG used with 'pure release' library headers.
#undef DIRECT_FORCE_DEBUG
#endif
#endif
#endif

View File

@ -0,0 +1,55 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__CLOCK_H__
#define __DIRECT__CLOCK_H__
#include <direct/os/clock.h>
/**********************************************************************************************************************/
long long DIRECT_API direct_clock_get_abs_micros( void );
long long DIRECT_API direct_clock_get_abs_millis( void );
long long DIRECT_API direct_clock_get_micros( void );
long long DIRECT_API direct_clock_get_millis( void );
#ifndef DIRECT_DISABLE_DEPRECATED
// @deprecated
void DIRECT_API direct_clock_set_start( const struct timeval *start );
#endif
#endif

View File

@ -0,0 +1,64 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__COMPILER_H__
#define __DIRECT__COMPILER_H__
#include <direct/build.h>
#include <direct/types.h>
/**********************************************************************************************************************/
#if __GNUC__ >= 3
#define D_CONST_FUNC __attribute__((const))
#define D_FORMAT_PRINTF(n) __attribute__((__format__ (__printf__, n, n+1)))
#define D_FORMAT_VPRINTF(n) __attribute__((__format__ (__printf__, n, 0)))
#else
#define D_CONST_FUNC
#define D_FORMAT_PRINTF(n)
#define D_FORMAT_VPRINTF(n)
#endif
#define D_LIKELY(x) __builtin_expect(!!(x), 1)
#define D_UNLIKELY(x) __builtin_expect(!!(x), 0)
// TODO: add macro for enforcement of return value/error handling
#endif

View File

@ -0,0 +1,148 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__CONF_H__
#define __DIRECT__CONF_H__
#include <direct/log_domain.h>
typedef enum {
DCFL_NONE, /* None is fatal. */
DCFL_ASSERT, /* ASSERT is fatal. */
DCFL_ASSUME /* ASSERT and ASSUME are fatal. */
} DirectConfigFatalLevel;
typedef enum {
DCTS_OTHER,
DCTS_FIFO,
DCTS_RR
} DirectConfigThreadScheduler;
typedef enum {
DMT_NONE = 0x00000000, /* No message type. */
DMT_BANNER = 0x00000001, /* Startup banner. */
DMT_INFO = 0x00000002, /* Info messages. */
DMT_WARNING = 0x00000004, /* Warnings. */
DMT_ERROR = 0x00000008, /* Error messages: regular, with DFBResult, bugs,
system call errors, dlopen errors */
DMT_UNIMPLEMENTED = 0x00000010, /* Messages notifying unimplemented functionality. */
DMT_ONCE = 0x00000020, /* One-shot messages .*/
DMT_UNTESTED = 0x00000040, /* Messages notifying unimplemented functionality. */
DMT_BUG = 0x00000080, /* A bug occurred. */
DMT_ALL = 0x000000FF /* All types. */
} DirectMessageType;
struct __D_DirectConfig {
DirectMessageType quiet;
DirectLogLevel log_level;
bool log_all;
bool log_none;
bool trace;
char *memcpy; /* Don't probe for memcpy routines to save a lot of
startup time. Use this one instead if it's set. */
char **disable_module; /* Never load these modules. */
char *module_dir; /* module dir override */
bool sighandler;
sigset_t dont_catch; /* don't catch these signals */
DirectLog *log;
DirectConfigFatalLevel fatal;
// @deprecated / FIXME: maybe adapt?
bool debug;
bool debugmem;
bool thread_block_signals;
bool fatal_break; /* Should D_BREAK() cause a trap? */
int thread_priority;
DirectConfigThreadScheduler thread_scheduler;
int thread_stack_size;
int thread_priority_scale;
char **default_interface_implementation_types;
char **default_interface_implementation_names;
unsigned int perf_dump_interval;
int log_delay_rand_loops;
int log_delay_rand_us;
int log_delay_min_loops;
int log_delay_min_us;
DirectMessageType fatal_messages;
bool nm_for_trace;
int delay_trap_ms;
bool sighandler_thread;
};
extern DirectConfig DIRECT_API *direct_config;
extern const char DIRECT_API *direct_config_usage;
DirectResult DIRECT_API direct_config_set( const char *name, const char *value );
/* Retrieve all values set on option 'name'. */
/* Pass an array of char* pointers and number of pointers in 'num'. */
/* The actual returned number of values gets returned in 'ret_num' */
/* The returned option/values respect directfbrc, cmdline options and DFBARGS envvar. */
/* The returned pointers are not extra allocated so do not free them! */
DirectResult DIRECT_API direct_config_get( const char *name, char **values, const int values_len, int *ret_num );
/* Return the integer value for the last occurrance of the passed option's setting. */
/* Note that 0 is also retuned in case the passed option was not found ot set. */
long long DIRECT_API direct_config_get_int_value( const char *name );
long long DIRECT_API direct_config_get_int_value_with_default( const char *name,
long long def );
void __D_conf_init( void );
void __D_conf_deinit( void );
#endif

View File

@ -0,0 +1,419 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__DEBUG_H__
#define __DIRECT__DEBUG_H__
#include <direct/build.h>
#include <direct/clock.h>
#include <direct/conf.h>
#include <direct/log.h>
#include <direct/messages.h>
#include <direct/system.h>
#include <direct/thread.h>
#include <direct/trace.h>
#include <direct/types.h>
// @deprecated
#define D_DEBUG_DOMAIN( _identifier, _name, _description ) \
D_LOG_DOMAIN( _identifier, _name, _description )
#ifndef DIRECT_DISABLE_DEPRECATED
// @deprecated
D_DEBUG_DOMAIN( _direct_debug_deprecated, "-", "deprecated" );
// @deprecated
#define D_DEBUG( ... ) \
D_DEBUG_AT( _direct_debug_deprecated, __VA_ARGS__ )
#endif
static __inline__ void
direct_debug_config_domain( const char *name, bool enable )
{
direct_log_domain_config_level( name, enable ? DIRECT_LOG_ALL : DIRECT_LOG_NONE );
}
#if DIRECT_BUILD_TEXT
void DIRECT_API direct_debug_at_always( DirectLogDomain *domain,
const char *format, ... ) D_FORMAT_PRINTF(2);
#define d_debug_at( domain, ... ) direct_debug_at_always( &domain, __VA_ARGS__ )
#if DIRECT_BUILD_DEBUGS
/*
* Direct v2.0 - Debug Interface
*
* debug level 1-9 (0 = verbose)
*
*/
void DIRECT_API direct_debug_log( DirectLogDomain *domain,
unsigned int debug_level,
const char *format, ... ) D_FORMAT_PRINTF(3);
/* old */
void DIRECT_API direct_debug_at( DirectLogDomain *domain,
const char *format, ... ) D_FORMAT_PRINTF(2);
void DIRECT_API direct_debug_enter( DirectLogDomain *domain,
const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(5);
void DIRECT_API direct_debug_exit( DirectLogDomain *domain,
const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(5);
void DIRECT_API direct_break( const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(4);
void DIRECT_API direct_assertion( const char *exp,
const char *func,
const char *file,
int line );
void DIRECT_API direct_assumption( const char *exp,
const char *func,
const char *file,
int line );
#endif
#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
#define D_DEBUG_ENABLED (1)
#define D_DEBUG_LOG(_Domain,_level,...) \
do { \
direct_debug_log( &_Domain, _level, __VA_ARGS__ ); \
} while (0)
// TODO: OPT: check domain etc here to avoid probably expensive parameter generation
#define D_DEBUG_AT(d,...) \
do { \
direct_debug_at( &d, __VA_ARGS__ ); \
} while (0)
#define D_DEBUG_ENTER(d,...) \
do { \
/*direct_debug_enter( &d, __FUNCTION__, __FILE__, __LINE__, x );*/ \
} while (0)
#define D_DEBUG_EXIT(d,...) \
do { \
/*direct_debug_exit( &d, __FUNCTION__, __FILE__, __LINE__, x );*/ \
} while (0)
#define D_ASSERT(exp) \
do { \
if (!(exp)) \
direct_assertion( #exp, __FUNCTION__, __FILE__, __LINE__ ); \
} while (0)
#define D_ASSUME(exp) \
do { \
if (!(exp)) \
direct_assumption( #exp, __FUNCTION__, __FILE__, __LINE__ ); \
} while (0)
#define D_BREAK(...) \
do { \
direct_break( __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
#define D_DEBUG_CHECK(d) \
direct_log_domain_check( &d )
#elif defined(DIRECT_MINI_DEBUG)
/*
* Mini debug mode, only D_DEBUG_AT, no domain filters, simple assertion
*/
#define D_DEBUG_ENABLED (2)
#define D_DEBUG_LOG(_Domain,_level,...) \
do { \
if (direct_config->log_level >= DIRECT_LOG_DEBUG) \
direct_debug_at_always( &d, __VA_ARGS__ ); \
} while (0)
#define D_DEBUG_AT(d,...) \
do { \
if (direct_config->log_level >= DIRECT_LOG_DEBUG) \
direct_debug_at_always( &d, __VA_ARGS__ ); \
} while (0)
#define D_CHECK(exp, aa) \
do { \
if (!(exp)) { \
long long millis = direct_clock_get_millis(); \
const char *name = direct_thread_self_name(); \
\
direct_log_printf( NULL, \
"(!) [%-15s %3lld.%03lld] (%5d) *** " #aa " [%s] failed *** [%s:%d in %s()]\n", \
name ? name : " NO NAME ", millis / 1000LL, millis % 1000LL, \
direct_gettid(), #exp, __FILE__, __LINE__, __FUNCTION__ ); \
\
direct_trace_print_stack( NULL ); \
} \
} while (0)
#define D_ASSERT(exp) D_CHECK(exp, Assertion)
#define D_ASSUME(exp) D_CHECK(exp, Assumption)
#define D_DEBUG_CHECK(d) \
direct_config->debug
#endif /* MINI_DEBUG / DIRECT_BUILD_DEBUG || DIRECT_ENABLE_DEBUG || DIRECT_FORCE_DEBUG */
#define D_DEBUG_AT__(d,...) \
do { \
direct_log_printf( NULL, __VA_ARGS__ ); \
} while (0)
#endif /* DIRECT_BUILD_TEXT */
/*
* Fallback definitions, e.g. without DIRECT_BUILD_TEXT or DIRECT_ENABLE_DEBUG
*/
#ifndef D_DEBUG_ENABLED
#define D_DEBUG_ENABLED (0)
#endif
#ifndef D_DEBUG_LOG
#define D_DEBUG_LOG(_Domain,_level,...) \
do { \
} while (0)
#endif
#ifndef D_DEBUG
#define D_DEBUG(d,...) do {} while (0)
#endif
#ifndef D_DEBUG_AT
#define D_DEBUG_AT(d,...) do {} while (0)
#endif
#ifndef D_DEBUG_ENTER
#define D_DEBUG_ENTER(d,...) do {} while (0)
#endif
#ifndef D_DEBUG_EXIT
#define D_DEBUG_EXIT(d,...) do {} while (0)
#endif
#ifndef D_ASSERT
#define D_ASSERT(exp) do {} while (0)
#endif
#ifndef D_ASSUME
#define D_ASSUME(exp) do {} while (0)
#endif
#ifndef D_DEBUG_AT__
#define D_DEBUG_AT__(d,...) do {} while (0)
#endif
#ifndef D_DEBUG_CHECK
#define D_DEBUG_CHECK(d) false
#endif
#ifndef D_BREAK
#define D_BREAK(...) do {} while (0)
#endif
#ifndef d_debug_at
#define d_debug_at( domain, ... ) do {} while (0)
#endif
#ifndef D_LOG_DOMAIN
#define D_LOG_DOMAIN(i,n,d)
#endif
/*
* Magic Assertions & Utilities
*/
#define D_MAGIC(spell) ( (((spell)[sizeof(spell)*8/9] << 24) | \
((spell)[sizeof(spell)*7/9] << 16) | \
((spell)[sizeof(spell)*6/9] << 8) | \
((spell)[sizeof(spell)*5/9] )) ^ \
(((spell)[sizeof(spell)*4/9] << 24) | \
((spell)[sizeof(spell)*3/9] << 16) | \
((spell)[sizeof(spell)*2/9] << 8) | \
((spell)[sizeof(spell)*1/9] )) )
#define D_MAGIC_PRINT(m) do { \
D_INFO( "Magic '%s' = '%d'\n", #m, D_MAGIC(#m) ); \
} while (0)
#if DIRECT_BUILD_DEBUGS
#define D_MAGIC_CHECK(o,m) ((o) != NULL && (o)->magic == D_MAGIC(#m))
#define D_MAGIC_SET(o,m) do { \
D_ASSERT( (o) != NULL ); \
D_ASSUME( (o)->magic != D_MAGIC(#m) ); \
\
(o)->magic = D_MAGIC(#m); \
} while (0)
#define D_MAGIC_SET_ONLY(o,m) do { \
D_ASSERT( (o) != NULL ); \
\
(o)->magic = D_MAGIC(#m); \
} while (0)
#define D_MAGIC_ASSERT(o,m) do { \
D_ASSERT( (o) != NULL ); \
D_ASSERT( (o)->magic == D_MAGIC(#m) ); \
} while (0)
#define D_MAGIC_ASSUME(o,m) do { \
D_ASSUME( (o) != NULL ); \
if (o) \
D_ASSUME( (o)->magic == D_MAGIC(#m) ); \
} while (0)
#define D_MAGIC_ASSERT_IF(o,m) do { \
if (o) \
D_ASSERT( (o)->magic == D_MAGIC(#m) ); \
} while (0)
#define D_MAGIC_CLEAR(o) do { \
D_ASSERT( (o) != NULL ); \
D_ASSUME( (o)->magic != 0 ); \
\
(o)->magic = 0; \
} while (0)
#define D_INDEX_ASSERT(index,array) \
do { \
D_ASSERT( index >= 0 ); \
D_ASSERT( index < D_ARRAY_SIZE(array) ); \
} while (0)
#else
#define D_MAGIC_CHECK(o,m) ((o) != NULL)
#define D_MAGIC_SET(o,m) do { \
} while (0)
#define D_MAGIC_SET_ONLY(o,m) do { \
} while (0)
#define D_MAGIC_ASSERT(o,m) do { \
} while (0)
#define D_MAGIC_ASSUME(o,m) do { \
} while (0)
#define D_MAGIC_ASSERT_IF(o,m) do { \
} while (0)
#define D_MAGIC_CLEAR(o) do { \
} while (0)
#define D_INDEX_ASSERT(index,array) \
do { \
} while (0)
#endif
#define D_FLAGS_ASSERT(flags,f) D_ASSERT( D_FLAGS_ARE_IN(flags,f) )
#if D_DEBUG_ENABLED
#define D_INFO_LINE() \
do { \
long long micros = direct_clock_get_micros(); \
int indent = direct_trace_debug_indent() * 2; \
\
D_INFO( "[%-16.16s %3lld.%03lld,%03lld] (%5d) %*s%*s %s:%d\n", \
direct_thread_self_name()?:"NO NAME", \
micros / 1000000LL, (micros / 1000LL) % 1000LL, micros % 1000LL, direct_gettid(), \
indent, "", indent-60, __FUNCTION__, __FILE__, __LINE__ ); \
} while (0)
#define D_INFO_LINE_MSG(...) \
do { \
long long micros = direct_clock_get_micros(); \
int indent = direct_trace_debug_indent() * 2; \
char _buf[200]; \
\
direct_snprintf( _buf, sizeof(_buf), __VA_ARGS__ ); \
\
D_INFO( "[%-16.16s %3lld.%03lld,%03lld] (%5d) %*s%*s '%-40s' %s:%d\n", \
direct_thread_self_name()?:"NO NAME", \
micros / 1000000LL, (micros / 1000LL) % 1000LL, micros % 1000LL, direct_gettid(), \
indent, "", indent-60, __FUNCTION__, _buf, __FILE__, __LINE__ ); \
} while (0)
#else
#define D_INFO_LINE() \
do { \
} while (0)
#define D_INFO_LINE_MSG(...) \
do { \
} while (0)
#endif
#endif

View File

@ -0,0 +1,57 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__DIRECT_H__
#define __DIRECT__DIRECT_H__
#include <direct/types.h>
DirectResult DIRECT_API direct_initialize( void );
DirectResult DIRECT_API direct_shutdown( void );
typedef void (*DirectCleanupHandlerFunc)( void *ctx );
DirectResult DIRECT_API direct_cleanup_handler_add( DirectCleanupHandlerFunc func,
void *ctx,
DirectCleanupHandler **ret_handler );
DirectResult DIRECT_API direct_cleanup_handler_remove( DirectCleanupHandler *handler );
void __D_direct_init( void );
void __D_direct_deinit( void );
#endif

View File

@ -0,0 +1,56 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__FASTLZ_H__
#define __DIRECT__FASTLZ_H__
#include <direct/types.h>
/**********************************************************************************************************************/
int DIRECT_API direct_fastlz_compress ( const void *input,
int length,
void *output );
int DIRECT_API direct_fastlz_decompress ( const void *input,
int length,
void *output,
int maxout );
int DIRECT_API direct_fastlz_compress_multi( const void **inputs,
int *lengths,
unsigned int num,
void *output );
#endif

View File

@ -0,0 +1,77 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__FIFO_H__
#define __DIRECT__FIFO_H__
#include <direct/debug.h>
#include <direct/list.h>
struct __D_DirectFifoItem {
DirectLink link;
int magic;
};
struct __D_DirectFifo {
int magic;
DirectMutex lock;
DirectWaitQueue wq;
DirectLink *items;
int waiting;
bool wake;
};
/**********************************************************************************************************************/
void DIRECT_API direct_fifo_init ( DirectFifo *fifo );
void DIRECT_API direct_fifo_destroy( DirectFifo *fifo );
/**********************************************************************************************************************/
int DIRECT_API direct_fifo_push( DirectFifo *fifo, DirectFifoItem *item );
void DIRECT_API *direct_fifo_pull( DirectFifo *fifo );
void DIRECT_API *direct_fifo_pop ( DirectFifo *fifo );
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_fifo_wait ( DirectFifo *fifo );
DirectResult DIRECT_API direct_fifo_wait_timed( DirectFifo *fifo, int timeout_ms );
DirectResult DIRECT_API direct_fifo_wakeup ( DirectFifo *fifo );
#endif

View File

@ -0,0 +1,44 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__FILESYSTEM_H__
#define __DIRECT__FILESYSTEM_H__
#include <direct/types.h>
#include <direct/os/filesystem.h>
/**********************************************************************************************************************/
#endif

View File

@ -0,0 +1,100 @@
/*
FastLZ - lightning-fast lossless compression library
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef FASTLZ_H
#define FASTLZ_H
#define FASTLZ_VERSION 0x000100
#define FASTLZ_VERSION_MAJOR 0
#define FASTLZ_VERSION_MINOR 0
#define FASTLZ_VERSION_REVISION 0
#define FASTLZ_VERSION_STRING "0.1.0"
#if defined (__cplusplus)
extern "C" {
#endif
/**
Compress a block of data in the input buffer and returns the size of
compressed block. The size of input buffer is specified by length. The
minimum input buffer size is 16.
The output buffer must be at least 5% larger than the input buffer
and can not be smaller than 66 bytes.
If the input is not compressible, the return value might be larger than
length (input buffer size).
The input buffer and the output buffer can not overlap.
*/
int fastlz_compress(const void* input, int length, void* output);
/**
Decompress a block of compressed data and returns the size of the
decompressed block. If error occurs, e.g. the compressed data is
corrupted or the output buffer is not large enough, then 0 (zero)
will be returned instead.
The input buffer and the output buffer can not overlap.
Decompression is memory safe and guaranteed not to write the output buffer
more than what is specified in maxout.
*/
int fastlz_decompress(const void* input, int length, void* output, int maxout);
/**
Compress a block of data in the input buffer and returns the size of
compressed block. The size of input buffer is specified by length. The
minimum input buffer size is 16.
The output buffer must be at least 5% larger than the input buffer
and can not be smaller than 66 bytes.
If the input is not compressible, the return value might be larger than
length (input buffer size).
The input buffer and the output buffer can not overlap.
Compression level can be specified in parameter level. At the moment,
only level 1 and level 2 are supported.
Level 1 is the fastest compression and generally useful for short data.
Level 2 is slightly slower but it gives better compression ratio.
Note that the compressed data, regardless of the level, can always be
decompressed using the function fastlz_decompress above.
*/
int fastlz_compress_level(int level, const void* input, int length, void* output);
#if defined (__cplusplus)
}
#endif
#endif /* FASTLZ_H */

View File

@ -0,0 +1,133 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__HASH_H__
#define __DIRECT__HASH_H__
#include <direct/types.h>
/**********************************************************************************************************************/
typedef struct {
unsigned long key;
void *value;
} DirectHashElement;
#define DIRECT_HASH_ELEMENT_REMOVED ((void *) -1)
struct __D_DirectHash {
int magic;
int size;
int count;
int removed;
DirectHashElement *Elements;
bool disable_debugging_alloc;
};
/**********************************************************************************************************************/
#define DIRECT_HASH_INIT( __size, __disable_debugging_alloc ) \
{ \
0x0b161321, \
(__size < 17 ? 17 : __size), \
0, \
0, \
NULL, \
__disable_debugging_alloc \
}
/* Hmm, not constant? .magic = D_MAGIC( "DirectHash" ), */
/**********************************************************************************************************************/
#define DIRECT_HASH_ASSERT( hash ) \
do { \
D_MAGIC_ASSERT( hash, DirectHash ); \
D_ASSERT( (hash)->size > 0 ); \
D_ASSERT( (hash)->Elements != NULL || (hash)->count == 0 ); \
D_ASSERT( (hash)->Elements != NULL || (hash)->removed == 0 ); \
D_ASSERT( (hash)->count + (hash)->removed < (hash)->size ); \
} while (0)
/**********************************************************************************************************************/
/*
* Hash iteration callback, return false to abort iteration.
*/
typedef bool (*DirectHashIteratorFunc)( DirectHash *hash,
unsigned long key,
void *value,
void *ctx );
/***********************************************************************************************************************
** Full create including allocation ...
*/
DirectResult DIRECT_API direct_hash_create ( int size,
DirectHash **ret_hash );
void DIRECT_API direct_hash_destroy( DirectHash *hash );
/***********************************************************************************************************************
** ... or just initialization of static data...
*/
void DIRECT_API direct_hash_init ( DirectHash *hash,
int size );
void DIRECT_API direct_hash_deinit ( DirectHash *hash );
/**********************************************************************************************************************/
int DIRECT_API direct_hash_count ( DirectHash *hash );
DirectResult DIRECT_API direct_hash_insert ( DirectHash *hash,
unsigned long key,
void *value );
DirectResult DIRECT_API direct_hash_remove ( DirectHash *hash,
unsigned long key );
void DIRECT_API *direct_hash_lookup ( const DirectHash *hash,
unsigned long key );
void DIRECT_API direct_hash_iterate( DirectHash *hash,
DirectHashIteratorFunc func,
void *ctx );
#endif

View File

@ -0,0 +1,44 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__INIT_H__
#define __DIRECT__INIT_H__
#include <direct/types.h>
__constructor__ void __D_init_all ( void );
__destructor__ void __D_deinit_all( void );
#endif

View File

@ -0,0 +1,245 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__INTERFACE_H__
#define __DIRECT__INTERFACE_H__
#include <direct/debug.h>
#include <direct/mem.h>
/*
* Forward declaration macro for interfaces.
*/
#define D_DECLARE_INTERFACE( IFACE ) \
typedef struct _ ## IFACE IFACE;
/*
* Macro for an interface definition.
*/
#define D_DEFINE_INTERFACE( IFACE, ... ) \
struct _ ## IFACE { \
void *priv; \
int magic; \
int refs; \
\
DirectResult (*AddRef)( IFACE *thiz ); \
DirectResult (*Release)( IFACE *thiz ); \
\
__VA_ARGS__ \
};
#ifndef DIRECT_DISABLE_DEPRECATED
// @deprecated
#define DECLARE_INTERFACE D_DECLARE_INTERFACE
// @deprecated
#define DEFINE_INTERFACE D_DEFINE_INTERFACE
#endif
/*
* Declare base interface
*/
D_DECLARE_INTERFACE( IAny )
/*
* Define base interface
*/
D_DEFINE_INTERFACE( IAny, )
/*
* Function type for probing of interface implementations
*/
typedef DirectResult (*DirectInterfaceGenericProbeFunc)( void *ctx, ... );
/*
* Function type for initialization of interface instances
*/
typedef DirectResult (*DirectInterfaceGenericConstructFunc)( void *interface_ptr, ... );
/*
* Function table for interface implementations
*/
typedef struct {
const char * (*GetType)(void);
const char * (*GetImplementation)(void);
DirectResult (*Allocate)( void **interface_ptr );
DirectResult (*Deallocate)( void *interface_ptr );
DirectInterfaceGenericProbeFunc Probe;
DirectInterfaceGenericConstructFunc Construct;
} DirectInterfaceFuncs;
/*
* Callback type for user probing interface implementations
*/
typedef DirectResult (*DirectInterfaceProbeFunc)( DirectInterfaceFuncs *impl, void *ctx );
/*
* Loads an interface of a specific 'type'.
* Optionally an 'implementation' can be chosen.
* A 'probe' function can be used to check available implementations.
*
* After success 'funcs' is set.
*/
DirectResult DIRECT_API DirectGetInterface( DirectInterfaceFuncs **funcs,
const char *type,
const char *implementation,
DirectInterfaceProbeFunc probe,
void *probe_ctx );
/*
* Default probe function. Calls "funcs->Probe(ctx)".
* Can be used as the 'probe' argument to DirectGetInterface.
* 'probe_ctx' should then be set to the interface specific probe context.
*/
DirectResult DIRECT_API DirectProbeInterface( DirectInterfaceFuncs *funcs, void *ctx );
/*
* Called by implementation modules during 'dlopen'ing or at startup if linked
* into the executable.
*/
void DIRECT_API DirectRegisterInterface( DirectInterfaceFuncs *funcs );
void DIRECT_API DirectUnregisterInterface( DirectInterfaceFuncs *funcs );
void DIRECT_API direct_print_interface_leaks(void);
#if DIRECT_BUILD_DEBUGS
void DIRECT_API direct_dbg_interface_add ( const char *func,
const char *file,
int line,
const char *what,
const void *interface_ptr,
const char *name );
void DIRECT_API direct_dbg_interface_remove( const char *func,
const char *file,
int line,
const char *what,
const void *interface_ptr );
#endif
#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG)
#if !DIRECT_BUILD_DEBUGS
#error Building with debug, but library headers suggest that debug is not supported.
#endif
#define DIRECT_DBG_INTERFACE_ADD direct_dbg_interface_add
#define DIRECT_DBG_INTERFACE_REMOVE direct_dbg_interface_remove
#else
#define DIRECT_DBG_INTERFACE_ADD(func,file,line,what,interface,name) do {} while (0)
#define DIRECT_DBG_INTERFACE_REMOVE(func,file,line,what,interface) do {} while (0)
#endif
#define DIRECT_ALLOCATE_INTERFACE(p,i) \
do { \
(p) = (__typeof__(p))D_CALLOC( 1, sizeof(i) ); \
if (p) { \
D_MAGIC_SET( (IAny*)(p), DirectInterface ); \
\
DIRECT_DBG_INTERFACE_ADD( __FUNCTION__, __FILE__, __LINE__, #p, p, #i ); \
} \
else \
D_OOM(); \
} while (0)
#define DIRECT_ALLOCATE_INTERFACE_DATA(p,i) \
i##_data *data; \
\
D_MAGIC_ASSERT( (IAny*)(p), DirectInterface ); \
\
if (!(p)->priv) \
(p)->priv = D_CALLOC( 1, sizeof(i##_data) ); \
\
data = (i##_data*)((p)->priv);
#define DIRECT_DEALLOCATE_INTERFACE(p) \
D_MAGIC_ASSERT( (IAny*)(p), DirectInterface ); \
\
DIRECT_DBG_INTERFACE_REMOVE( __FUNCTION__, __FILE__, __LINE__, #p, p ); \
\
if ((p)->priv) { \
D_FREE( (p)->priv ); \
(p)->priv = NULL; \
} \
\
D_MAGIC_CLEAR( (IAny*)(p) ); \
\
D_FREE( (p) );
#define DIRECT_INTERFACE_GET_DATA(i) \
i##_data *data; \
\
if (!thiz) \
return DR_THIZNULL; \
\
D_MAGIC_ASSERT( (IAny*)thiz, DirectInterface ); \
\
data = (i##_data*) thiz->priv; \
\
if (!data) \
return DR_DEAD;
#define DIRECT_INTERFACE_GET_DATA_FROM(interface,data,prefix) \
do { \
D_MAGIC_ASSERT( (IAny*)(interface), DirectInterface ); \
\
(data) = (prefix##_data*) (interface)->priv; \
\
if (!(data)) \
return DR_DEAD; \
} while (0)
void __D_interface_init( void );
void __D_interface_deinit( void );
void __D_interface_dbg_init( void );
void __D_interface_dbg_deinit( void );
#endif

View File

@ -0,0 +1,100 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__INTERFACE_IMPLEMENTATION_H__
#define __DIRECT__INTERFACE_IMPLEMENTATION_H__
#include <direct/interface.h>
static const char *GetType( void );
static const char *GetImplementation( void );
static DirectResult Allocate( void **ret_interface );
static DirectResult Deallocate( void *interface_ptr );
//static DirectResult Probe( void *ctx, ... );
//static DirectResult Construct( void *interface, ... );
static DirectInterfaceFuncs interface_funcs = {
/* GetType */ GetType,
/* GetImplementation */ GetImplementation,
/* Allocate */ Allocate,
/* Deallocate */ Deallocate,
/* Probe */ (void*) Probe, //FIXME
/* Construct */ (void*) Construct //FIXME
};
#define DIRECT_INTERFACE_IMPLEMENTATION(type, impl) \
\
__constructor__ void type##_##impl##_ctor( void ); \
__destructor__ void type##_##impl##_dtor( void ); \
\
static const char * \
GetType( void ) \
{ \
return #type; \
} \
\
static const char * \
GetImplementation( void ) \
{ \
return #impl; \
} \
\
static DirectResult \
Allocate( void **ret_interface ) \
{ \
DIRECT_ALLOCATE_INTERFACE( *ret_interface, type ); \
return DR_OK; \
} \
\
static DirectResult \
Deallocate( void *interface_ptr ) \
{ \
DIRECT_DEALLOCATE_INTERFACE( (IAny*) (interface_ptr) ); \
return DR_OK; \
} \
\
void \
type##_##impl##_ctor( void ) \
{ \
DirectRegisterInterface( &interface_funcs ); \
} \
\
void \
type##_##impl##_dtor( void ) \
{ \
DirectUnregisterInterface( &interface_funcs ); \
}
#endif

View File

@ -0,0 +1,305 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__LIST_H__
#define __DIRECT__LIST_H__
#include <direct/debug.h>
#include <direct/thread.h>
struct __D_DirectLink {
int magic;
DirectLink *next;
DirectLink *prev; /* The 'prev' pointer of the first element always points
to the last element of the list, for fast appending ;-) */
};
static __inline__ void
direct_list_prepend( DirectLink **list, DirectLink *link )
{
DirectLink *first;
D_ASSERT( list != NULL );
D_ASSERT( link != NULL );
first = *list;
link->next = first;
if (first) {
D_MAGIC_ASSERT( first, DirectLink );
link->prev = first->prev;
first->prev = link;
}
else
link->prev = link;
*list = link;
D_MAGIC_SET( link, DirectLink );
}
static __inline__ void
direct_list_append( DirectLink **list, DirectLink *link )
{
DirectLink *first;
D_ASSERT( list != NULL );
D_ASSERT( link != NULL );
first = *list;
link->next = NULL;
if (first) {
DirectLink *last = first->prev;
D_MAGIC_ASSERT( first, DirectLink );
D_MAGIC_ASSERT( last, DirectLink );
link->prev = last;
last->next = first->prev = link;
}
else
*list = link->prev = link;
D_MAGIC_SET( link, DirectLink );
}
static __inline__ void
direct_list_insert( DirectLink **list, DirectLink *link, DirectLink *before )
{
DirectLink *first;
D_ASSERT( list != NULL );
D_ASSERT( link != NULL );
first = *list;
D_MAGIC_ASSERT_IF( first, DirectLink );
D_MAGIC_ASSERT_IF( before, DirectLink );
if (first == before) {
direct_list_prepend( list, link );
}
else if (first == NULL || before == NULL) {
direct_list_append( list, link );
}
else {
DirectLink *prev = before->prev;
D_MAGIC_ASSERT( prev, DirectLink );
prev->next = link;
link->prev = prev;
link->next = before;
before->prev = link;
D_MAGIC_SET( link, DirectLink );
}
}
static __inline__ bool
direct_list_contains_element_EXPENSIVE( DirectLink *list, DirectLink *link )
{
D_MAGIC_ASSERT_IF( list, DirectLink );
while (list) {
if (list == link)
return true;
list = list->next;
}
return false;
}
static __inline__ int
direct_list_count_elements_EXPENSIVE( DirectLink *list )
{
int count = 0;
while (list) {
D_MAGIC_ASSERT( list, DirectLink );
count++;
list = list->next;
}
return count;
}
static __inline__ bool
direct_list_remove( DirectLink **list, DirectLink *link )
{
DirectLink *next;
DirectLink *prev;
D_ASSERT( list != NULL );
D_ASSERT( direct_list_contains_element_EXPENSIVE( *list, link ) );
D_MAGIC_ASSERT( *list, DirectLink );
D_MAGIC_ASSERT( link, DirectLink );
next = link->next;
prev = link->prev;
if (next) {
D_MAGIC_ASSERT( next, DirectLink );
next->prev = prev;
}
else
(*list)->prev = prev;
if (link == *list)
*list = next;
else {
D_MAGIC_ASSERT( prev, DirectLink );
prev->next = next;
}
link->next = link->prev = NULL;
D_MAGIC_CLEAR( link );
return true;
}
static __inline__ void
direct_list_move_to_front( DirectLink **list, DirectLink *link )
{
DirectLink *next;
DirectLink *prev;
DirectLink *first;
D_ASSERT( list != NULL );
first = *list;
D_ASSERT( direct_list_contains_element_EXPENSIVE( first, link ) );
D_MAGIC_ASSERT( first, DirectLink );
D_MAGIC_ASSERT( link, DirectLink );
if (first == link)
return;
next = link->next;
prev = link->prev;
D_MAGIC_ASSERT_IF( next, DirectLink );
D_MAGIC_ASSERT( prev, DirectLink );
if (next) {
next->prev = prev;
link->prev = first->prev;
}
else
link->prev = prev;
prev->next = next;
link->next = first;
first->prev = link;
*list = link;
}
static __inline__ void*
direct_list_get_last( DirectLink *list )
{
D_MAGIC_ASSERT_IF( list, DirectLink );
if (list) {
D_MAGIC_ASSERT( list->prev, DirectLink );
return list->prev;
}
return NULL;
}
#ifdef __GNUC__
#define direct_list_check_link( link ) \
({ \
D_MAGIC_ASSERT_IF( link, DirectLink ); \
link != NULL; \
})
#else
#define direct_list_check_link( link ) \
(link != NULL)
#endif
#define direct_list_foreach(elem, list) \
for (elem = (__typeof__(elem))(list); \
direct_list_check_link( (DirectLink*)(elem) ); \
elem = (__typeof__(elem))(((DirectLink*)(elem))->next))
#define direct_list_foreach_via(elem, list, _link) \
for (elem = (list) ? (__typeof__(elem)) ((void*)(list) - (long)(&((__typeof__(elem)) NULL)->_link)) : NULL; \
direct_list_check_link( (elem) ? &(elem)->_link : NULL ); \
elem = ((elem)->_link.next) ? (__typeof__(elem)) ((void*)((elem)->_link.next) - (long)(&((__typeof__(elem)) NULL)->_link)) : NULL )
#define direct_list_foreach_via_safe(elem, temp, list, _link) \
for (elem = (list) ? (__typeof__(elem)) ((void*)(list) - (long)(&((__typeof__(elem)) NULL)->_link)) : NULL, temp = ((elem) ? (((elem)->_link.next) ? (__typeof__(elem)) ((void*)((elem)->_link.next) - (long)(&((__typeof__(elem)) NULL)->_link)) : NULL) : NULL); \
direct_list_check_link( (elem) ? &(elem)->_link : NULL ); \
elem = (__typeof__(elem))(temp), temp = ((elem) ? (((elem)->_link.next) ? (__typeof__(elem)) ((void*)((elem)->_link.next) - (long)(&((__typeof__(elem)) NULL)->_link)) : NULL) : NULL) )
#define direct_list_foreach_reverse(elem, list) \
for (elem = (__typeof__(elem))((list) ? (list)->prev : NULL); \
direct_list_check_link( (DirectLink*)(elem) ); \
elem = (__typeof__(elem))((((DirectLink*)(elem))->prev->next) ? ((DirectLink*)(elem))->prev : NULL))
#define direct_list_foreach_safe(elem, temp, list) \
for (elem = (__typeof__(elem))(list), temp = ((__typeof__(temp))(elem) ? (__typeof__(temp))(((DirectLink*)(elem))->next) : NULL); \
direct_list_check_link( (DirectLink*)(elem) ); \
elem = (__typeof__(elem))(temp), temp = ((__typeof__(temp))(elem) ? (__typeof__(temp))(((DirectLink*)(elem))->next) : NULL))
#define direct_list_foreach_remove(elem, list) \
while ((elem = (__typeof__(elem))(list)) && direct_list_remove( &(list), (DirectLink*)(elem) ))
#endif

View File

@ -0,0 +1,118 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__LOG_H__
#define __DIRECT__LOG_H__
#include <direct/os/log.h>
#include <direct/messages.h>
/**********************************************************************************************************************/
/*
* Creates a logging facility.
*
* For each 'type' the 'param' has a different meaning:
* DLT_STDERR ignored (leave NULL)
* DLT_FILE file name
* DLT_UDP <ip>:<port>
*/
DirectResult DIRECT_API direct_log_create ( DirectLogType type,
const char *param,
DirectLog **ret_log );
/*
* Destroys a logging facility.
*/
DirectResult DIRECT_API direct_log_destroy ( DirectLog *log );
/*
* Write to the log in a printf fashion.
*
* If log is NULL, the default log is used if it's valid,
* otherwise stderr is used a fallback until now.
*/
DirectResult DIRECT_API direct_log_printf ( DirectLog *log,
const char *format, ... ) D_FORMAT_PRINTF(2);
/*
* Write to the log in a plain fashion.
*
* If log is NULL, the default log is used if it's valid,
* otherwise stderr is used a fallback until now.
*/
DirectResult DIRECT_API direct_log_write ( DirectLog *log,
const char *buffer,
size_t bytes );
/*
* Set the default log that's used when no valid log is passed.
*/
DirectResult DIRECT_API direct_log_set_default( DirectLog *log );
/*
* Locks a logging facility for non-intermixed output of multiple calls in multiple threads. Not mandatory.
*/
void DIRECT_API direct_log_lock ( DirectLog *log );
/*
* Unlocks a logging facility.
*/
void DIRECT_API direct_log_unlock ( DirectLog *log );
/*
* Set a buffer to be used for the log data.
*/
DirectResult DIRECT_API direct_log_set_buffer ( DirectLog *log,
char *buffer,
size_t bytes );
/*
* Flush the log data and optionally synchronize with the output.
*/
DirectResult DIRECT_API direct_log_flush ( DirectLog *log,
bool sync );
/*
* Returns the default log.
*/
DirectLog DIRECT_API *direct_log_default( void );
#define d_printf( ... ) direct_log_printf( NULL, __VA_ARGS__ )
void __D_log_init( void );
void __D_log_deinit( void );
#endif

View File

@ -0,0 +1,148 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__LOG_DOMAIN_H__
#define __DIRECT__LOG_DOMAIN_H__
#include <direct/compiler.h>
/**********************************************************************************************************************/
typedef enum {
DIRECT_LOG_NONE = 0x0,
DIRECT_LOG_FATAL = 0x1,
DIRECT_LOG_ERROR = 0x2,
DIRECT_LOG_WARNING = 0x3,
DIRECT_LOG_NOTICE = 0x4,
DIRECT_LOG_INFO = 0x5,
DIRECT_LOG_VERBOSE = 0x6,
DIRECT_LOG_DEBUG_0 = DIRECT_LOG_VERBOSE,
DIRECT_LOG_DEBUG_1 = 0x7,
DIRECT_LOG_DEBUG_2 = 0x8,
DIRECT_LOG_DEBUG_3 = 0x9,
DIRECT_LOG_DEBUG_4 = 0xA,
DIRECT_LOG_DEBUG_5 = 0xB,
DIRECT_LOG_DEBUG_6 = 0xC,
DIRECT_LOG_DEBUG_7 = 0xD,
DIRECT_LOG_DEBUG_8 = 0xE,
DIRECT_LOG_DEBUG_9 = 0xF,
DIRECT_LOG_ALL = 0x10,
DIRECT_LOG_DEBUG = DIRECT_LOG_DEBUG_8, /* default debug level */
_DIRECT_LOG_NUM_LEVELS
} DirectLogLevel;
typedef struct {
DirectLogLevel level;
DirectLog *log;
} DirectLogDomainConfig;
/**********************************************************************************************************************/
typedef struct {
const char *description;
const char *name;
int name_len;
unsigned int age;
bool registered;
DirectLogDomainConfig config;
} DirectLogDomain;
/**********************************************************************************************************************/
#define D_LOG_DOMAIN( _identifier, _name, _description ) \
static DirectLogDomain _identifier D_UNUSED = { \
_description, _name, sizeof(_name) - 1, 0, false, {DIRECT_LOG_NONE,0} \
}
/**********************************************************************************************************************/
void DIRECT_API direct_log_domain_configure( const char *name,
const DirectLogDomainConfig *config );
DirectResult DIRECT_API direct_log_domain_vprintf( DirectLogDomain *domain,
DirectLogLevel level,
const char *format,
va_list ap ) D_FORMAT_VPRINTF(3);
DirectResult DIRECT_API direct_log_domain_log( DirectLogDomain *domain,
DirectLogLevel level,
const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(6);
/**********************************************************************************************************************/
static __inline__ void
direct_log_domain_config_level( const char *name,
DirectLogLevel level )
{
DirectLogDomainConfig config;
config.level = level;
config.log = NULL;
direct_log_domain_configure( name, &config );
}
bool DIRECT_API direct_log_domain_check( DirectLogDomain *domain ); // TODO: for non-debug builds use macro for better optimisations
bool DIRECT_API direct_log_domain_check_level( DirectLogDomain *domain,
DirectLogLevel level );
/**********************************************************************************************************************/
#define D_LOG( _Domain, _LEVEL, ... ) \
do { \
direct_log_domain_log( &(_Domain), DIRECT_LOG_ ## _LEVEL, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
#define D_LOG_( _Domain, _level, ... ) \
do { \
direct_log_domain_log( &(_Domain), _level, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
void __D_log_domain_init( void );
void __D_log_domain_deinit( void );
#endif

View File

@ -0,0 +1,76 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MAP_H__
#define __DIRECT__MAP_H__
#include <direct/types.h>
typedef bool (*DirectMapCompareFunc) ( DirectMap *map,
const void *key,
void *object,
void *ctx );
typedef unsigned int (*DirectMapHashFunc) ( DirectMap *map,
const void *key,
void *ctx );
typedef DirectEnumerationResult (*DirectMapIteratorFunc)( DirectMap *map,
void *object,
void *ctx );
DirectResult DIRECT_API direct_map_create ( unsigned int initial_size,
DirectMapCompareFunc compare_func,
DirectMapHashFunc hash_func,
void *ctx,
DirectMap **ret_map );
void DIRECT_API direct_map_destroy( DirectMap *map );
DirectResult DIRECT_API direct_map_insert ( DirectMap *map,
const void *key,
void *object );
DirectResult DIRECT_API direct_map_remove ( DirectMap *map,
const void *key );
void DIRECT_API *direct_map_lookup ( DirectMap *map,
const void *key );
void DIRECT_API direct_map_iterate( DirectMap *map,
DirectMapIteratorFunc func,
void *ctx );
#endif

View File

@ -0,0 +1,94 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MEM_H__
#define __DIRECT__MEM_H__
#include <direct/os/mem.h>
/**********************************************************************************************************************/
void DIRECT_API direct_print_memleaks( void );
/**********************************************************************************************************************/
void DIRECT_API *direct_dbg_malloc ( const char *file, int line,
const char *func, size_t bytes );
void DIRECT_API *direct_dbg_calloc ( const char *file, int line,
const char *func, size_t count, size_t bytes);
void DIRECT_API *direct_dbg_realloc( const char *file, int line,
const char *func, const char *what, void *mem,
size_t bytes );
char DIRECT_API *direct_dbg_strdup ( const char *file, int line,
const char *func, const char *str );
void DIRECT_API direct_dbg_free ( const char *file, int line,
const char *func, const char *what, void *mem );
/**********************************************************************************************************************/
#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG) || defined(DIRECT_MEM_DEBUG)
#if !DIRECT_BUILD_DEBUGS
#warning Building with debug, but library headers suggest that debug is not supported.
#endif
#define D_MALLOC(bytes) direct_dbg_malloc( __FILE__, __LINE__, __FUNCTION__, bytes )
#define D_CALLOC(count,bytes) direct_dbg_calloc( __FILE__, __LINE__, __FUNCTION__, count, bytes )
#define D_REALLOC(mem,bytes) direct_dbg_realloc( __FILE__, __LINE__, __FUNCTION__, #mem, mem, bytes )
#define D_STRDUP(str) direct_dbg_strdup( __FILE__, __LINE__, __FUNCTION__, str )
#define D_FREE(mem) direct_dbg_free( __FILE__, __LINE__, __FUNCTION__, #mem, mem )
#else
/**********************************************************************************************************************/
/* base malloc is declared in direct/os/mem.h */
#define D_MALLOC direct_malloc
#define D_CALLOC direct_calloc
#define D_REALLOC direct_realloc
#define D_STRDUP direct_strdup
#define D_FREE direct_free
#endif
void __D_mem_init( void );
void __D_mem_deinit( void );
#endif

View File

@ -0,0 +1,54 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MEMCPY_H__
#define __DIRECT__MEMCPY_H__
#include <direct/types.h>
void DIRECT_API direct_find_best_memcpy( void );
void DIRECT_API direct_print_memcpy_routines( void );
extern void DIRECT_API *(*direct_memcpy)( void *to, const void *from, size_t len );
static __inline__ void *direct_memmove( void *to, const void *from, size_t len )
{
if ((from < to && ((const char*) from + len) < ((char*) to)) ||
(((char*) to + len) < ((const char*) from)))
return direct_memcpy( to, from, len );
else
return memmove( to, from, len );
}
#endif

View File

@ -0,0 +1,179 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MESSAGES_H__
#define __DIRECT__MESSAGES_H__
#include <direct/types.h>
#if DIRECT_BUILD_TEXT
#include <direct/compiler.h>
#include <direct/conf.h>
void DIRECT_API direct_messages_info ( const char *format, ... ) D_FORMAT_PRINTF(1);
void DIRECT_API direct_messages_error ( const char *format, ... ) D_FORMAT_PRINTF(1);
void DIRECT_API direct_messages_derror ( DirectResult result,
const char *format, ... ) D_FORMAT_PRINTF(2);
void DIRECT_API direct_messages_perror ( int erno,
const char *format, ... ) D_FORMAT_PRINTF(2);
void DIRECT_API direct_messages_dlerror ( const char *dlerr,
const char *format, ... ) D_FORMAT_PRINTF(2);
void DIRECT_API direct_messages_once ( const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(4);
void DIRECT_API direct_messages_unimplemented( const char *func,
const char *file,
int line );
void DIRECT_API direct_messages_bug ( const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(4);
void DIRECT_API direct_messages_warn ( const char *func,
const char *file,
int line,
const char *format, ... ) D_FORMAT_PRINTF(4);
#define D_INFO(...) do { \
if (!(direct_config->quiet & DMT_INFO)) \
direct_messages_info( __VA_ARGS__ ); \
} while (0)
#define D_ERROR(...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_messages_error( __VA_ARGS__ ); \
} while (0)
#define D_ERROR_AT(d,...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_log_domain_log( &(d), DIRECT_LOG_ERROR, \
__PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
#define D_DERROR(r,...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_messages_derror( (DirectResult) r, __VA_ARGS__ ); \
} while (0)
// FIXME
#define D_DERROR_AT(d,r,...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_log_domain_log( &(d), DIRECT_LOG_ERROR, \
__PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
#define D_PERROR(...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_messages_perror( errno, __VA_ARGS__ ); \
} while (0)
#define D_DLERROR(...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_messages_dlerror( dlerror(), __VA_ARGS__ ); \
} while (0)
#define D_ONCE(...) do { \
if (!(direct_config->quiet & DMT_ONCE)) { \
static bool first = true; \
if (first) { \
direct_messages_once( __FUNCTION__, \
__FILE__, __LINE__, __VA_ARGS__ ); \
first = false; \
} \
} \
} while (0)
#define D_UNIMPLEMENTED() do { \
if (!(direct_config->quiet & DMT_UNIMPLEMENTED)) { \
static bool first = true; \
if (first) { \
direct_messages_unimplemented( __FUNCTION__, \
__FILE__, __LINE__ ); \
first = false; \
} \
} \
} while (0)
#define D_UNTESTED() do { \
if (!(direct_config->quiet & DMT_UNIMPLEMENTED)) { \
static bool first = true; \
if (first) { \
direct_messages_unimplemented( __FUNCTION__, \
__FILE__, __LINE__ ); \
first = false; \
} \
} \
} while (0)
#define D_BUG(...) do { \
if (!(direct_config->quiet & DMT_ERROR)) \
direct_messages_bug( __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ ); \
} while (0)
#define D_WARN(...) do { \
if (!(direct_config->quiet & DMT_WARNING)) \
direct_messages_warn( __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__ );\
} while (0)
#define D_OOM() (direct_messages_warn( __FUNCTION__, __FILE__, __LINE__, \
"out of memory" ), DR_NOLOCALMEMORY)
#else
#define D_INFO(...) do { } while (0)
#define D_ERROR(...) do { } while (0)
#define D_DERROR(...) do { } while (0)
#define D_PERROR(...) do { } while (0)
#define D_DLERROR(...) do { } while (0)
#define D_ONCE(...) do { } while (0)
#define D_UNIMPLEMENTED() do { } while (0)
#define D_BUG(...) do { } while (0)
#define D_WARN(...) do { } while (0)
#define D_OOM() (printf("out of memory\n"), DR_NOLOCALMEMORY)
#endif
#endif

View File

@ -0,0 +1,94 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MODULES_H__
#define __DIRECT__MODULES_H__
#include <direct/types.h>
#include <direct/list.h>
#include <direct/util.h>
struct __D_DirectModuleEntry {
DirectLink link;
int magic;
DirectModuleDir *directory;
bool loaded;
bool dynamic;
bool disabled;
char *name;
const void *funcs;
int refs;
char *file;
void *handle;
};
struct __D_DirectModuleDir {
const char *path;
unsigned int abi_version;
DirectLink *entries;
DirectModuleEntry *loading;
};
#define DECLARE_MODULE_DIRECTORY(d) \
extern DirectModuleDir d
#define DEFINE_MODULE_DIRECTORY(d,p,n) \
DirectModuleDir d = { \
/*.path =*/ p, \
/*.abi_version =*/ n, \
/*.entries =*/ NULL, \
/*.loading =*/ NULL, \
}
int DIRECT_API direct_modules_explore_directory( DirectModuleDir *directory );
void DIRECT_API direct_modules_register( DirectModuleDir *directory,
unsigned int abi_version,
const char *name,
const void *funcs );
void DIRECT_API direct_modules_unregister( DirectModuleDir *directory,
const char *name );
const void DIRECT_API *direct_module_ref ( DirectModuleEntry *module );
void DIRECT_API direct_module_unref( DirectModuleEntry *module );
#endif

View File

@ -0,0 +1,55 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__CLOCK_H__
#define __DIRECT__OS__CLOCK_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
typedef enum {
DIRECT_CLOCK_SESSION = 0x53551011, /* Derived from monotonic clock if supported */
DIRECT_CLOCK_REALTIME = 0,
DIRECT_CLOCK_MONOTONIC = 1,
DIRECT_CLOCK_PROCESS_CPUTIME_ID = 2,
DIRECT_CLOCK_THREAD_CPUTIME_ID = 3
} DirectClockType;
long long direct_clock_get_time ( DirectClockType type );
DirectResult direct_clock_set_time ( DirectClockType type, long long micros );
long long direct_clock_resolution( DirectClockType type );
#endif

View File

@ -0,0 +1,110 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__FILESYSTEM_H__
#define __DIRECT__OS__FILESYSTEM_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
/* API is subject to change! */
typedef enum {
DFP_NONE = 0,
DFP_READ = 1,
DFP_WRTIE = 2,
DFP_ALL = 3
} DirectFilePermission;
typedef enum {
DFIF_NONE = 0,
DFIF_SIZE = 1,
DFIF_ALL = 1
} DirectFileInfoFlags;
typedef struct {
DirectFileInfoFlags flags;
size_t size;
} DirectFileInfo;
DirectResult DIRECT_API direct_file_open ( DirectFile *file, const char *name, int flags, mode_t mode );
DirectResult DIRECT_API direct_file_read ( DirectFile *file, void *buffer, size_t bytes, size_t *ret_bytes );
DirectResult DIRECT_API direct_file_write( DirectFile *file, const void *buffer, size_t bytes, size_t *ret_bytes );
DirectResult DIRECT_API direct_file_seek( DirectFile *file, off_t offset );
DirectResult DIRECT_API direct_file_seek_to( DirectFile *file, off_t offset );
DirectResult DIRECT_API direct_file_close( DirectFile *file );
DirectResult DIRECT_API direct_file_map( DirectFile *file, void *addr, size_t offset, size_t bytes, DirectFilePermission flags, void **ret_addr );
DirectResult DIRECT_API direct_file_unmap( DirectFile *file, void *addr, size_t bytes );
DirectResult DIRECT_API direct_file_get_info( DirectFile *file, DirectFileInfo *ret_info );
DirectResult DIRECT_API direct_file_dup( DirectFile *file, const DirectFile *other );
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_fgets ( DirectFile *file, char *buf, size_t length );
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_popen ( DirectFile *file, const char *name, int flags );
DirectResult DIRECT_API direct_pclose( DirectFile *file );
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_readlink( const char *name, char *buf, size_t length, size_t *ret_length );
DirectResult DIRECT_API direct_access( const char *name, int flags );
#define R_OK 4
#define W_OK 2
#define X_OK 1
#define F_OK 0
#endif

View File

@ -0,0 +1,47 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LINUX__GLIBC__FILESYSTEM_H__
#define __DIRECT__OS__LINUX__GLIBC__FILESYSTEM_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
struct __D_DirectFile {
int fd;
FILE *file;
};
#endif

View File

@ -0,0 +1,52 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LINUX__GLIBC__MUTEX_H__
#define __DIRECT__OS__LINUX__GLIBC__MUTEX_H__
#include <pthread.h>
#include <direct/util.h>
/**********************************************************************************************************************/
struct __D_DirectMutex {
pthread_mutex_t lock;
};
/**********************************************************************************************************************/
#define DIRECT_MUTEX_INITIALIZER(name) { PTHREAD_MUTEX_INITIALIZER }
#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name) { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
#endif

View File

@ -0,0 +1,158 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LINUX__GLIBC__THREAD_H__
#define __DIRECT__OS__LINUX__GLIBC__THREAD_H__
#include <pthread.h>
#include <direct/util.h>
/**********************************************************************************************************************/
struct __D_DirectThreadHandle {
pthread_t thread;
char name[17];
};
/**********************************************************************************************************************/
/**********************************************************************************************************************/
/**********************************************************************************************************************/
struct __D_DirectOnce {
pthread_once_t once;
};
/**********************************************************************************************************************/
#define DIRECT_ONCE_INIT { PTHREAD_ONCE_INIT }
/**********************************************************************************************************************/
typedef void (*DirectOnceInitHandler)( void );
/**********************************************************************************************************************/
__attribute__((no_instrument_function))
static inline DirectResult direct_once( DirectOnce *once,
DirectOnceInitHandler handler );
static inline DirectResult
direct_once( DirectOnce *once,
DirectOnceInitHandler handler )
{
if (pthread_once( &once->once, handler ))
return errno2result( errno );
return DR_OK;
}
/**********************************************************************************************************************/
/**********************************************************************************************************************/
struct __D_DirectTLS {
pthread_key_t key;
};
/**********************************************************************************************************************/
#define DIRECT_TLS_DATA( name ) \
static DirectTLS name = { (pthread_key_t) -1 }
/**********************************************************************************************************************/
__attribute__((no_instrument_function))
static inline void *direct_tls_get__( DirectTLS *tls );
__attribute__((no_instrument_function))
static inline DirectResult direct_tls_set__( DirectTLS *tls,
void *value );
__attribute__((no_instrument_function))
static inline DirectResult direct_tls_register( DirectTLS *tls,
void (*destructor)( void* ) );
__attribute__((no_instrument_function))
static inline DirectResult direct_tls_unregister( DirectTLS *tls );
/**********************************************************************************************************************/
#define direct_tls_get( name ) direct_tls_get__( &name )
#define direct_tls_set( name, v ) direct_tls_set__( &name, v )
/**********************************************************************************************************************/
static inline void *
direct_tls_get__( DirectTLS *tls )
{
void *value;
value = pthread_getspecific( tls->key );
return value;
}
static inline DirectResult
direct_tls_set__( DirectTLS *tls,
void *value )
{
if (pthread_setspecific( tls->key, value ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_tls_register( DirectTLS *tls, void (*destructor)( void* ) )
{
if (pthread_key_create( &tls->key, destructor ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_tls_unregister( DirectTLS *tls )
{
if (pthread_key_delete( tls->key ))
return errno2result( errno );
tls->key = (pthread_key_t) -1;
return DR_OK;
}
#endif

View File

@ -0,0 +1,124 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LINUX__GLIBC__TYPES_H__
#define __DIRECT__OS__LINUX__GLIBC__TYPES_H__
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <sched.h>
#include <signal.h>
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
typedef unsigned int unichar;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
#define __inline__ inline
#define D_UNUSED __attribute__((unused))
#define __dfb_no_instrument_function__ __attribute__((no_instrument_function))
#define __constructor__ __attribute__((constructor))
#define __destructor__ __attribute__((destructor))
#ifndef __func__
#define __func__ __FUNCTION__
#endif
#define _ZD "%zd"
#define _ZU "%zu"
#define _ZUn(x) "%" #x "zu"
/*
* Define the bool type by including stdbool.h (preferably)...
*/
#if DIRECT_BUILD_STDBOOL
# include <stdbool.h>
/*
* ...or defining it ourself, if not using C++ or another definition
*/
#elif !defined(__cplusplus) && !defined(__bool_true_false_are_defined)
# warning Fallback definition of bool using u8! Checking for 'flags & 0x100' or higher bits will be false :(
typedef u8 bool;
# ifndef false
# define false (0)
# endif
# ifndef true
# define true (!false)
# endif
#endif /* DIRECT_BUILD_STDBOOL */
#if DIRECT_BUILD_DYNLOAD
#include <dlfcn.h>
#endif
#ifndef SIGUNUSED
#define SIGUNUSED 31
#endif
#endif

View File

@ -0,0 +1,122 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LINUX__GLIBC__WAITQUEUE_H__
#define __DIRECT__OS__LINUX__GLIBC__WAITQUEUE_H__
#include <pthread.h>
#include <direct/util.h>
#include "mutex.h"
/**********************************************************************************************************************/
struct __D_DirectWaitQueue {
pthread_cond_t cond;
};
/**********************************************************************************************************************/
#define DIRECT_WAITQUEUE_INITIALIZER(name) { PTHREAD_COND_INITIALIZER }
/**********************************************************************************************************************/
static inline DirectResult
direct_waitqueue_init( DirectWaitQueue *queue )
{
if (pthread_cond_init( &queue->cond, NULL ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_waitqueue_wait( DirectWaitQueue *queue, DirectMutex *mutex )
{
if (pthread_cond_wait( &queue->cond, &mutex->lock ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_waitqueue_wait_timeout( DirectWaitQueue *queue, DirectMutex *mutex, unsigned long micros )
{
struct timeval now;
struct timespec timeout;
long int seconds = micros / 1000000;
long int nano_seconds = (micros % 1000000) * 1000;
gettimeofday( &now, NULL );
timeout.tv_sec = now.tv_sec + seconds;
timeout.tv_nsec = (now.tv_usec * 1000) + nano_seconds;
timeout.tv_sec += timeout.tv_nsec / 1000000000;
timeout.tv_nsec %= 1000000000;
if (pthread_cond_timedwait( &queue->cond, &mutex->lock, &timeout ) == ETIMEDOUT)
return DR_TIMEOUT;
return DR_OK;
}
static inline DirectResult
direct_waitqueue_signal( DirectWaitQueue *queue )
{
if (pthread_cond_signal( &queue->cond ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_waitqueue_broadcast( DirectWaitQueue *queue )
{
if (pthread_cond_broadcast( &queue->cond ))
return errno2result( errno );
return DR_OK;
}
static inline DirectResult
direct_waitqueue_deinit( DirectWaitQueue *queue )
{
if (pthread_cond_destroy( &queue->cond ))
return errno2result( errno );
return DR_OK;
}
#endif

View File

@ -0,0 +1,100 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__LOG_H__
#define __DIRECT__OS__LOG_H__
#include <direct/os/mutex.h>
/**********************************************************************************************************************/
typedef enum {
DLT_STDERR, /* Simply print out log on stderr or comparable, e.g. using printk. */
DLT_FILE, /* Write log into a file. */
DLT_UDP /* Send out log via UDP. */
} DirectLogType;
/**********************************************************************************************************************/
typedef DirectResult (*DirectLogWriteFunc) ( DirectLog *log,
const char *buffer,
size_t bytes );
typedef DirectResult (*DirectLogFlushFunc) ( DirectLog *log,
bool sync );
typedef DirectResult (*DirectLogSetBufferFunc)( DirectLog *log,
char *buffer,
size_t bytes );
/**********************************************************************************************************************/
struct __D_DirectLog {
int magic;
DirectLogType type;
DirectMutex lock;
void *data;
DirectLogWriteFunc write;
DirectLogFlushFunc flush;
DirectLogSetBufferFunc set_buffer;
};
/**********************************************************************************************************************/
/*
* Initializes a logging facility.
*
* For each 'log->type' the 'param' has a different meaning:
* DLT_STDERR ignored (leave NULL)
* DLT_FILE file name
* DLT_UDP <ip>:<port>
*
* Implementation may set 'log->data' and should at least provide 'log->write' callback!
*/
DirectResult direct_log_init ( DirectLog *log,
const char *param );
/*
* Destroys a logging facility.
*/
DirectResult direct_log_deinit( DirectLog *log );
void direct_log_debug_delay( bool min );
#endif

View File

@ -0,0 +1,52 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__MEM_H__
#define __DIRECT__OS__MEM_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
void DIRECT_API *direct_malloc ( size_t bytes );
void DIRECT_API *direct_calloc ( size_t count, size_t bytes);
void DIRECT_API *direct_realloc( void *mem, size_t bytes );
char DIRECT_API *direct_strdup ( const char *string );
void DIRECT_API direct_free ( void *mem );
#endif

View File

@ -0,0 +1,55 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__MUTEX_H__
#define __DIRECT__OS__MUTEX_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
#ifndef DIRECT_OS_MUTEX_DEFINED
DirectResult DIRECT_API direct_mutex_init ( DirectMutex *mutex );
DirectResult DIRECT_API direct_recursive_mutex_init ( DirectMutex *mutex );
DirectResult DIRECT_API direct_mutex_lock ( DirectMutex *mutex );
DirectResult DIRECT_API direct_mutex_unlock ( DirectMutex *mutex );
DirectResult DIRECT_API direct_mutex_trylock ( DirectMutex *mutex );
DirectResult DIRECT_API direct_mutex_deinit ( DirectMutex *mutex );
#endif
#endif

View File

@ -0,0 +1,44 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__SIGNALS_H__
#define __DIRECT__OS__SIGNALS_H__
#include <direct/os/types.h>
DirectResult DIRECT_API direct_sigaction( int signum,
const struct sigaction *act,
struct sigaction *oldact );
#endif

View File

@ -0,0 +1,82 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__SYSTEM_H__
#define __DIRECT__OS__SYSTEM_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
/*
* Mainly special system calls...
*/
long DIRECT_API direct_pagesize( void );
unsigned long DIRECT_API direct_page_align( unsigned long value );
pid_t DIRECT_API direct_getpid( void );
pid_t DIRECT_API direct_gettid( void );
/* May return DR_TASK_NOT_FOUND */
DirectResult DIRECT_API direct_tgkill( int tgid, int tid, int sig );
/* shall not return! */
void DIRECT_API direct_trap( const char *domain, int sig );
DirectResult DIRECT_API direct_kill( pid_t pid, int sig );
DirectResult DIRECT_API direct_tkill( pid_t tid, int sig );
void DIRECT_API direct_sync( void );
DirectResult DIRECT_API direct_socketpair( int __domain, int __type, int __protocol, int __fds[2] );
DirectResult DIRECT_API direct_sigprocmask( int __how, const sigset_t *__set, sigset_t *__oset );
uid_t DIRECT_API direct_getuid( void );
uid_t DIRECT_API direct_geteuid( void );
char DIRECT_API *direct_getenv( const char *name );
DirectResult DIRECT_API direct_futex( int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2, int val3 );
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#endif

View File

@ -0,0 +1,88 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__THREAD_H__
#define __DIRECT__OS__THREAD_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_thread_init ( DirectThread *thread );
void DIRECT_API direct_thread_deinit ( DirectThread *thread );
/*
* Returns the thread of the caller.
*/
DirectThread DIRECT_API *direct_thread_self ( void );
/*
* Returns the name of the calling thread.
*/
const char DIRECT_API *direct_thread_self_name ( void );
/*
* Changes the name of the calling thread.
*/
void DIRECT_API direct_thread_set_name ( const char *name );
/*
* Cancel a running thread.
*/
void DIRECT_API direct_thread_cancel ( DirectThread *thread );
/*
* Detach a thread.
*/
void DIRECT_API direct_thread_detach ( DirectThread *thread );
/*
* Check if the calling thread is canceled.
* Must not be called by other threads than 'thread'.
* This function won't return if the thread is canceled.
*/
void DIRECT_API direct_thread_testcancel ( DirectThread *thread );
/*
* Wait until a running thread is terminated.
*/
void DIRECT_API direct_thread_join ( DirectThread *thread );
void DIRECT_API direct_thread_kill ( DirectThread *thread,
int signal );
void DIRECT_API direct_thread_sleep ( long long micros );
#endif

View File

@ -0,0 +1,145 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__TYPES_H__
#define __DIRECT__OS__TYPES_H__
#include <direct/build.h>
/**********************************************************************************************************************/
#endif
#if DIRECT_BUILD_OSTYPE == DIRECT_OS_LINUX_GNU_LIBC
#ifdef __DIRECT__OS__TYPES_H__
#include <direct/os/linux/glibc/types.h>
#endif
#ifdef __DIRECT__OS__FILESYSTEM_H__
#include <direct/os/linux/glibc/filesystem.h>
#endif
#ifdef __DIRECT__OS__MUTEX_H__
#include <direct/os/linux/glibc/mutex.h>
#endif
#ifdef __DIRECT__OS__THREAD_H__
#include <direct/os/linux/glibc/thread.h>
#endif
#ifdef __DIRECT__OS__WAITQUEUE_H__
#include <direct/os/linux/glibc/waitqueue.h>
#endif
#elif DIRECT_BUILD_OSTYPE == DIRECT_OS_LINUX_KERNEL
#ifdef __DIRECT__OS__TYPES_H__
#include <direct/os/linux/kernel/types.h>
#endif
#ifdef __DIRECT__OS__FILESYSTEM_H__
#include <direct/os/linux/kernel/filesystem.h>
#endif
#ifdef __DIRECT__OS__MUTEX_H__
#include <direct/os/linux/kernel/mutex.h>
#endif
#ifdef __DIRECT__OS__THREAD_H__
#include <direct/os/linux/kernel/thread.h>
#endif
#ifdef __DIRECT__OS__WAITQUEUE_H__
#include <direct/os/linux/kernel/waitqueue.h>
#endif
#elif DIRECT_BUILD_OSTYPE == DIRECT_OS_PSP
#ifdef __DIRECT__OS__TYPES_H__
#include <direct/os/psp/types.h>
#endif
#ifdef __DIRECT__OS__FILESYSTEM_H__
#include <direct/os/psp/filesystem.h>
#endif
#ifdef __DIRECT__OS__MUTEX_H__
#include <direct/os/psp/mutex.h>
#endif
#ifdef __DIRECT__OS__THREAD_H__
#include <direct/os/psp/thread.h>
#endif
#ifdef __DIRECT__OS__WAITQUEUE_H__
#include <direct/os/psp/waitqueue.h>
#endif
#elif DIRECT_BUILD_OSTYPE == DIRECT_OS_WIN32
#ifdef __DIRECT__OS__TYPES_H__
#include <direct/os/win32/types.h>
#endif
#ifdef __DIRECT__OS__FILESYSTEM_H__
#include <direct/os/win32/filesystem.h>
#endif
#ifdef __DIRECT__OS__MUTEX_H__
#include <direct/os/win32/mutex.h>
#endif
#ifdef __DIRECT__OS__THREAD_H__
#include <direct/os/win32/thread.h>
#endif
#ifdef __DIRECT__OS__WAITQUEUE_H__
#include <direct/os/win32/waitqueue.h>
#endif
#else
#error Unsupported OS type (DIRECT_BUILD_OSTYPE)!
#endif
#include <direct/types.h>

View File

@ -0,0 +1,55 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__OS__WAITQUEUE_H__
#define __DIRECT__OS__WAITQUEUE_H__
#include <direct/os/types.h>
/**********************************************************************************************************************/
#ifndef DIRECT_OS_WAITQUEUE_DEFINED
DirectResult DIRECT_API direct_waitqueue_init ( DirectWaitQueue *queue );
DirectResult DIRECT_API direct_waitqueue_wait ( DirectWaitQueue *queue, DirectMutex *mutex );
DirectResult DIRECT_API direct_waitqueue_wait_timeout( DirectWaitQueue *queue, DirectMutex *mutex, unsigned long micros );
DirectResult DIRECT_API direct_waitqueue_signal ( DirectWaitQueue *queue );
DirectResult DIRECT_API direct_waitqueue_broadcast ( DirectWaitQueue *queue );
DirectResult DIRECT_API direct_waitqueue_deinit ( DirectWaitQueue *queue );
#endif
#endif

View File

@ -0,0 +1,100 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__PERF_H__
#define __DIRECT__PERF_H__
#include <direct/types.h>
typedef struct {
unsigned long counter_id; // maybe switch to direct pointer
bool reset_on_dump;
char name[100];
} DirectPerfCounterInstallation;
typedef struct {
long long start;
long long stop;
unsigned long count;
char name[100];
bool reset_on_dump;
} DirectPerfCounter;
#if D_DEBUG_ENABLED
#define D_PERF_COUNTER( _identifier, _name ) \
DirectPerfCounterInstallation _identifier = { \
0, \
true, \
(_name) \
};
#define D_PERF_COUNT( _identifier ) \
direct_perf_count( &_identifier, 1 )
#define D_PERF_COUNT_N( _identifier, _diff ) \
direct_perf_count( &_identifier, _diff )
#else
#define D_PERF_COUNTER( _identifier, _name ) \
D_UNUSED int _identifier
#define D_PERF_COUNT( _identifier ) \
do {} while (0)
#define D_PERF_COUNT_N( _identifier, _diff ) \
do {} while (0)
#endif
void direct_perf_count( DirectPerfCounterInstallation *installation, int index );
void direct_perf_dump_all( void );
void __D_perf_init( void );
void __D_perf_deinit( void );
#endif

View File

@ -0,0 +1,78 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__PRINT_H__
#define __DIRECT__PRINT_H__
#include <direct/messages.h>
/**********************************************************************************************************************/
// TODO: Add registration for format codes in strings to have ToString() via printf!
/**********************************************************************************************************************/
int DIRECT_API direct_vsnprintf( char *buf, size_t size, const char *format, va_list args );
int DIRECT_API direct_snprintf ( char *buf, size_t size, const char *format, ... ) D_FORMAT_PRINTF(3);
DirectResult DIRECT_API direct_print( char *buf,
size_t size,
const char *format,
va_list args,
char **ret_ptr );
/*
char *out, buf[ FUSION_ENTRY_INFO_NAME_LENGTH ];
D_PRINT_BUF( buf, "CoreFusionZone == " CORE_UUID_FORMAT " ==", CORE_UUID_VALS( &zone->zone.zone_id ), out );
fusion_shm_pool_create( world, out, 0x10000000, true, &zone->shmpool );
D_PRINT_FREE( out, buf );
*/
#define D_PRINT_BUF( _buf, _format, _args, _out ) \
direct_print( _buf, sizeof(_buf), _format, _args, &(_out) )
#define D_PRINT_ALLOC( _format, _args, _out ) \
direct_print( NULL, 0, _format, _args, &(_out) )
#define D_PRINT_FREE( _out, _buf ) \
do { \
if ((_out) != (_buf)) \
direct_free( _out ); \
} while (0)
#endif

View File

@ -0,0 +1,112 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__PROCESSOR_H__
#define __DIRECT__PROCESSOR_H__
#include <direct/fifo.h>
#include <direct/types.h>
/**********************************************************************************************************************/
typedef struct {
DirectResult (*Start)( DirectProcessor *processor,
void *context );
DirectResult (*Process)( DirectProcessor *processor,
void *data,
void *context );
DirectResult (*Stop)( DirectProcessor *processor,
void *context );
DirectResult (*Idle)( DirectProcessor *processor,
void *context );
} DirectProcessorFuncs;
/**********************************************************************************************************************/
struct __D_DirectProcessor {
int magic;
DirectThread *thread;
DirectFifo commands;
DirectFifo recycled;
int max_recycled;
bool direct;
bool stop;
#if 0
bool locked;
int lock;
DirectWaitQueue lock_cond;
DirectMutex lock_mutex;
#endif
char *name;
const DirectProcessorFuncs *funcs;
unsigned int data_size;
void *context;
int idle_ms;
};
/**********************************************************************************************************************/
DirectResult DIRECT_API direct_processor_init ( DirectProcessor *processor,
const char *name,
const DirectProcessorFuncs *funcs,
unsigned int data_size,
void *context,
int idle_ms );
DirectResult DIRECT_API direct_processor_destroy ( DirectProcessor *processor );
void DIRECT_API *direct_processor_allocate( DirectProcessor *processor );
void DIRECT_API direct_processor_post ( DirectProcessor *processor,
void *data );
void DIRECT_API direct_processor_recycle ( DirectProcessor *processor,
void *data );
#if 0
void DIRECT_API direct_processor_lock ( DirectProcessor *processor );
void DIRECT_API direct_processor_unlock ( DirectProcessor *processor );
#endif
#endif

View File

@ -0,0 +1,193 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__RESULT_H__
#define __DIRECT__RESULT_H__
#include <direct/types.h>
/**********************************************************************************************************************/
#define D_RESULT_TYPE_CHAR_MASK ((unsigned int) 0x2F)
#define D_RESULT_TYPE_CHAR_MIN ((unsigned int) 0x30)
#define D_RESULT_TYPE_CHAR_MAX (D_RESULT_TYPE_CHAR_MIN + D_RESULT_TYPE_CHAR_MASK)
#define D_RESULT_TYPE_CHAR_MUL_0 ((unsigned int) 1)
#define D_RESULT_TYPE_CHAR_MUL_1 ((unsigned int)(D_RESULT_TYPE_CHAR_MASK + 1))
#define D_RESULT_TYPE_CHAR_MUL_2 (D_RESULT_TYPE_CHAR_MUL_1 * D_RESULT_TYPE_CHAR_MUL_1)
#define D_RESULT_TYPE_CHAR_MUL_3 (D_RESULT_TYPE_CHAR_MUL_1 * D_RESULT_TYPE_CHAR_MUL_2)
#define D_RESULT_TYPE_CHAR( C ) (((unsigned int)(C) - D_RESULT_TYPE_CHAR_MIN) & D_RESULT_TYPE_CHAR_MASK)
#define D_RESULT_TYPE_SPACE ((unsigned int)(0xFFFFFFFF / (D_RESULT_TYPE_CHAR_MASK * D_RESULT_TYPE_CHAR_MUL_3 + \
D_RESULT_TYPE_CHAR_MASK * D_RESULT_TYPE_CHAR_MUL_2 + \
D_RESULT_TYPE_CHAR_MASK * D_RESULT_TYPE_CHAR_MUL_1 + \
D_RESULT_TYPE_CHAR_MASK * D_RESULT_TYPE_CHAR_MUL_0) - 1))
/**********************************************************************************************************************/
#ifndef DIRECT_DISABLE_DEPRECATED
// @deprecated
#define D_RESULT_TYPE_BASE( a,b,c ) \
D_RESULT_TYPE_CODE_BASE( '@', a,b,c )
// @deprecated
#define D_RESULT_TYPE_MAX( a,b,c ) \
(D_RESULT_TYPE_BASE( a,b,c ) + D_RESULT_TYPE_SPACE - 1)
// @deprecated
#define D_RESULT_TYPE_IS( code, a,b,c ) \
((code) >= D_RESULT_TYPE_BASE(a,b,c) && (code) <= D_RESULT_TYPE_MAX(a,b,c))
#endif
/*
* Generate result code base for API ('A','B','C','D'), e.g. ('C','O','R','E')
*
* Allowed are ASCII values between (inclusive)
* D_RESULT_TYPE_CHAR_MIN (0x30) and
* D_RESULT_TYPE_CHAR_MAX (0x5F)
*
*
* 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
*
* @ A B C D E F G H I J K L M N O
*
* P Q R S T U V W X Y Z [ \ ] ^ _
*
*/
#define D_RESULT_TYPE_CODE_BASE(a,b,c,d) ((D_RESULT_TYPE_CHAR( a ) * (D_RESULT_TYPE_CHAR_MUL_3) + \
D_RESULT_TYPE_CHAR( b ) * (D_RESULT_TYPE_CHAR_MUL_2) + \
D_RESULT_TYPE_CHAR( c ) * (D_RESULT_TYPE_CHAR_MUL_1) + \
D_RESULT_TYPE_CHAR( d ) * (D_RESULT_TYPE_CHAR_MUL_0)) * \
D_RESULT_TYPE_SPACE)
#define D_RESULT_TYPE(code) ((code) - ((code) % D_RESULT_TYPE_SPACE))
#define D_RESULT_INDEX(code) ((code) % D_RESULT_TYPE_SPACE)
/**********************************************************************************************************************/
typedef enum {
DR_OK, /* No error occured */
DR__RESULT_BASE = D_RESULT_TYPE_CODE_BASE( 'D','R','_', '1' ),
DR_FAILURE, /* A general or unknown error occured */
DR_INIT, /* A general initialization error occured */
DR_BUG, /* Internal bug or inconsistency has been detected */
DR_DEAD, /* Interface has a zero reference counter (available in debug mode) */
DR_UNSUPPORTED, /* The requested operation or an argument is (currently) not supported */
DR_UNIMPLEMENTED, /* The requested operation is not implemented, yet */
DR_ACCESSDENIED, /* Access to the resource is denied */
DR_INVAREA, /* An invalid area has been specified or detected */
DR_INVARG, /* An invalid argument has been specified */
DR_NOLOCALMEMORY, /* There's not enough local system memory */
DR_NOSHAREDMEMORY, /* There's not enough shared system memory */
DR_LOCKED, /* The resource is (already) locked */
DR_BUFFEREMPTY, /* The buffer is empty */
DR_FILENOTFOUND, /* The specified file has not been found */
DR_IO, /* A general I/O error occured */
DR_BUSY, /* The resource or device is busy */
DR_NOIMPL, /* No implementation for this interface or content type has been found */
DR_TIMEOUT, /* The operation timed out */
DR_THIZNULL, /* 'thiz' pointer is NULL */
DR_IDNOTFOUND, /* No resource has been found by the specified id */
DR_DESTROYED, /* The requested object has been destroyed */
DR_FUSION, /* Internal fusion error detected, most likely related to IPC resources */
DR_BUFFERTOOLARGE, /* Buffer is too large */
DR_INTERRUPTED, /* The operation has been interrupted */
DR_NOCONTEXT, /* No context available */
DR_TEMPUNAVAIL, /* Temporarily unavailable */
DR_LIMITEXCEEDED, /* Attempted to exceed limit, i.e. any kind of maximum size, count etc */
DR_NOSUCHMETHOD, /* Requested method is not known */
DR_NOSUCHINSTANCE, /* Requested instance is not known */
DR_ITEMNOTFOUND, /* No such item found */
DR_VERSIONMISMATCH, /* Some versions didn't match */
DR_EOF, /* Reached end of file */
DR_SUSPENDED, /* The requested object is suspended */
DR_INCOMPLETE, /* The operation has been executed, but not completely */
DR_NOCORE, /* Core part not available */
DR_SIGNALLED, /* Received a signal, e.g. while waiting */
DR_TASK_NOT_FOUND, /* The corresponding task has not been found */
DR__RESULT_END
} DirectResult;
/**********************************************************************************************************************/
typedef struct {
int magic;
int refs;
unsigned int base;
const char **result_strings;
unsigned int result_count;
} DirectResultType;
const char DIRECT_API *DirectResultString( DirectResult result );
DirectResult DIRECT_API DirectResultTypeRegister ( DirectResultType *type );
DirectResult DIRECT_API DirectResultTypeUnregister( DirectResultType *type );
/*
* Example usage:
*
* static const char *FooResult__strings[] = {
* "FooResult", // result type name
*
* "General foobar", // FOO_GENERAL_FOOBAR
* "Too bar", // FOO_TOO_BAR
* };
*
*
* Corresponding example enumeration:
*
* typedef enum {
* FOO__RESULT_BASE = D_RESULT_TYPE_BASE( 'F','o','o' ),
*
* FOO_GENERAL_FOOBAR, // General foobar
* FOO_TOO_BAR, // Too bar
*
* FOO__RESULT_END
* } FooResult;
*/
void __D_result_init( void );
void __D_result_deinit( void );
#endif

View File

@ -0,0 +1,256 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__SERIAL_H__
#define __DIRECT__SERIAL_H__
#include <direct/atomic.h>
#include <direct/debug.h>
#include <direct/thread.h>
struct __D_DirectSerial {
int magic;
u32 overflow;
unsigned long value;
int waiting;
int wakeup;
};
#if D_DEBUG_ENABLED
#define DIRECT_SERIAL_ASSERT( serial ) \
do { \
D_MAGIC_ASSERT( serial, DirectSerial ); \
} while (0)
#else
#define DIRECT_SERIAL_ASSERT( serial ) \
do { \
} while (0)
#endif
D_LOG_DOMAIN( Direct_Serial, "Direct/Serial", "Direct Serial" );
static __inline__ void
direct_serial_initialize( DirectSerial *serial, const char *name )
{
D_DEBUG_AT( Direct_Serial, "%s( %p '%s' ) <<\n", __FUNCTION__, (void*) serial, name );
D_ASSERT( serial != NULL );
serial->value = 0;
serial->overflow = 0;
serial->waiting = 0;
D_MAGIC_SET( serial, DirectSerial );
}
// @deprecated
static __inline__ void
direct_serial_init( DirectSerial *serial )
{
D_DEBUG_AT( Direct_Serial, "%s( %p ) <<\n", __FUNCTION__, (void*) serial );
D_ASSERT( serial != NULL );
direct_serial_initialize( serial, "unnamed" );
}
static __inline__ void
direct_serial_init_from( DirectSerial *serial, const DirectSerial *source )
{
D_ASSERT( source != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) <<-- <%lu>\n", __FUNCTION__, (void*) serial, (void*) source, source->value );
D_ASSERT( serial != NULL );
D_MAGIC_ASSERT( source, DirectSerial );
serial->value = source->value;
serial->overflow = source->overflow;
serial->waiting = 0;
D_MAGIC_SET( serial, DirectSerial );
}
static __inline__ void
direct_serial_init_from_counting( DirectSerial *serial, DirectSerial *counter )
{
unsigned long value;
D_ASSERT( serial != NULL );
D_MAGIC_ASSERT( counter, DirectSerial );
value = D_SYNC_ADD_AND_FETCH( &counter->value, 1 );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) <<-- <%lu>\n", __FUNCTION__, (void*) serial, (void*) counter, value );
serial->value = value;
serial->overflow = counter->overflow;
serial->waiting = 0;
D_MAGIC_SET( serial, DirectSerial );
}
static __inline__ void
direct_serial_deinit( DirectSerial *serial )
{
D_ASSERT( serial != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p ) <- (%lu)\n", __FUNCTION__, (void*) serial, serial->value );
D_MAGIC_ASSERT( serial, DirectSerial );
D_ASSUME( serial->waiting == 0 );
D_MAGIC_CLEAR( serial );
}
static __inline__ void
direct_serial_increase( DirectSerial *serial )
{
D_ASSERT( serial != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p ) <- %lu ++\n", __FUNCTION__, (void*) serial, serial->value );
D_MAGIC_ASSERT( serial, DirectSerial );
if (! ++serial->value)
serial->overflow++;
D_DEBUG_AT( Direct_Serial, " -> %lu\n", serial->value );
}
static __inline__ void
direct_serial_copy( DirectSerial *serial, const DirectSerial *source )
{
D_ASSERT( serial != NULL );
D_ASSERT( source != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) <- %lu = (%lu)\n", __FUNCTION__,
(void*) serial, (void*) source, source->value, serial->value );
D_MAGIC_ASSERT( serial, DirectSerial );
D_MAGIC_ASSERT( source, DirectSerial );
serial->value = source->value;
serial->overflow = source->overflow;
}
static __inline__ bool
direct_serial_check( const DirectSerial *serial, const DirectSerial *source )
{
D_ASSERT( serial != NULL );
D_ASSERT( source != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) -- %lu == %lu\n", __FUNCTION__,
(void*) serial, (void*) source, serial->value, source->value );
D_MAGIC_ASSERT( serial, DirectSerial );
D_MAGIC_ASSERT( source, DirectSerial );
if (serial->overflow < source->overflow)
return false;
else if (serial->overflow == source->overflow && serial->value < source->value)
return false;
// D_ASSUME( serial->value == source->value );
return true;
}
static __inline__ bool
direct_serial_update( DirectSerial *serial, const DirectSerial *source )
{
D_ASSERT( serial != NULL );
D_ASSERT( source != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) <- %lu <-= %lu\n", __FUNCTION__,
(void*) serial, (void*) source, serial->value, source->value );
D_MAGIC_ASSERT( serial, DirectSerial );
D_MAGIC_ASSERT( source, DirectSerial );
if (serial->overflow < source->overflow) {
serial->overflow = source->overflow;
serial->value = source->value;
return true;
}
else if (serial->overflow == source->overflow && serial->value < source->value) {
serial->value = source->value;
return true;
}
D_ASSUME( serial->value == source->value );
return false;
}
DirectResult DIRECT_API direct_serial_wait ( DirectSerial *serial,
const DirectSerial *source );
DirectResult DIRECT_API direct_serial_notify( DirectSerial *serial,
const DirectSerial *source );
static __inline__ int
direct_serial_diff( const DirectSerial *a, const DirectSerial *b )
{
int ret;
D_ASSERT( a != NULL );
D_ASSERT( b != NULL );
D_DEBUG_AT( Direct_Serial, "%s( %p, %p ) <- %lu - %lu\n", __FUNCTION__,
(void*) a, (void*) b, a->value, b->value );
D_MAGIC_ASSERT( a, DirectSerial );
D_MAGIC_ASSERT( b, DirectSerial );
if (a->overflow > b->overflow)
ret = INT_MAX;
else if (b->overflow > a->overflow)
ret = INT_MIN;
else
ret = (int) a->value - (int) b->value;
D_DEBUG_AT( Direct_Serial, " -> %d\n", ret );
return ret;
}
#endif

View File

@ -0,0 +1,76 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__SIGNALS_H__
#define __DIRECT__SIGNALS_H__
#include <direct/os/signals.h>
typedef enum {
DSHR_OK,
DSHR_REMOVE,
DSHR_RESUME
} DirectSignalHandlerResult;
typedef DirectSignalHandlerResult (*DirectSignalHandlerFunc)( int num,
void *addr,
void *ctx );
DirectResult DIRECT_API direct_signals_initialize( void );
DirectResult DIRECT_API direct_signals_shutdown( void );
/*
* Modifies the current thread's signal mask to block everything.
* Should be called by input threads once to avoid killing themselves
* in the signal handler by deinitializing all input drivers.
*/
void DIRECT_API direct_signals_block_all( void );
/*
* Signal number to use when registering a handler for any interrupt.
*/
#define DIRECT_SIGNAL_ANY -1
#define DIRECT_SIGNAL_DUMP_STACK -2
DirectResult DIRECT_API direct_signal_handler_add ( int num,
DirectSignalHandlerFunc func,
void *ctx,
DirectSignalHandler **ret_handler );
DirectResult DIRECT_API direct_signal_handler_remove( DirectSignalHandler *handler );
#endif

View File

@ -0,0 +1,130 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__STREAM_H__
#define __DIRECT__STREAM_H__
#include <direct/types.h>
/*
* Create a stream wrapper.
*
* 'filename' can be a plain file name or one of the following:
* http://<host>[:<port>]/<path>
* unsv://<host>[:<port>]/<path>
* ftp://<host>[:<port>]/<path>
* rtsp://<host>[:<port>]/<path>
* tcp://<host>:<port>
* udp://<host>:<port>
* file:/<path>
* fd:/<fileno>
* stdin:/
*/
DirectResult DIRECT_API direct_stream_create ( const char *filename,
DirectStream **ret_stream );
/*
* Duplicate the stream (never fails).
*/
DirectStream DIRECT_API *direct_stream_dup ( DirectStream *stream );
/*
* Return the file descriptor associated to the stream.
*/
int DIRECT_API direct_stream_fileno ( DirectStream *stream );
/*
* True if stream is seekable.
*/
bool DIRECT_API direct_stream_seekable( DirectStream *stream );
/*
* True if stream originates from a remote host.
*/
bool DIRECT_API direct_stream_remote ( DirectStream *stream );
/*
* Get the mime description of the stream.
* Returns NULL if the information is not available.
*/
const char DIRECT_API *direct_stream_mime ( DirectStream *stream );
/*
* Get stream length.
*/
unsigned int DIRECT_API direct_stream_length ( DirectStream *stream );
/*
* Get stream position.
*/
unsigned int DIRECT_API direct_stream_offset ( DirectStream *stream );
/*
* Wait for data to be available.
* If 'timeout' is NULL, the function blocks indefinitely.
* Set the 'timeout' to 0 to make the function return immediatly.
*/
DirectResult DIRECT_API direct_stream_wait ( DirectStream *stream,
unsigned int length,
struct timeval *timeout );
/*
* Peek 'length' bytes of data at offset 'offset' from the stream.
*/
DirectResult DIRECT_API direct_stream_peek ( DirectStream *stream,
unsigned int length,
int offset,
void *buf,
unsigned int *read_out );
/*
* Fetch 'length' bytes of data from the stream.
*/
DirectResult DIRECT_API direct_stream_read ( DirectStream *stream,
unsigned int length,
void *buf,
unsigned int *read_out );
/*
* Seek to the specified absolute offset within the stream.
*/
DirectResult DIRECT_API direct_stream_seek ( DirectStream *stream,
unsigned int offset );
/*
* Destroy the stream wrapper.
*/
void DIRECT_API direct_stream_destroy ( DirectStream *stream );
#endif /* __DIRECT__STREAM_H__ */

View File

@ -0,0 +1,49 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__SYSTEM_H__
#define __DIRECT__SYSTEM_H__
#include <direct/os/system.h>
DirectResult DIRECT_API direct_futex_wait ( int *uaddr, int val );
DirectResult DIRECT_API direct_futex_wait_timed( int *uaddr, int val, int ms );
DirectResult DIRECT_API direct_futex_wake ( int *uaddr, int num );
// Temporarily for testing
extern unsigned int DIRECT_API __Direct_Futex_Wait_Count;
extern unsigned int DIRECT_API __Direct_Futex_Wake_Count;
#endif

View File

@ -0,0 +1,177 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__THREAD_H__
#define __DIRECT__THREAD_H__
#include <direct/os/mutex.h>
#include <direct/os/thread.h>
#include <direct/os/waitqueue.h>
/**********************************************************************************************************************/
typedef enum {
DTT_DEFAULT = 0,
DTT_CLEANUP = -5,
DTT_INPUT = -10,
DTT_OUTPUT = -12,
DTT_MESSAGING = -15,
DTT_CRITICAL = -20
} DirectThreadType;
typedef void * (*DirectThreadMainFunc)( DirectThread *thread, void *arg );
typedef void (*DirectThreadInitFunc)( DirectThread *thread, void *arg );
/**********************************************************************************************************************/
struct __D_DirectThread {
int magic;
char *name;
DirectThreadType type; /* The thread's type, e.g. input thread. */
DirectThreadMainFunc main; /* The thread's main routine (or entry point). */
void *arg; /* Custom argument passed to the main routine. */
DirectThreadHandle handle; /* The OS thread handle... */
pid_t tid; /* A simplified version using an integer */
bool canceled; /* Set when direct_thread_cancel() is called. */
bool joining; /* Set when direct_thread_join() is called. */
bool joined; /* Set when direct_thread_join() has finished. */
bool detached; /* Set when direct_thread_detach() is called. */
bool terminated; /* Set when direct_thread_terminate() is called. */
bool init; /* Set to true before the main routine is called. */
DirectMutex lock;
DirectWaitQueue cond;
unsigned int counter;
int priority;
size_t stack_size;
void *trace_buffer;
};
/**********************************************************************************************************************/
#define DIRECT_THREAD_ASSERT( _thread ) \
do { \
D_MAGIC_ASSERT( _thread, DirectThread ); \
D_ASSERT( (_thread)->tid != (pid_t) -1 ); \
} while (0)
/**********************************************************************************************************************/
/**********************************************************************************************************************/
/*
* Add a handler being called at the beginning of new threads.
*/
DirectThreadInitHandler DIRECT_API *direct_thread_add_init_handler ( DirectThreadInitFunc func,
void *arg );
/*
* Remove the specified handler.
*/
void DIRECT_API direct_thread_remove_init_handler( DirectThreadInitHandler *handler );
/**********************************************************************************************************************/
/**********************************************************************************************************************/
/*
* Create a new thread and start it.
* The thread type is relevant for the scheduling priority.
*/
DirectThread DIRECT_API *direct_thread_create ( DirectThreadType thread_type,
DirectThreadMainFunc thread_main,
void *arg,
const char *name );
/*
* Wait on the thread object to be notified via direct_thread_notify().
*/
DirectResult DIRECT_API direct_thread_wait ( DirectThread *thread,
int timeout_ms );
/*
* Notify the thread object waking up callers of direct_thread_wait().
*/
DirectResult DIRECT_API direct_thread_notify ( DirectThread *thread );
DirectResult DIRECT_API direct_thread_lock ( DirectThread *thread );
DirectResult DIRECT_API direct_thread_unlock ( DirectThread *thread );
/*
* Kindly ask the thread to terminate (for joining without thread cancellation).
*/
DirectResult DIRECT_API direct_thread_terminate ( DirectThread *thread );
/*
* Free resources allocated by direct_thread_create.
* If the thread is still running it will be killed.
*/
void DIRECT_API direct_thread_destroy ( DirectThread *thread );
pid_t DIRECT_API direct_thread_get_tid ( const DirectThread *thread );
bool DIRECT_API direct_thread_is_canceled( const DirectThread *thread );
bool DIRECT_API direct_thread_is_joined ( const DirectThread *thread );
/*
* Returns the name of the specified thread.
*/
const char *direct_thread_get_name ( DirectThread *thread );
/*
* Utilities for stringification.
*/
#if DIRECT_BUILD_TEXT
const char DIRECT_API *direct_thread_type_name ( DirectThreadType type );
const char DIRECT_API *direct_thread_scheduler_name( DirectConfigThreadScheduler scheduler );
const char DIRECT_API *direct_thread_policy_name ( int policy );
#endif
void DIRECT_API __D_direct_thread_call_init_handlers( DirectThread *thread );
void __D_thread_init( void );
void __D_thread_deinit( void );
#endif

View File

@ -0,0 +1,107 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__TRACE_H__
#define __DIRECT__TRACE_H__
#include <direct/types.h>
/***********************************************************************************************************************
** Symbols
*/
/*
* Returns filename on success or NULL.
*
* Stores load address of object in 'ret_base' on success.
*/
const char DIRECT_API *direct_trace_lookup_file ( void *address,
void **ret_base );
/*
* Look up a symbol by filename and offset.
*
* Returns symbol name on success or NULL.
*/
const char DIRECT_API *direct_trace_lookup_symbol( const char *filename,
long offset );
/*
* Convenience function combining direct_trace_lookup_file() and direct_trace_lookup_symbol().
*/
static __inline__ const char *
direct_trace_lookup_symbol_at( void *address )
{
void *base;
const char *filename;
filename = direct_trace_lookup_file( address, &base );
return direct_trace_lookup_symbol( filename, (unsigned long) address - (unsigned long) base );
}
/***********************************************************************************************************************
** Stacks
*/
/*
* Print stack in 'buffer' or current if NULL.
*/
void DIRECT_API direct_trace_print_stack( DirectTraceBuffer *buffer );
/*
* Print stack of each known thread.
*/
void DIRECT_API direct_trace_print_stacks( void );
/*
* Returns indent level for debug output.
*/
int DIRECT_API direct_trace_debug_indent( void );
/*
* Retrieve pointer to calling function if present, otherwise NULL.
*/
void DIRECT_API *direct_trace_get_caller( void );
/*
* Create a copy of a stack in 'buffer' or of current if NULL.
*/
DirectTraceBuffer DIRECT_API *direct_trace_copy_buffer( DirectTraceBuffer *buffer );
/*
* Free a (copied) stack buffer.
*/
void DIRECT_API direct_trace_free_buffer( DirectTraceBuffer *buffer );
#endif

View File

@ -0,0 +1,68 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
Balanced binary tree ported from glib by Sven Neumann
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__TREE_H__
#define __DIRECT__TREE_H__
#include <direct/types.h>
typedef struct __D_DirectNode DirectNode;
struct __D_DirectTree
{
DirectNode *root;
void *fast_keys[128];
};
struct __D_DirectNode
{
int balance;
DirectNode *left;
DirectNode *right;
void *key;
void *value;
};
DirectTree DIRECT_API *direct_tree_new ( void );
void DIRECT_API direct_tree_destroy( DirectTree *tree );
void DIRECT_API direct_tree_insert ( DirectTree *tree,
void *key,
void *value );
void DIRECT_API *direct_tree_lookup ( DirectTree *tree,
void *key );
#endif

View File

@ -0,0 +1,100 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__TYPES_H__
#define __DIRECT__TYPES_H__
#include <direct/os/types.h>
#ifdef WIN32
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the DIRECT_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// DIRECT_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef DIRECT_EXPORTS
#define DIRECT_API __declspec(dllexport)
#else
#define DIRECT_API __declspec(dllimport)
#endif
#else
#define DIRECT_API
#endif
#include <direct/result.h>
/**********************************************************************************************************************/
/*
* Return value of enumeration callbacks
*/
typedef enum {
DENUM_OK = 0x00000000, /* Proceed with enumeration */
DENUM_CANCEL = 0x00000001, /* Cancel enumeration */
DENUM_REMOVE = 0x00000002 /* Remove item */
} DirectEnumerationResult;
typedef struct __D_DirectCleanupHandler DirectCleanupHandler;
typedef struct __D_DirectConfig DirectConfig;
typedef struct __D_DirectFifo DirectFifo;
typedef struct __D_DirectFifoItem DirectFifoItem;
typedef struct __D_DirectFile DirectFile;
typedef struct __D_DirectHash DirectHash;
typedef struct __D_DirectOnce DirectOnce;
typedef struct __D_DirectLink DirectLink;
typedef struct __D_DirectLog DirectLog;
typedef struct __D_DirectMap DirectMap;
typedef struct __D_DirectModuleDir DirectModuleDir;
typedef struct __D_DirectModuleEntry DirectModuleEntry;
typedef struct __D_DirectMutex DirectMutex;
typedef struct __D_DirectProcessor DirectProcessor;
typedef struct __D_DirectSerial DirectSerial;
typedef struct __D_DirectSignalHandler DirectSignalHandler;
typedef struct __D_DirectStream DirectStream;
typedef struct __D_DirectTLS DirectTLS;
typedef struct __D_DirectTraceBuffer DirectTraceBuffer;
typedef struct __D_DirectTree DirectTree;
typedef struct __D_DirectThread DirectThread;
typedef struct __D_DirectThreadHandle DirectThreadHandle;
typedef struct __D_DirectThreadInitHandler DirectThreadInitHandler;
typedef struct __D_DirectWaitQueue DirectWaitQueue;
typedef void D_String;
#endif

View File

@ -0,0 +1,82 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
UTF8 routines ported from glib-2.0 and optimized
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__UTF8_H__
#define __DIRECT__UTF8_H__
#include <direct/types.h>
#define DIRECT_UTF8_SKIP(c) (((u8)(c) < 0xc0) ? 1 : __direct_utf8_skip[(u8)(c)&0x3f])
#define DIRECT_UTF8_GET_CHAR(p) (*(const u8*)(p) < 0xc0 ? \
*(const u8*)(p) : __direct_utf8_get_char((const u8*)(p)))
/*
* Actually the last two fields used to be zero since they indicate an
* invalid UTF-8 string. Changed it to 1 to avoid endless looping on
* invalid input.
*/
static const char __direct_utf8_skip[64] = {
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};
static __inline__ unichar __direct_utf8_get_char( const u8 *p )
{
int len;
register unichar result = p[0];
if (result < 0xc0)
return result;
if (result > 0xfd)
return (unichar) -1;
len = __direct_utf8_skip[result & 0x3f];
result &= 0x7c >> len;
while (--len) {
int c = *(++p);
if ((c & 0xc0) != 0x80)
return (unichar) -1;
result = (result << 6) | (c & 0x3f);
}
return result;
}
#endif

View File

@ -0,0 +1,366 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__UTIL_H__
#define __DIRECT__UTIL_H__
#include <direct/clock.h>
#include <direct/messages.h>
#include <direct/print.h>
#ifndef DIRECT_DISABLE_DEPRECATED
#include <pthread.h>
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef SIGN
#define SIGN(x) (((x) < 0) ? -1 : (((x) > 0) ? 1 : 0))
#endif
#ifndef ABS
#define ABS(x) ((x) > 0 ? (x) : -(x))
#endif
#ifndef CLAMP
#define CLAMP(x,min,max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#endif
#ifndef BSWAP16
#define BSWAP16(x) (((u16)(x)>>8) | ((u16)(x)<<8))
#endif
#ifndef BSWAP32
#define BSWAP32(x) ((((u32)(x)>>24) & 0x000000ff) | (((u32)(x)>> 8) & 0x0000ff00) | \
(((u32)(x)<< 8) & 0x00ff0000) | (((u32)(x)<<24) & 0xff000000))
#endif
#ifdef __GNUC__
#define D_FLAGS_SET(flags,f) do { (flags) = (__typeof__(flags))((flags) | (f)); } while (0)
#define D_FLAGS_CLEAR(flags,f) do { (flags) = (__typeof__(flags))((flags) & ~(f)); } while (0)
#else
#define D_FLAGS_SET(flags,f) do { (flags) = (unsigned int)((flags) | (f)); } while (0)
#define D_FLAGS_CLEAR(flags,f) do { (flags) = (unsigned int)((flags) & ~(f)); } while (0)
#endif
#define D_FLAGS_IS_SET(flags,f) (((flags) & (f)) != 0)
#define D_FLAGS_ARE_SET(flags,f) (((flags) & (f)) == (f))
#define D_FLAGS_ARE_IN(flags,f) (((flags) & ~(f)) == 0)
#define D_FLAGS_INVALID(flags,f) (((flags) & ~(f)) != 0)
#define D_ARRAY_SIZE(array) ((int)(sizeof(array) / sizeof((array)[0])))
#define D_UTIL_SWAP(a,b) \
do { \
const __typeof__(a) __swap_x = (a); (a) = (b); (b) = __swap_x; \
} while (0)
#if __GNUC__ >= 3
#define D_CONST_FUNC __attribute__((const))
#else
#define D_CONST_FUNC
#endif
#if __GNUC__ >= 3
#define D_FORMAT_PRINTF(n) __attribute__((__format__ (__printf__, n, n+1)))
#define D_FORMAT_VPRINTF(n) __attribute__((__format__ (__printf__, n, 0)))
#else
#define D_FORMAT_PRINTF(n)
#define D_FORMAT_VPRINTF(n)
#endif
#define D_BITn32(f) (((f) & 0x00000001) ? 0 : \
((f) & 0x00000002) ? 1 : \
((f) & 0x00000004) ? 2 : \
((f) & 0x00000008) ? 3 : \
((f) & 0x00000010) ? 4 : \
((f) & 0x00000020) ? 5 : \
((f) & 0x00000040) ? 6 : \
((f) & 0x00000080) ? 7 : \
((f) & 0x00000100) ? 8 : \
((f) & 0x00000200) ? 9 : \
((f) & 0x00000400) ? 10 : \
((f) & 0x00000800) ? 11 : \
((f) & 0x00001000) ? 12 : \
((f) & 0x00002000) ? 13 : \
((f) & 0x00004000) ? 14 : \
((f) & 0x00008000) ? 15 : \
((f) & 0x00010000) ? 16 : \
((f) & 0x00020000) ? 17 : \
((f) & 0x00040000) ? 18 : \
((f) & 0x00080000) ? 19 : \
((f) & 0x00100000) ? 20 : \
((f) & 0x00200000) ? 21 : \
((f) & 0x00400000) ? 22 : \
((f) & 0x00800000) ? 23 : \
((f) & 0x01000000) ? 24 : \
((f) & 0x02000000) ? 25 : \
((f) & 0x04000000) ? 26 : \
((f) & 0x08000000) ? 27 : \
((f) & 0x10000000) ? 28 : \
((f) & 0x20000000) ? 29 : \
((f) & 0x40000000) ? 30 : \
((f) & 0x80000000) ? 31 : -1)
#define D_UNUSED_P(x) (void)x
/*
* portable sched_yield() implementation
*/
#ifdef _POSIX_PRIORITY_SCHEDULING
#define direct_sched_yield() sched_yield()
#else
#define direct_sched_yield() usleep(1)
#endif
/*
* translates errno to DirectResult
*/
DirectResult DIRECT_API errno2result( int erno );
/*
* duplicates a file descriptor as needed to ensure it's not stdin, stdout, or stderr
*/
int DIRECT_API direct_safe_dup( int fd );
#ifndef DIRECT_DISABLE_DEPRECATED
// @deprecated
int DIRECT_API direct_try_open( const char *name1, const char *name2, int flags, bool error_msg );
// @deprecated
int DIRECT_API direct_util_recursive_pthread_mutex_init( pthread_mutex_t *mutex );
#endif
const char DIRECT_API *direct_inet_ntop( int af, const void* src, char* dst, int cnt );
int DIRECT_API direct_sscanf( const char *str, const char *format, ... );
int DIRECT_API direct_vsscanf( const char *str, const char *format, va_list args );
size_t DIRECT_API direct_strlen( const char *s );
void DIRECT_API direct_trim( char **s );
int DIRECT_API direct_strcmp( const char *a, const char *b );
int DIRECT_API direct_strcasecmp( const char *a, const char *b );
int DIRECT_API direct_strncasecmp( const char *a, const char *b, size_t bytes );
unsigned long int DIRECT_API direct_strtoul( const char *nptr, char **endptr, int base );
char DIRECT_API *direct_strtok_r( char *str, const char *delim, char **saveptr );
const char DIRECT_API *direct_strerror( int erno );
/*
* Set a string with a maximum size including the zero termination.
*
* This acts like a strncpy(d,s,n), but always terminates the string like direct_snprintf(d,n,"%s",s).
*
* Returns dest or NULL if n is zero.
*/
char DIRECT_API *direct_snputs( char *dest,
const char *src,
size_t n );
/*
* Encode/Decode Base-64 strings.
*/
char DIRECT_API *direct_base64_encode( const void *data, int size );
void DIRECT_API *direct_base64_decode( const char *string, int *ret_size );
/*
* Compute MD5 sum (store 16-bytes long result in "dst").
*/
void DIRECT_API direct_md5_sum( void *dst, const void *src, const int len );
/*
* Slow implementation, but quite fast if only low bits are set.
*/
static __inline__ int
direct_util_count_bits( unsigned int mask )
{
register int ret = 0;
while (mask) {
ret += mask & 1;
mask >>= 1;
}
return ret;
}
/*
* Generic alignment routine.
*/
static __inline__ int
direct_util_align( int value,
int alignment )
{
if (alignment > 1) {
int tail = value % alignment;
if (tail)
value += alignment - tail;
}
return value;
}
void DIRECT_API *
direct_bsearch( const void *key, const void *base,
size_t nmemb, size_t size, void *func );
/* floor and ceil implementation to get rid of libm */
/*
IEEE floor for computers that round to nearest or even.
'f' must be between -4194304 and 4194303.
This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
but uses some IEEE specific tricks for better speed.
*/
static __inline__ int
D_IFLOOR(float f)
{
int ai, bi;
double af, bf;
af = (3 << 22) + 0.5 + (double)f;
bf = (3 << 22) + 0.5 - (double)f;
#if defined(__GNUC__) && defined(__i386__)
/*
GCC generates an extra fstp/fld without this.
*/
__asm__ __volatile__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ __volatile__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
#else
{
union { int i; float f; } u;
u.f = (float) af; ai = u.i;
u.f = (float) bf; bi = u.i;
}
#endif
return (ai - bi) >> 1;
}
/*
IEEE ceil for computers that round to nearest or even.
'f' must be between -4194304 and 4194303.
This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
but uses some IEEE specific tricks for better speed.
*/
static __inline__ int
D_ICEIL(float f)
{
int ai, bi;
double af, bf;
af = (3 << 22) + 0.5 + (double)f;
bf = (3 << 22) + 0.5 - (double)f;
#if defined(__GNUC__) && defined(__i386__)
/*
GCC generates an extra fstp/fld without this.
*/
__asm__ __volatile__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
__asm__ __volatile__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
#else
{
union { int i; float f; } u;
u.f = (float) af; ai = u.i;
u.f = (float) bf; bi = u.i;
}
#endif
return (ai - bi + 1) >> 1;
}
static __inline__ int
direct_log2( int val )
{
register int ret = 0;
while (val >> ++ret);
if ((1 << --ret) < val)
ret++;
return ret;
}
typedef struct {
long long start;
long long stop;
} DirectClock;
static __inline__ void direct_clock_start( DirectClock *clock ) {
clock->start = direct_clock_get_micros();
}
static __inline__ void direct_clock_stop( DirectClock *clock ) {
clock->stop = direct_clock_get_micros();
}
static __inline__ long long direct_clock_diff( DirectClock *clock ) {
return clock->stop - clock->start;
}
#define DIRECT_CLOCK_DIFF_SEC_MS( clock ) \
(direct_clock_diff( clock ) / 1000000), (direct_clock_diff( clock ) / 1000 % 1000)
#define DIRECT_CLOCK_ITEMS_Mk_SEC( clock, n ) \
((n) / direct_clock_diff( clock )), ((long)(((n) * 1000LL / direct_clock_diff( clock ) % 1000)))
void __D_util_init( void );
void __D_util_deinit( void );
#endif

View File

@ -0,0 +1,121 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__UUID_H__
#define __DIRECT__UUID_H__
#include <direct/types.h>
/*
* Direct UUID
*/
typedef union {
struct {
u32 ___u32_x1[1];
u16 ___u16_x2[2];
u8 ____u8_x8[8];
};
// struct {
u64 ___u64_x2[2];
// };
// struct {
u32 ___u32_x4[4];
// };
// struct {
u16 ___u16_x8[8];
// };
// struct {
u8 __u8_x16[16];
// };
} DirectUUID;
/**********************************************************************************************************************/
/*
* We're using 64bit hash keys...
*
*
* u64 value = 2166136261UL;
*
* for (i=0; i<4; i++) {
* value ^= (uuid)->___u32_x4[i];
* value *= 16777619ULL;
* }
*
*/
#define D_UUID_HASH( uuid ) ((u64 )( ((( ((( ((( (((2166136261ULL \
^ (uuid)->___u32_x4[0])) * 16777619ULL) \
^ (uuid)->___u32_x4[1])) * 16777619ULL) \
^ (uuid)->___u32_x4[2])) * 16777619ULL) \
^ (uuid)->___u32_x4[3])) * 16777619ULL) ))
/**********************************************************************************************************************/
#define D_UUID_EQUAL( u1, u2 ) \
( (u1) == (u2) || \
(((u1)->___u64_x2[0] == (u2)->___u64_x2[0]) && ((u1)->___u64_x2[1] == (u2)->___u64_x2[1])) )
#define D_UUID_EMPTY( uuid ) \
( (uuid)->___u64_x2[0] == 0 && (uuid)->___u64_x2[1] == 0 )
#define D_UUID_VALS( uuid ) \
(uuid)->___u32_x1[0], (uuid)->___u16_x2[0], (uuid)->___u16_x2[1], \
(uuid)->____u8_x8[0], (uuid)->____u8_x8[1], (uuid)->____u8_x8[2], (uuid)->____u8_x8[3], \
(uuid)->____u8_x8[4], (uuid)->____u8_x8[5], (uuid)->____u8_x8[6], (uuid)->____u8_x8[7]
#define D_UUID_FORMAT "%08x-%04x-%04x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x"
#define D_UUID_LOG( Domain, LEVEL, u, msg ) \
D_LOG( Domain, LEVEL, "%s == "D_UUID_FORMAT" ==\n", \
msg, D_UUID_VALS( u ) );
#define D_UUID_DEBUG_AT( Domain, u, msg ) \
D_UUID_LOG( Domain, DEBUG, u, msg )
/**********************************************************************************************************************/
#define D_UUID_NULL \
(DirectUUID){{ { 0 }, { 0, 0 }, \
{ 0, 0, 0, 0, 0, 0, 0, 0 } }}
/**********************************************************************************************************************/
/**********************************************************************************************************************/
void DIRECT_API direct_uuid_generate( DirectUUID *ret_id );
#endif

View File

@ -0,0 +1,398 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef DIRECTFBPP_H
#define DIRECTFBPP_H
#include <direct/Types++.h>
#define DFBPoint DFBPoint_C
#define DFBDimension DFBDimension_C
#define DFBRectangle DFBRectangle_C
#define DFBRegion DFBRegion_C
#define DFBUpdates DFBUpdates_C
#include <directfb.h>
#include <directfb_util.h>
extern "C" {
#include <directfb_keynames.h>
#include <directfb_strings.h>
}
#undef DFBPoint
#undef DFBDimension
#undef DFBRectangle
#undef DFBRegion
#undef DFBUpdates
class DFBPoint : public DFBPoint_C {
public:
DFBPoint() {
x = 0;
y = 0;
}
DFBPoint( const int &_x, const int &_y ) {
x = _x;
y = _y;
}
DFBPoint( const DFBPoint_C &point ) {
x = point.x;
y = point.y;
}
DFBPoint( const DFBRectangle_C &rectangle ) {
x = rectangle.x;
y = rectangle.y;
}
DFBPoint( const DFBRegion_C &region ) {
x = region.x1;
y = region.y1;
}
bool operator== ( const DFBPoint &ref ) const {
return ref.x == x && ref.y == y;
}
DFBPoint operator +( const DFBPoint &offset ) const {
DFBPoint p( *this );
p.x += offset.x;
p.y += offset.y;
return p;
}
DFBPoint& operator +=( const DFBPoint& offset ) {
x += offset.x;
y += offset.y;
return *this;
}
};
class DFBDimension : public DFBDimension_C {
public:
DFBDimension() {
w = 0;
h = 0;
}
DFBDimension( const int &_w, const int &_h ) {
w = _w;
h = _h;
}
DFBDimension( const DFBDimension_C &dimension ) {
w = dimension.w;
h = dimension.h;
}
DFBDimension( const DFBPoint_C &point ) {
w = point.x;
h = point.y;
}
DFBDimension( const DFBRectangle_C &rectangle ) {
w = rectangle.w;
h = rectangle.h;
}
DFBDimension( const DFBRegion_C &region ) {
w = region.x2 - region.x1 + 1;
h = region.y2 - region.y1 + 1;
}
bool operator== ( const DFBDimension &ref ) const {
return ref.w == w && ref.h == h;
}
bool operator!= ( const DFBDimension &ref ) const {
return ref.w != w || ref.h != h;
}
bool contains( const DFBRegion_C &region ) const {
if (region.x1 < 0 || region.y1 < 0)
return false;
if (region.x2 >= w || region.y2 >= h)
return false;
return true;
}
};
class DFBRectangle : public DFBRectangle_C {
public:
DFBRectangle() {
x = 0;
y = 0;
w = 0;
h = 0;
}
DFBRectangle( const int &_x, const int &_y, const int &_w, const int &_h ) {
x = _x;
y = _y;
w = _w;
h = _h;
}
DFBRectangle( const DFBRectangle_C &rectangle ) {
x = rectangle.x;
y = rectangle.y;
w = rectangle.w;
h = rectangle.h;
}
DFBRectangle( const DFBRegion_C &region ) {
x = region.x1;
y = region.y1;
w = region.x2 - region.x1 + 1;
h = region.y2 - region.y1 + 1;
}
DFBRectangle( const DFBDimension_C &dimension ) {
x = 0;
y = 0;
w = dimension.w;
h = dimension.h;
}
DFBRectangle( const DFBPoint_C &point, const DFBDimension_C &dimension ) {
x = point.x;
y = point.y;
w = dimension.w;
h = dimension.h;
}
bool operator== ( const DFBRectangle &ref ) const {
return ref.x == x && ref.y == y && ref.w == w && ref.h == h;
}
DFBRectangle& operator-= ( const DFBPoint &sub ) {
x -= sub.x;
y -= sub.y;
return *this;
}
DFBRectangle operator -( const DFBPoint &sub ) const {
return DFBRectangle( x - sub.x, y - sub.y, w, h );
}
DFBRectangle operator +( const DFBPoint &offset ) const {
DFBRectangle r( *this );
r.x += offset.x;
r.y += offset.y;
return r;
}
};
class DFBRegion : public DFBRegion_C {
public:
DFBRegion() {
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
}
DFBRegion( const int &_x1, const int &_y1, const int &_x2, const int &_y2 ) {
x1 = _x1;
y1 = _y1;
x2 = _x2;
y2 = _y2;
}
DFBRegion( const DFBRegion_C &region ) {
x1 = region.x1;
y1 = region.y1;
x2 = region.x2;
y2 = region.y2;
}
DFBRegion( const DFBRectangle_C &rectangle ) {
x1 = rectangle.x;
y1 = rectangle.y;
x2 = x1 + rectangle.w - 1;
y2 = y1 + rectangle.h - 1;
}
DFBRegion( const DFBDimension_C &dimension ) {
x1 = 0;
y1 = 0;
x2 = dimension.w - 1;
y2 = dimension.h - 1;
}
DFBRegion( const DFBPoint_C &point, const DFBDimension_C &dimension ) {
x1 = point.x;
y1 = point.y;
x2 = x1 + dimension.w - 1;
y2 = y1 + dimension.h - 1;
}
int width() const {
return x2 - x1 + 1;
}
int height() const {
return y2 - y1 + 1;
}
void translate( int x, int y ) {
x1 += x;
y1 += y;
x2 += x;
y2 += y;
}
bool operator== ( const DFBRegion &ref ) const {
return ref.x1 == x1 && ref.y1 == y1 && ref.x2 == x2 && ref.y2 == y2;
}
DFBRegion& operator-= ( const DFBPoint &sub ) {
x1 -= sub.x;
y1 -= sub.y;
x2 -= sub.x;
y2 -= sub.y;
return *this;
}
DFBRegion operator- ( const DFBPoint &sub ) const {
return DFBRegion( x1 - sub.x, y1 - sub.y, x2 - sub.x, y2 - sub.y );
}
DFBRegion& operator|= ( const DFBRegion &r ) {
unionWith( r );
return *this;
}
void unionWith( const DFBRegion &r ) {
if (r.x1 < x1)
x1 = r.x1;
if (r.y1 < y1)
y1 = r.y1;
if (r.x2 > x2)
x2 = r.x2;
if (r.y2 > y2)
y2 = r.y2;
}
DFBRegion& operator&= ( const DFBRegion &r ) {
clipBy( r );
return *this;
}
void clipBy( const DFBRegion &r ) {
if (r.x1 > x1)
x1 = r.x1;
if (r.y1 > y1)
y1 = r.y1;
if (r.x2 < x2)
x2 = r.x2;
if (r.y2 < y2)
y2 = r.y2;
}
};
class DFBUpdates : public DFBUpdates_C {
private:
// int max_regions;
// DFBRegion *regions;
public:
DFBUpdates( int max_regions = 8 )
// :
// max_regions( max_regions )
{
regions = new DFBRegion[max_regions];
if (regions)
dfb_updates_init( this, regions, max_regions );
else
D_OOM();
}
~DFBUpdates()
{
if (regions) {
dfb_updates_deinit( this );
delete regions;
}
}
void Reset()
{
D_ASSERT( regions != NULL );
dfb_updates_reset( this );
}
DFBUpdates& operator|= ( const DFBRegion &r )
{
D_ASSERT( regions != NULL );
dfb_updates_add( this, &r );
return *this;
}
};
#define DFB_ADD_SURFACE_DESC(d,f) (d) = static_cast<DFBSurfaceDescriptionFlags> ((d) | (f))
#define DFB_ADD_SURFACE_CAPS(c,f) (c) = static_cast<DFBSurfaceCapabilities> ((c) | (f))
#define DFB_ADD_DRAWING_FLAG(d,f) (d) = static_cast<DFBSurfaceDrawingFlags> ((d) | (f))
#define DFB_ADD_BLITTING_FLAG(b,f) (b) = static_cast<DFBSurfaceBlittingFlags> ((b) | (f))
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
/*
(c) Copyright 2001-2010 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECTFB_BUILD_H__
#define __DIRECTFB_BUILD_H__
#define DIRECTFB_BUILD_ONE (0)
#define DIRECTFB_BUILD_VOODOO (0)
#define DIRECTFB_BUILD_PURE_VOODOO (0)
#endif /* __DIRECTFB_BUILD_H__ */

View File

@ -0,0 +1,174 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECTFB_GRAPHICS_H__
#define __DIRECTFB_GRAPHICS_H__
#include <directfb.h>
#include <directfb_water.h>
#ifdef __cplusplus
extern "C"
{
#endif
/*
* The DirectFB Graphics interface version.
*/
#define DIRECTFB_GRAPHICS_INTERFACE_VERSION 1
/*
* Window stack extension.
*/
DECLARE_INTERFACE( IDirectFBGraphics )
typedef u32 DFBGraphicsEngineID;
typedef struct {
bool software;
unsigned int cores;
DFBAccelerationMask clipping;
DFBSurfaceRenderOptions render_options;
unsigned int max_scale_down_x;
unsigned int max_scale_down_y;
unsigned int max_operations;
WaterTransformType transforms;
} DFBGraphicsEngineCapabilities;
typedef enum {
DGEDF_NONE = 0x00000000,
DGEDF_CAPS = 0x00000001,
DGEDF_ALL = 0x00000001,
} DFBGraphicsEngineDescriptionFlags;
#define DFB_GRAPHICS_ENGINE_DESC_NAME_LENGTH 64
typedef struct {
DFBGraphicsEngineDescriptionFlags flags;
char name[DFB_GRAPHICS_ENGINE_DESC_NAME_LENGTH];
DFBGraphicsEngineCapabilities caps;
} DFBGraphicsEngineDescription;
typedef enum {
DGESF_NONE = 0x00000000,
DGESF_USAGE = 0x00000001,
DGESF_ALL = 0x00000001,
} DFBGraphicsEngineStatusFlags;
typedef struct {
DFBGraphicsEngineStatusFlags flags;
u32 cores; // cores covered by this status, e.g. all or a single one
u32 usage; // 16.16 percentage
} DFBGraphicsEngineStatus;
/*
* Called for each existing graphics engine.
*/
typedef DFBEnumerationResult (*DFBGraphicsEngineCallback) (
void *context,
DFBGraphicsEngineID engine_id,
const DFBGraphicsEngineDescription *desc
);
/********************
* IDirectFBGraphics *
********************/
/*
* <i>No summary yet...</i>
*/
DEFINE_INTERFACE( IDirectFBGraphics,
/** Register **/
/*
* Registers a new graphics engine.
*/
DFBResult (*RegisterEngine) (
IDirectFBGraphics *thiz,
void *engine
);
/*
* Unregisters a graphics engine.
*/
DFBResult (*UnregisterEngine) (
IDirectFBGraphics *thiz,
void *engine
);
/** Enumerate **/
/*
* Enumerates all registered graphics engines.
*/
DFBResult (*EnumEngines) (
IDirectFBGraphics *thiz,
DFBGraphicsEngineCallback callback,
void *context
);
/** Status **/
/*
* Returns status of graphics engine.
*/
DFBResult (*GetEngineStatus) (
IDirectFBGraphics *thiz,
DFBGraphicsEngineID engine_id,
unsigned int core_index,
DFBGraphicsEngineStatus *ret_status
);
)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,836 @@
/*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Shimokawa <andi@directfb.org>,
Marek Pikarski <mass@directfb.org>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECTFB_KEYBOARD_H__
#define __DIRECTFB_KEYBOARD_H__
#ifdef __cplusplus
extern "C"
{
#endif
/*
* DirectFB key types (for advanced mapping)
*/
typedef enum {
DIKT_UNICODE = 0x0000, /* Unicode 3.x character
(compatible to Latin-1) */
DIKT_SPECIAL = 0xF000, /* Special key (e.g. Cursor Up or Menu) */
DIKT_FUNCTION = 0xF100, /* Function key (F1 - Fn) */
DIKT_MODIFIER = 0xF200, /* Modifier key */
DIKT_LOCK = 0xF300, /* Lock key (e.g. CapsLock) */
DIKT_DEAD = 0xF400, /* Dead key (e.g. dead grave) */
DIKT_CUSTOM = 0xF500, /* Custom key (vendor specific) */
DIKT_IDENTIFIER = 0xF600 /* DirectFB key identifier */
} DFBInputDeviceKeyType;
#define DFB_KEY(type,index) ((DIKT_##type) | (index))
#define DFB_KEY_TYPE(symbol) ((((symbol) & ~0xFFF) == 0xF000) ? (symbol) & 0xFF00 : DIKT_UNICODE)
#define DFB_KEY_INDEX(symbol) ((symbol) & 0x00FF)
#define DFB_KEY_IS_ASCII(symbol) ((symbol) < 128)
#define DFB_FUNCTION_KEY(n) (DFB_KEY( FUNCTION, n ))
#define DFB_MODIFIER_KEY(i) (DFB_KEY( MODIFIER, (1 << i) ))
#define DFB_CUSTOM_KEY(n) (DFB_KEY( CUSTOM, n ))
#define DFB_LOWER_CASE(symbol) (((symbol) >= 'A' && (symbol) <= 'Z') ?\
((symbol) | 0x20) : (symbol))
#define DFB_UPPER_CASE(symbol) (((symbol) >= 'a' && (symbol) <= 'z') ?\
((symbol) & ~0x20) : (symbol))
/*
* DirectFB modifier key identifiers (for advanced mapping)
*/
typedef enum {
DIMKI_SHIFT, /* Shift modifier key */
DIMKI_CONTROL, /* Control modifier key */
DIMKI_ALT, /* Alt modifier key */
DIMKI_ALTGR, /* AltGr modifier key */
DIMKI_META, /* Meta modifier key */
DIMKI_SUPER, /* Super modifier key */
DIMKI_HYPER, /* Hyper modifier key */
DIMKI_FIRST = DIMKI_SHIFT,
DIMKI_LAST = DIMKI_HYPER
} DFBInputDeviceModifierKeyIdentifier;
/*
* DirectFB key identifiers (for basic mapping)
*/
typedef enum {
DIKI_UNKNOWN = DFB_KEY( IDENTIFIER, 0 ),
DIKI_A,
DIKI_B,
DIKI_C,
DIKI_D,
DIKI_E,
DIKI_F,
DIKI_G,
DIKI_H,
DIKI_I,
DIKI_J,
DIKI_K,
DIKI_L,
DIKI_M,
DIKI_N,
DIKI_O,
DIKI_P,
DIKI_Q,
DIKI_R,
DIKI_S,
DIKI_T,
DIKI_U,
DIKI_V,
DIKI_W,
DIKI_X,
DIKI_Y,
DIKI_Z,
DIKI_0,
DIKI_1,
DIKI_2,
DIKI_3,
DIKI_4,
DIKI_5,
DIKI_6,
DIKI_7,
DIKI_8,
DIKI_9,
DIKI_F1,
DIKI_F2,
DIKI_F3,
DIKI_F4,
DIKI_F5,
DIKI_F6,
DIKI_F7,
DIKI_F8,
DIKI_F9,
DIKI_F10,
DIKI_F11,
DIKI_F12,
DIKI_SHIFT_L,
DIKI_SHIFT_R,
DIKI_CONTROL_L,
DIKI_CONTROL_R,
DIKI_ALT_L,
DIKI_ALT_R,
DIKI_META_L,
DIKI_META_R,
DIKI_SUPER_L,
DIKI_SUPER_R,
DIKI_HYPER_L,
DIKI_HYPER_R,
DIKI_CAPS_LOCK,
DIKI_NUM_LOCK,
DIKI_SCROLL_LOCK,
DIKI_ESCAPE,
DIKI_LEFT,
DIKI_RIGHT,
DIKI_UP,
DIKI_DOWN,
DIKI_TAB,
DIKI_ENTER,
DIKI_SPACE,
DIKI_BACKSPACE,
DIKI_INSERT,
DIKI_DELETE,
DIKI_HOME,
DIKI_END,
DIKI_PAGE_UP,
DIKI_PAGE_DOWN,
DIKI_PRINT,
DIKI_PAUSE,
/* The labels on these keys depend on the type of keyboard.
* We've choosen the names from a US keyboard layout. The
* comments refer to the ISO 9995 terminology.
*/
DIKI_QUOTE_LEFT, /* TLDE */
DIKI_MINUS_SIGN, /* AE11 */
DIKI_EQUALS_SIGN, /* AE12 */
DIKI_BRACKET_LEFT, /* AD11 */
DIKI_BRACKET_RIGHT, /* AD12 */
DIKI_BACKSLASH, /* BKSL */
DIKI_SEMICOLON, /* AC10 */
DIKI_QUOTE_RIGHT, /* AC11 */
DIKI_COMMA, /* AB08 */
DIKI_PERIOD, /* AB09 */
DIKI_SLASH, /* AB10 */
DIKI_LESS_SIGN, /* 103rd */
DIKI_KP_DIV,
DIKI_KP_MULT,
DIKI_KP_MINUS,
DIKI_KP_PLUS,
DIKI_KP_ENTER,
DIKI_KP_SPACE,
DIKI_KP_TAB,
DIKI_KP_F1,
DIKI_KP_F2,
DIKI_KP_F3,
DIKI_KP_F4,
DIKI_KP_EQUAL,
DIKI_KP_SEPARATOR,
DIKI_KP_DECIMAL,
DIKI_KP_0,
DIKI_KP_1,
DIKI_KP_2,
DIKI_KP_3,
DIKI_KP_4,
DIKI_KP_5,
DIKI_KP_6,
DIKI_KP_7,
DIKI_KP_8,
DIKI_KP_9,
DIKI_KEYDEF_END,
DIKI_NUMBER_OF_KEYS = DIKI_KEYDEF_END - DFB_KEY( IDENTIFIER, 0 )
} DFBInputDeviceKeyIdentifier;
/*
* DirectFB key symbols (for advanced mapping)
*/
typedef enum {
/*
* Unicode excerpt - Controls and Basic Latin
*
* Any Unicode 3.x character can be used as a DirectFB key symbol,
* the values of this enum are compatible with Unicode.
*/
DIKS_NULL = DFB_KEY( UNICODE, 0x00 ),
DIKS_BACKSPACE = DFB_KEY( UNICODE, 0x08 ),
DIKS_TAB = DFB_KEY( UNICODE, 0x09 ),
DIKS_RETURN = DFB_KEY( UNICODE, 0x0D ),
DIKS_CANCEL = DFB_KEY( UNICODE, 0x18 ),
DIKS_ESCAPE = DFB_KEY( UNICODE, 0x1B ),
DIKS_SPACE = DFB_KEY( UNICODE, 0x20 ),
DIKS_EXCLAMATION_MARK = DFB_KEY( UNICODE, 0x21 ),
DIKS_QUOTATION = DFB_KEY( UNICODE, 0x22 ),
DIKS_NUMBER_SIGN = DFB_KEY( UNICODE, 0x23 ),
DIKS_DOLLAR_SIGN = DFB_KEY( UNICODE, 0x24 ),
DIKS_PERCENT_SIGN = DFB_KEY( UNICODE, 0x25 ),
DIKS_AMPERSAND = DFB_KEY( UNICODE, 0x26 ),
DIKS_APOSTROPHE = DFB_KEY( UNICODE, 0x27 ),
DIKS_PARENTHESIS_LEFT = DFB_KEY( UNICODE, 0x28 ),
DIKS_PARENTHESIS_RIGHT = DFB_KEY( UNICODE, 0x29 ),
DIKS_ASTERISK = DFB_KEY( UNICODE, 0x2A ),
DIKS_PLUS_SIGN = DFB_KEY( UNICODE, 0x2B ),
DIKS_COMMA = DFB_KEY( UNICODE, 0x2C ),
DIKS_MINUS_SIGN = DFB_KEY( UNICODE, 0x2D ),
DIKS_PERIOD = DFB_KEY( UNICODE, 0x2E ),
DIKS_SLASH = DFB_KEY( UNICODE, 0x2F ),
DIKS_0 = DFB_KEY( UNICODE, 0x30 ),
DIKS_1 = DFB_KEY( UNICODE, 0x31 ),
DIKS_2 = DFB_KEY( UNICODE, 0x32 ),
DIKS_3 = DFB_KEY( UNICODE, 0x33 ),
DIKS_4 = DFB_KEY( UNICODE, 0x34 ),
DIKS_5 = DFB_KEY( UNICODE, 0x35 ),
DIKS_6 = DFB_KEY( UNICODE, 0x36 ),
DIKS_7 = DFB_KEY( UNICODE, 0x37 ),
DIKS_8 = DFB_KEY( UNICODE, 0x38 ),
DIKS_9 = DFB_KEY( UNICODE, 0x39 ),
DIKS_COLON = DFB_KEY( UNICODE, 0x3A ),
DIKS_SEMICOLON = DFB_KEY( UNICODE, 0x3B ),
DIKS_LESS_THAN_SIGN = DFB_KEY( UNICODE, 0x3C ),
DIKS_EQUALS_SIGN = DFB_KEY( UNICODE, 0x3D ),
DIKS_GREATER_THAN_SIGN = DFB_KEY( UNICODE, 0x3E ),
DIKS_QUESTION_MARK = DFB_KEY( UNICODE, 0x3F ),
DIKS_AT = DFB_KEY( UNICODE, 0x40 ),
DIKS_CAPITAL_A = DFB_KEY( UNICODE, 0x41 ),
DIKS_CAPITAL_B = DFB_KEY( UNICODE, 0x42 ),
DIKS_CAPITAL_C = DFB_KEY( UNICODE, 0x43 ),
DIKS_CAPITAL_D = DFB_KEY( UNICODE, 0x44 ),
DIKS_CAPITAL_E = DFB_KEY( UNICODE, 0x45 ),
DIKS_CAPITAL_F = DFB_KEY( UNICODE, 0x46 ),
DIKS_CAPITAL_G = DFB_KEY( UNICODE, 0x47 ),
DIKS_CAPITAL_H = DFB_KEY( UNICODE, 0x48 ),
DIKS_CAPITAL_I = DFB_KEY( UNICODE, 0x49 ),
DIKS_CAPITAL_J = DFB_KEY( UNICODE, 0x4A ),
DIKS_CAPITAL_K = DFB_KEY( UNICODE, 0x4B ),
DIKS_CAPITAL_L = DFB_KEY( UNICODE, 0x4C ),
DIKS_CAPITAL_M = DFB_KEY( UNICODE, 0x4D ),
DIKS_CAPITAL_N = DFB_KEY( UNICODE, 0x4E ),
DIKS_CAPITAL_O = DFB_KEY( UNICODE, 0x4F ),
DIKS_CAPITAL_P = DFB_KEY( UNICODE, 0x50 ),
DIKS_CAPITAL_Q = DFB_KEY( UNICODE, 0x51 ),
DIKS_CAPITAL_R = DFB_KEY( UNICODE, 0x52 ),
DIKS_CAPITAL_S = DFB_KEY( UNICODE, 0x53 ),
DIKS_CAPITAL_T = DFB_KEY( UNICODE, 0x54 ),
DIKS_CAPITAL_U = DFB_KEY( UNICODE, 0x55 ),
DIKS_CAPITAL_V = DFB_KEY( UNICODE, 0x56 ),
DIKS_CAPITAL_W = DFB_KEY( UNICODE, 0x57 ),
DIKS_CAPITAL_X = DFB_KEY( UNICODE, 0x58 ),
DIKS_CAPITAL_Y = DFB_KEY( UNICODE, 0x59 ),
DIKS_CAPITAL_Z = DFB_KEY( UNICODE, 0x5A ),
DIKS_SQUARE_BRACKET_LEFT = DFB_KEY( UNICODE, 0x5B ),
DIKS_BACKSLASH = DFB_KEY( UNICODE, 0x5C ),
DIKS_SQUARE_BRACKET_RIGHT = DFB_KEY( UNICODE, 0x5D ),
DIKS_CIRCUMFLEX_ACCENT = DFB_KEY( UNICODE, 0x5E ),
DIKS_UNDERSCORE = DFB_KEY( UNICODE, 0x5F ),
DIKS_GRAVE_ACCENT = DFB_KEY( UNICODE, 0x60 ),
DIKS_SMALL_A = DFB_KEY( UNICODE, 0x61 ),
DIKS_SMALL_B = DFB_KEY( UNICODE, 0x62 ),
DIKS_SMALL_C = DFB_KEY( UNICODE, 0x63 ),
DIKS_SMALL_D = DFB_KEY( UNICODE, 0x64 ),
DIKS_SMALL_E = DFB_KEY( UNICODE, 0x65 ),
DIKS_SMALL_F = DFB_KEY( UNICODE, 0x66 ),
DIKS_SMALL_G = DFB_KEY( UNICODE, 0x67 ),
DIKS_SMALL_H = DFB_KEY( UNICODE, 0x68 ),
DIKS_SMALL_I = DFB_KEY( UNICODE, 0x69 ),
DIKS_SMALL_J = DFB_KEY( UNICODE, 0x6A ),
DIKS_SMALL_K = DFB_KEY( UNICODE, 0x6B ),
DIKS_SMALL_L = DFB_KEY( UNICODE, 0x6C ),
DIKS_SMALL_M = DFB_KEY( UNICODE, 0x6D ),
DIKS_SMALL_N = DFB_KEY( UNICODE, 0x6E ),
DIKS_SMALL_O = DFB_KEY( UNICODE, 0x6F ),
DIKS_SMALL_P = DFB_KEY( UNICODE, 0x70 ),
DIKS_SMALL_Q = DFB_KEY( UNICODE, 0x71 ),
DIKS_SMALL_R = DFB_KEY( UNICODE, 0x72 ),
DIKS_SMALL_S = DFB_KEY( UNICODE, 0x73 ),
DIKS_SMALL_T = DFB_KEY( UNICODE, 0x74 ),
DIKS_SMALL_U = DFB_KEY( UNICODE, 0x75 ),
DIKS_SMALL_V = DFB_KEY( UNICODE, 0x76 ),
DIKS_SMALL_W = DFB_KEY( UNICODE, 0x77 ),
DIKS_SMALL_X = DFB_KEY( UNICODE, 0x78 ),
DIKS_SMALL_Y = DFB_KEY( UNICODE, 0x79 ),
DIKS_SMALL_Z = DFB_KEY( UNICODE, 0x7A ),
DIKS_CURLY_BRACKET_LEFT = DFB_KEY( UNICODE, 0x7B ),
DIKS_VERTICAL_BAR = DFB_KEY( UNICODE, 0x7C ),
DIKS_CURLY_BRACKET_RIGHT = DFB_KEY( UNICODE, 0x7D ),
DIKS_TILDE = DFB_KEY( UNICODE, 0x7E ),
DIKS_DELETE = DFB_KEY( UNICODE, 0x7F ),
DIKS_ENTER = DIKS_RETURN,
/*
* Unicode private area - DirectFB Special keys
*/
DIKS_CURSOR_LEFT = DFB_KEY( SPECIAL, 0x00 ),
DIKS_CURSOR_RIGHT = DFB_KEY( SPECIAL, 0x01 ),
DIKS_CURSOR_UP = DFB_KEY( SPECIAL, 0x02 ),
DIKS_CURSOR_DOWN = DFB_KEY( SPECIAL, 0x03 ),
DIKS_INSERT = DFB_KEY( SPECIAL, 0x04 ),
DIKS_HOME = DFB_KEY( SPECIAL, 0x05 ),
DIKS_END = DFB_KEY( SPECIAL, 0x06 ),
DIKS_PAGE_UP = DFB_KEY( SPECIAL, 0x07 ),
DIKS_PAGE_DOWN = DFB_KEY( SPECIAL, 0x08 ),
DIKS_PRINT = DFB_KEY( SPECIAL, 0x09 ),
DIKS_PAUSE = DFB_KEY( SPECIAL, 0x0A ),
DIKS_OK = DFB_KEY( SPECIAL, 0x0B ),
DIKS_SELECT = DFB_KEY( SPECIAL, 0x0C ),
DIKS_GOTO = DFB_KEY( SPECIAL, 0x0D ),
DIKS_CLEAR = DFB_KEY( SPECIAL, 0x0E ),
DIKS_POWER = DFB_KEY( SPECIAL, 0x0F ),
DIKS_POWER2 = DFB_KEY( SPECIAL, 0x10 ),
DIKS_OPTION = DFB_KEY( SPECIAL, 0x11 ),
DIKS_MENU = DFB_KEY( SPECIAL, 0x12 ),
DIKS_HELP = DFB_KEY( SPECIAL, 0x13 ),
DIKS_INFO = DFB_KEY( SPECIAL, 0x14 ),
DIKS_TIME = DFB_KEY( SPECIAL, 0x15 ),
DIKS_VENDOR = DFB_KEY( SPECIAL, 0x16 ),
DIKS_ARCHIVE = DFB_KEY( SPECIAL, 0x17 ),
DIKS_PROGRAM = DFB_KEY( SPECIAL, 0x18 ),
DIKS_CHANNEL = DFB_KEY( SPECIAL, 0x19 ),
DIKS_FAVORITES = DFB_KEY( SPECIAL, 0x1A ),
DIKS_EPG = DFB_KEY( SPECIAL, 0x1B ),
DIKS_PVR = DFB_KEY( SPECIAL, 0x1C ),
DIKS_MHP = DFB_KEY( SPECIAL, 0x1D ),
DIKS_LANGUAGE = DFB_KEY( SPECIAL, 0x1E ),
DIKS_TITLE = DFB_KEY( SPECIAL, 0x1F ),
DIKS_SUBTITLE = DFB_KEY( SPECIAL, 0x20 ),
DIKS_ANGLE = DFB_KEY( SPECIAL, 0x21 ),
DIKS_ZOOM = DFB_KEY( SPECIAL, 0x22 ),
DIKS_MODE = DFB_KEY( SPECIAL, 0x23 ),
DIKS_KEYBOARD = DFB_KEY( SPECIAL, 0x24 ),
DIKS_PC = DFB_KEY( SPECIAL, 0x25 ),
DIKS_SCREEN = DFB_KEY( SPECIAL, 0x26 ),
DIKS_TV = DFB_KEY( SPECIAL, 0x27 ),
DIKS_TV2 = DFB_KEY( SPECIAL, 0x28 ),
DIKS_VCR = DFB_KEY( SPECIAL, 0x29 ),
DIKS_VCR2 = DFB_KEY( SPECIAL, 0x2A ),
DIKS_SAT = DFB_KEY( SPECIAL, 0x2B ),
DIKS_SAT2 = DFB_KEY( SPECIAL, 0x2C ),
DIKS_CD = DFB_KEY( SPECIAL, 0x2D ),
DIKS_TAPE = DFB_KEY( SPECIAL, 0x2E ),
DIKS_RADIO = DFB_KEY( SPECIAL, 0x2F ),
DIKS_TUNER = DFB_KEY( SPECIAL, 0x30 ),
DIKS_PLAYER = DFB_KEY( SPECIAL, 0x31 ),
DIKS_TEXT = DFB_KEY( SPECIAL, 0x32 ),
DIKS_DVD = DFB_KEY( SPECIAL, 0x33 ),
DIKS_AUX = DFB_KEY( SPECIAL, 0x34 ),
DIKS_MP3 = DFB_KEY( SPECIAL, 0x35 ),
DIKS_PHONE = DFB_KEY( SPECIAL, 0x36 ),
DIKS_AUDIO = DFB_KEY( SPECIAL, 0x37 ),
DIKS_VIDEO = DFB_KEY( SPECIAL, 0x38 ),
DIKS_INTERNET = DFB_KEY( SPECIAL, 0x39 ),
DIKS_MAIL = DFB_KEY( SPECIAL, 0x3A ),
DIKS_NEWS = DFB_KEY( SPECIAL, 0x3B ),
DIKS_DIRECTORY = DFB_KEY( SPECIAL, 0x3C ),
DIKS_LIST = DFB_KEY( SPECIAL, 0x3D ),
DIKS_CALCULATOR = DFB_KEY( SPECIAL, 0x3E ),
DIKS_MEMO = DFB_KEY( SPECIAL, 0x3F ),
DIKS_CALENDAR = DFB_KEY( SPECIAL, 0x40 ),
DIKS_EDITOR = DFB_KEY( SPECIAL, 0x41 ),
DIKS_RED = DFB_KEY( SPECIAL, 0x42 ),
DIKS_GREEN = DFB_KEY( SPECIAL, 0x43 ),
DIKS_YELLOW = DFB_KEY( SPECIAL, 0x44 ),
DIKS_BLUE = DFB_KEY( SPECIAL, 0x45 ),
DIKS_CHANNEL_UP = DFB_KEY( SPECIAL, 0x46 ),
DIKS_CHANNEL_DOWN = DFB_KEY( SPECIAL, 0x47 ),
DIKS_BACK = DFB_KEY( SPECIAL, 0x48 ),
DIKS_FORWARD = DFB_KEY( SPECIAL, 0x49 ),
DIKS_FIRST = DFB_KEY( SPECIAL, 0x4A ),
DIKS_LAST = DFB_KEY( SPECIAL, 0x4B ),
DIKS_VOLUME_UP = DFB_KEY( SPECIAL, 0x4C ),
DIKS_VOLUME_DOWN = DFB_KEY( SPECIAL, 0x4D ),
DIKS_MUTE = DFB_KEY( SPECIAL, 0x4E ),
DIKS_AB = DFB_KEY( SPECIAL, 0x4F ),
DIKS_PLAYPAUSE = DFB_KEY( SPECIAL, 0x50 ),
DIKS_PLAY = DFB_KEY( SPECIAL, 0x51 ),
DIKS_STOP = DFB_KEY( SPECIAL, 0x52 ),
DIKS_RESTART = DFB_KEY( SPECIAL, 0x53 ),
DIKS_SLOW = DFB_KEY( SPECIAL, 0x54 ),
DIKS_FAST = DFB_KEY( SPECIAL, 0x55 ),
DIKS_RECORD = DFB_KEY( SPECIAL, 0x56 ),
DIKS_EJECT = DFB_KEY( SPECIAL, 0x57 ),
DIKS_SHUFFLE = DFB_KEY( SPECIAL, 0x58 ),
DIKS_REWIND = DFB_KEY( SPECIAL, 0x59 ),
DIKS_FASTFORWARD = DFB_KEY( SPECIAL, 0x5A ),
DIKS_PREVIOUS = DFB_KEY( SPECIAL, 0x5B ),
DIKS_NEXT = DFB_KEY( SPECIAL, 0x5C ),
DIKS_BEGIN = DFB_KEY( SPECIAL, 0x5D ),
DIKS_DIGITS = DFB_KEY( SPECIAL, 0x5E ),
DIKS_TEEN = DFB_KEY( SPECIAL, 0x5F ),
DIKS_TWEN = DFB_KEY( SPECIAL, 0x60 ),
DIKS_BREAK = DFB_KEY( SPECIAL, 0x61 ),
DIKS_EXIT = DFB_KEY( SPECIAL, 0x62 ),
DIKS_SETUP = DFB_KEY( SPECIAL, 0x63 ),
DIKS_CURSOR_LEFT_UP = DFB_KEY( SPECIAL, 0x64 ),
DIKS_CURSOR_LEFT_DOWN = DFB_KEY( SPECIAL, 0x65 ),
DIKS_CURSOR_UP_RIGHT = DFB_KEY( SPECIAL, 0x66 ),
DIKS_CURSOR_DOWN_RIGHT = DFB_KEY( SPECIAL, 0x67 ),
DIKS_PIP = DFB_KEY( SPECIAL, 0x68 ),
DIKS_SWAP = DFB_KEY( SPECIAL, 0x69 ),
DIKS_FREEZE = DFB_KEY( SPECIAL, 0x6A ),
DIKS_MOVE = DFB_KEY( SPECIAL, 0x6B ),
DIKS_CALL = DFB_KEY( SPECIAL, 0x6C ),
DIKS_SPEAKER = DFB_KEY( SPECIAL, 0x6D ),
DIKS_SAVE = DFB_KEY( SPECIAL, 0x6E ),
DIKS_REDIAL = DFB_KEY( SPECIAL, 0x6F ),
DIKS_FLASH = DFB_KEY( SPECIAL, 0x70 ),
DIKS_HOLD = DFB_KEY( SPECIAL, 0x71 ),
/*
* Unicode private area - DirectFB Function keys
*
* More function keys are available via DFB_FUNCTION_KEY(n).
*/
DIKS_F1 = DFB_FUNCTION_KEY( 1 ),
DIKS_F2 = DFB_FUNCTION_KEY( 2 ),
DIKS_F3 = DFB_FUNCTION_KEY( 3 ),
DIKS_F4 = DFB_FUNCTION_KEY( 4 ),
DIKS_F5 = DFB_FUNCTION_KEY( 5 ),
DIKS_F6 = DFB_FUNCTION_KEY( 6 ),
DIKS_F7 = DFB_FUNCTION_KEY( 7 ),
DIKS_F8 = DFB_FUNCTION_KEY( 8 ),
DIKS_F9 = DFB_FUNCTION_KEY( 9 ),
DIKS_F10 = DFB_FUNCTION_KEY( 10 ),
DIKS_F11 = DFB_FUNCTION_KEY( 11 ),
DIKS_F12 = DFB_FUNCTION_KEY( 12 ),
/*
* Unicode private area - DirectFB Modifier keys
*/
DIKS_SHIFT = DFB_MODIFIER_KEY( DIMKI_SHIFT ),
DIKS_CONTROL = DFB_MODIFIER_KEY( DIMKI_CONTROL ),
DIKS_ALT = DFB_MODIFIER_KEY( DIMKI_ALT ),
DIKS_ALTGR = DFB_MODIFIER_KEY( DIMKI_ALTGR ),
DIKS_META = DFB_MODIFIER_KEY( DIMKI_META ),
DIKS_SUPER = DFB_MODIFIER_KEY( DIMKI_SUPER ),
DIKS_HYPER = DFB_MODIFIER_KEY( DIMKI_HYPER ),
/*
* Unicode private area - DirectFB Lock keys
*/
DIKS_CAPS_LOCK = DFB_KEY( LOCK, 0x00 ),
DIKS_NUM_LOCK = DFB_KEY( LOCK, 0x01 ),
DIKS_SCROLL_LOCK = DFB_KEY( LOCK, 0x02 ),
/*
* Unicode private area - DirectFB Dead keys
*/
DIKS_DEAD_ABOVEDOT = DFB_KEY( DEAD, 0x00 ),
DIKS_DEAD_ABOVERING = DFB_KEY( DEAD, 0x01 ),
DIKS_DEAD_ACUTE = DFB_KEY( DEAD, 0x02 ),
DIKS_DEAD_BREVE = DFB_KEY( DEAD, 0x03 ),
DIKS_DEAD_CARON = DFB_KEY( DEAD, 0x04 ),
DIKS_DEAD_CEDILLA = DFB_KEY( DEAD, 0x05 ),
DIKS_DEAD_CIRCUMFLEX = DFB_KEY( DEAD, 0x06 ),
DIKS_DEAD_DIAERESIS = DFB_KEY( DEAD, 0x07 ),
DIKS_DEAD_DOUBLEACUTE = DFB_KEY( DEAD, 0x08 ),
DIKS_DEAD_GRAVE = DFB_KEY( DEAD, 0x09 ),
DIKS_DEAD_IOTA = DFB_KEY( DEAD, 0x0A ),
DIKS_DEAD_MACRON = DFB_KEY( DEAD, 0x0B ),
DIKS_DEAD_OGONEK = DFB_KEY( DEAD, 0x0C ),
DIKS_DEAD_SEMIVOICED_SOUND = DFB_KEY( DEAD, 0x0D ),
DIKS_DEAD_TILDE = DFB_KEY( DEAD, 0x0E ),
DIKS_DEAD_VOICED_SOUND = DFB_KEY( DEAD, 0x0F ),
/*
* Unicode private area - DirectFB Custom keys
*
* More custom keys are available via DFB_CUSTOM_KEY(n).
*/
DIKS_CUSTOM0 = DFB_CUSTOM_KEY( 0 ),
DIKS_CUSTOM1 = DFB_CUSTOM_KEY( 1 ),
DIKS_CUSTOM2 = DFB_CUSTOM_KEY( 2 ),
DIKS_CUSTOM3 = DFB_CUSTOM_KEY( 3 ),
DIKS_CUSTOM4 = DFB_CUSTOM_KEY( 4 ),
DIKS_CUSTOM5 = DFB_CUSTOM_KEY( 5 ),
DIKS_CUSTOM6 = DFB_CUSTOM_KEY( 6 ),
DIKS_CUSTOM7 = DFB_CUSTOM_KEY( 7 ),
DIKS_CUSTOM8 = DFB_CUSTOM_KEY( 8 ),
DIKS_CUSTOM9 = DFB_CUSTOM_KEY( 9 ),
DIKS_CUSTOM10 = DFB_CUSTOM_KEY( 10 ),
DIKS_CUSTOM11 = DFB_CUSTOM_KEY( 11 ),
DIKS_CUSTOM12 = DFB_CUSTOM_KEY( 12 ),
DIKS_CUSTOM13 = DFB_CUSTOM_KEY( 13 ),
DIKS_CUSTOM14 = DFB_CUSTOM_KEY( 14 ),
DIKS_CUSTOM15 = DFB_CUSTOM_KEY( 15 ),
DIKS_CUSTOM16 = DFB_CUSTOM_KEY( 16 ),
DIKS_CUSTOM17 = DFB_CUSTOM_KEY( 17 ),
DIKS_CUSTOM18 = DFB_CUSTOM_KEY( 18 ),
DIKS_CUSTOM19 = DFB_CUSTOM_KEY( 19 ),
DIKS_CUSTOM20 = DFB_CUSTOM_KEY( 20 ),
DIKS_CUSTOM21 = DFB_CUSTOM_KEY( 21 ),
DIKS_CUSTOM22 = DFB_CUSTOM_KEY( 22 ),
DIKS_CUSTOM23 = DFB_CUSTOM_KEY( 23 ),
DIKS_CUSTOM24 = DFB_CUSTOM_KEY( 24 ),
DIKS_CUSTOM25 = DFB_CUSTOM_KEY( 25 ),
DIKS_CUSTOM26 = DFB_CUSTOM_KEY( 26 ),
DIKS_CUSTOM27 = DFB_CUSTOM_KEY( 27 ),
DIKS_CUSTOM28 = DFB_CUSTOM_KEY( 28 ),
DIKS_CUSTOM29 = DFB_CUSTOM_KEY( 29 ),
DIKS_CUSTOM30 = DFB_CUSTOM_KEY( 30 ),
DIKS_CUSTOM31 = DFB_CUSTOM_KEY( 31 ),
DIKS_CUSTOM32 = DFB_CUSTOM_KEY( 32 ),
DIKS_CUSTOM33 = DFB_CUSTOM_KEY( 33 ),
DIKS_CUSTOM34 = DFB_CUSTOM_KEY( 34 ),
DIKS_CUSTOM35 = DFB_CUSTOM_KEY( 35 ),
DIKS_CUSTOM36 = DFB_CUSTOM_KEY( 36 ),
DIKS_CUSTOM37 = DFB_CUSTOM_KEY( 37 ),
DIKS_CUSTOM38 = DFB_CUSTOM_KEY( 38 ),
DIKS_CUSTOM39 = DFB_CUSTOM_KEY( 39 ),
DIKS_CUSTOM40 = DFB_CUSTOM_KEY( 40 ),
DIKS_CUSTOM41 = DFB_CUSTOM_KEY( 41 ),
DIKS_CUSTOM42 = DFB_CUSTOM_KEY( 42 ),
DIKS_CUSTOM43 = DFB_CUSTOM_KEY( 43 ),
DIKS_CUSTOM44 = DFB_CUSTOM_KEY( 44 ),
DIKS_CUSTOM45 = DFB_CUSTOM_KEY( 45 ),
DIKS_CUSTOM46 = DFB_CUSTOM_KEY( 46 ),
DIKS_CUSTOM47 = DFB_CUSTOM_KEY( 47 ),
DIKS_CUSTOM48 = DFB_CUSTOM_KEY( 48 ),
DIKS_CUSTOM49 = DFB_CUSTOM_KEY( 49 ),
DIKS_CUSTOM50 = DFB_CUSTOM_KEY( 50 ),
DIKS_CUSTOM51 = DFB_CUSTOM_KEY( 51 ),
DIKS_CUSTOM52 = DFB_CUSTOM_KEY( 52 ),
DIKS_CUSTOM53 = DFB_CUSTOM_KEY( 53 ),
DIKS_CUSTOM54 = DFB_CUSTOM_KEY( 54 ),
DIKS_CUSTOM55 = DFB_CUSTOM_KEY( 55 ),
DIKS_CUSTOM56 = DFB_CUSTOM_KEY( 56 ),
DIKS_CUSTOM57 = DFB_CUSTOM_KEY( 57 ),
DIKS_CUSTOM58 = DFB_CUSTOM_KEY( 58 ),
DIKS_CUSTOM59 = DFB_CUSTOM_KEY( 59 ),
DIKS_CUSTOM60 = DFB_CUSTOM_KEY( 60 ),
DIKS_CUSTOM61 = DFB_CUSTOM_KEY( 61 ),
DIKS_CUSTOM62 = DFB_CUSTOM_KEY( 62 ),
DIKS_CUSTOM63 = DFB_CUSTOM_KEY( 63 ),
DIKS_CUSTOM64 = DFB_CUSTOM_KEY( 64 ),
DIKS_CUSTOM65 = DFB_CUSTOM_KEY( 65 ),
DIKS_CUSTOM66 = DFB_CUSTOM_KEY( 66 ),
DIKS_CUSTOM67 = DFB_CUSTOM_KEY( 67 ),
DIKS_CUSTOM68 = DFB_CUSTOM_KEY( 68 ),
DIKS_CUSTOM69 = DFB_CUSTOM_KEY( 69 ),
DIKS_CUSTOM70 = DFB_CUSTOM_KEY( 70 ),
DIKS_CUSTOM71 = DFB_CUSTOM_KEY( 71 ),
DIKS_CUSTOM72 = DFB_CUSTOM_KEY( 72 ),
DIKS_CUSTOM73 = DFB_CUSTOM_KEY( 73 ),
DIKS_CUSTOM74 = DFB_CUSTOM_KEY( 74 ),
DIKS_CUSTOM75 = DFB_CUSTOM_KEY( 75 ),
DIKS_CUSTOM76 = DFB_CUSTOM_KEY( 76 ),
DIKS_CUSTOM77 = DFB_CUSTOM_KEY( 77 ),
DIKS_CUSTOM78 = DFB_CUSTOM_KEY( 78 ),
DIKS_CUSTOM79 = DFB_CUSTOM_KEY( 79 ),
DIKS_CUSTOM80 = DFB_CUSTOM_KEY( 80 ),
DIKS_CUSTOM81 = DFB_CUSTOM_KEY( 81 ),
DIKS_CUSTOM82 = DFB_CUSTOM_KEY( 82 ),
DIKS_CUSTOM83 = DFB_CUSTOM_KEY( 83 ),
DIKS_CUSTOM84 = DFB_CUSTOM_KEY( 84 ),
DIKS_CUSTOM85 = DFB_CUSTOM_KEY( 85 ),
DIKS_CUSTOM86 = DFB_CUSTOM_KEY( 86 ),
DIKS_CUSTOM87 = DFB_CUSTOM_KEY( 87 ),
DIKS_CUSTOM88 = DFB_CUSTOM_KEY( 88 ),
DIKS_CUSTOM89 = DFB_CUSTOM_KEY( 89 ),
DIKS_CUSTOM90 = DFB_CUSTOM_KEY( 90 ),
DIKS_CUSTOM91 = DFB_CUSTOM_KEY( 91 ),
DIKS_CUSTOM92 = DFB_CUSTOM_KEY( 92 ),
DIKS_CUSTOM93 = DFB_CUSTOM_KEY( 93 ),
DIKS_CUSTOM94 = DFB_CUSTOM_KEY( 94 ),
DIKS_CUSTOM95 = DFB_CUSTOM_KEY( 95 ),
DIKS_CUSTOM96 = DFB_CUSTOM_KEY( 96 ),
DIKS_CUSTOM97 = DFB_CUSTOM_KEY( 97 ),
DIKS_CUSTOM98 = DFB_CUSTOM_KEY( 98 ),
DIKS_CUSTOM99 = DFB_CUSTOM_KEY( 99 ),
DIKS_CUSTOM100 = DFB_CUSTOM_KEY( 100 ),
DIKS_CUSTOM101 = DFB_CUSTOM_KEY( 101 ),
DIKS_CUSTOM102 = DFB_CUSTOM_KEY( 102 ),
DIKS_CUSTOM103 = DFB_CUSTOM_KEY( 103 ),
DIKS_CUSTOM104 = DFB_CUSTOM_KEY( 104 ),
DIKS_CUSTOM105 = DFB_CUSTOM_KEY( 105 ),
DIKS_CUSTOM106 = DFB_CUSTOM_KEY( 106 ),
DIKS_CUSTOM107 = DFB_CUSTOM_KEY( 107 ),
DIKS_CUSTOM108 = DFB_CUSTOM_KEY( 108 ),
DIKS_CUSTOM109 = DFB_CUSTOM_KEY( 109 ),
DIKS_CUSTOM110 = DFB_CUSTOM_KEY( 110 ),
DIKS_CUSTOM111 = DFB_CUSTOM_KEY( 111 ),
DIKS_CUSTOM112 = DFB_CUSTOM_KEY( 112 ),
DIKS_CUSTOM113 = DFB_CUSTOM_KEY( 113 ),
DIKS_CUSTOM114 = DFB_CUSTOM_KEY( 114 ),
DIKS_CUSTOM115 = DFB_CUSTOM_KEY( 115 ),
DIKS_CUSTOM116 = DFB_CUSTOM_KEY( 116 ),
DIKS_CUSTOM117 = DFB_CUSTOM_KEY( 117 ),
DIKS_CUSTOM118 = DFB_CUSTOM_KEY( 118 ),
DIKS_CUSTOM119 = DFB_CUSTOM_KEY( 119 ),
DIKS_CUSTOM120 = DFB_CUSTOM_KEY( 120 ),
DIKS_CUSTOM121 = DFB_CUSTOM_KEY( 121 ),
DIKS_CUSTOM122 = DFB_CUSTOM_KEY( 122 ),
DIKS_CUSTOM123 = DFB_CUSTOM_KEY( 123 ),
DIKS_CUSTOM124 = DFB_CUSTOM_KEY( 124 ),
DIKS_CUSTOM125 = DFB_CUSTOM_KEY( 125 ),
DIKS_CUSTOM126 = DFB_CUSTOM_KEY( 126 ),
DIKS_CUSTOM127 = DFB_CUSTOM_KEY( 127 ),
DIKS_CUSTOM128 = DFB_CUSTOM_KEY( 128 ),
DIKS_CUSTOM129 = DFB_CUSTOM_KEY( 129 ),
DIKS_CUSTOM130 = DFB_CUSTOM_KEY( 130 ),
DIKS_CUSTOM131 = DFB_CUSTOM_KEY( 131 ),
DIKS_CUSTOM132 = DFB_CUSTOM_KEY( 132 ),
DIKS_CUSTOM133 = DFB_CUSTOM_KEY( 133 ),
DIKS_CUSTOM134 = DFB_CUSTOM_KEY( 134 ),
DIKS_CUSTOM135 = DFB_CUSTOM_KEY( 135 ),
DIKS_CUSTOM136 = DFB_CUSTOM_KEY( 136 ),
DIKS_CUSTOM137 = DFB_CUSTOM_KEY( 137 ),
DIKS_CUSTOM138 = DFB_CUSTOM_KEY( 138 ),
DIKS_CUSTOM139 = DFB_CUSTOM_KEY( 139 ),
DIKS_CUSTOM140 = DFB_CUSTOM_KEY( 140 ),
DIKS_CUSTOM141 = DFB_CUSTOM_KEY( 141 ),
DIKS_CUSTOM142 = DFB_CUSTOM_KEY( 142 ),
DIKS_CUSTOM143 = DFB_CUSTOM_KEY( 143 ),
DIKS_CUSTOM144 = DFB_CUSTOM_KEY( 144 ),
DIKS_CUSTOM145 = DFB_CUSTOM_KEY( 145 ),
DIKS_CUSTOM146 = DFB_CUSTOM_KEY( 146 ),
DIKS_CUSTOM147 = DFB_CUSTOM_KEY( 147 ),
DIKS_CUSTOM148 = DFB_CUSTOM_KEY( 148 ),
DIKS_CUSTOM149 = DFB_CUSTOM_KEY( 149 ),
DIKS_CUSTOM150 = DFB_CUSTOM_KEY( 150 ),
DIKS_CUSTOM151 = DFB_CUSTOM_KEY( 151 ),
DIKS_CUSTOM152 = DFB_CUSTOM_KEY( 152 ),
DIKS_CUSTOM153 = DFB_CUSTOM_KEY( 153 ),
DIKS_CUSTOM154 = DFB_CUSTOM_KEY( 154 ),
DIKS_CUSTOM155 = DFB_CUSTOM_KEY( 155 ),
DIKS_CUSTOM156 = DFB_CUSTOM_KEY( 156 ),
DIKS_CUSTOM157 = DFB_CUSTOM_KEY( 157 ),
DIKS_CUSTOM158 = DFB_CUSTOM_KEY( 158 ),
DIKS_CUSTOM159 = DFB_CUSTOM_KEY( 159 ),
DIKS_CUSTOM160 = DFB_CUSTOM_KEY( 160 ),
DIKS_CUSTOM161 = DFB_CUSTOM_KEY( 161 ),
DIKS_CUSTOM162 = DFB_CUSTOM_KEY( 162 ),
DIKS_CUSTOM163 = DFB_CUSTOM_KEY( 163 ),
DIKS_CUSTOM164 = DFB_CUSTOM_KEY( 164 ),
DIKS_CUSTOM165 = DFB_CUSTOM_KEY( 165 ),
DIKS_CUSTOM166 = DFB_CUSTOM_KEY( 166 ),
DIKS_CUSTOM167 = DFB_CUSTOM_KEY( 167 ),
DIKS_CUSTOM168 = DFB_CUSTOM_KEY( 168 ),
DIKS_CUSTOM169 = DFB_CUSTOM_KEY( 169 ),
DIKS_CUSTOM170 = DFB_CUSTOM_KEY( 170 ),
DIKS_CUSTOM171 = DFB_CUSTOM_KEY( 171 ),
DIKS_CUSTOM172 = DFB_CUSTOM_KEY( 172 ),
DIKS_CUSTOM173 = DFB_CUSTOM_KEY( 173 ),
DIKS_CUSTOM174 = DFB_CUSTOM_KEY( 174 ),
DIKS_CUSTOM175 = DFB_CUSTOM_KEY( 175 ),
DIKS_CUSTOM176 = DFB_CUSTOM_KEY( 176 ),
DIKS_CUSTOM177 = DFB_CUSTOM_KEY( 177 ),
DIKS_CUSTOM178 = DFB_CUSTOM_KEY( 178 ),
DIKS_CUSTOM179 = DFB_CUSTOM_KEY( 179 ),
DIKS_CUSTOM180 = DFB_CUSTOM_KEY( 180 ),
DIKS_CUSTOM181 = DFB_CUSTOM_KEY( 181 ),
DIKS_CUSTOM182 = DFB_CUSTOM_KEY( 182 ),
DIKS_CUSTOM183 = DFB_CUSTOM_KEY( 183 ),
DIKS_CUSTOM184 = DFB_CUSTOM_KEY( 184 ),
DIKS_CUSTOM185 = DFB_CUSTOM_KEY( 185 ),
DIKS_CUSTOM186 = DFB_CUSTOM_KEY( 186 ),
DIKS_CUSTOM187 = DFB_CUSTOM_KEY( 187 ),
DIKS_CUSTOM188 = DFB_CUSTOM_KEY( 188 ),
DIKS_CUSTOM189 = DFB_CUSTOM_KEY( 189 ),
DIKS_CUSTOM190 = DFB_CUSTOM_KEY( 190 ),
DIKS_CUSTOM191 = DFB_CUSTOM_KEY( 191 ),
DIKS_CUSTOM192 = DFB_CUSTOM_KEY( 192 ),
DIKS_CUSTOM193 = DFB_CUSTOM_KEY( 193 ),
DIKS_CUSTOM194 = DFB_CUSTOM_KEY( 194 ),
DIKS_CUSTOM195 = DFB_CUSTOM_KEY( 195 ),
DIKS_CUSTOM196 = DFB_CUSTOM_KEY( 196 ),
DIKS_CUSTOM197 = DFB_CUSTOM_KEY( 197 ),
DIKS_CUSTOM198 = DFB_CUSTOM_KEY( 198 ),
DIKS_CUSTOM199 = DFB_CUSTOM_KEY( 199 ),
DIKS_CUSTOM200 = DFB_CUSTOM_KEY( 200 ),
DIKS_CUSTOM201 = DFB_CUSTOM_KEY( 201 ),
DIKS_CUSTOM202 = DFB_CUSTOM_KEY( 202 ),
DIKS_CUSTOM203 = DFB_CUSTOM_KEY( 203 ),
DIKS_CUSTOM204 = DFB_CUSTOM_KEY( 204 ),
DIKS_CUSTOM205 = DFB_CUSTOM_KEY( 205 ),
DIKS_CUSTOM206 = DFB_CUSTOM_KEY( 206 ),
DIKS_CUSTOM207 = DFB_CUSTOM_KEY( 207 ),
DIKS_CUSTOM208 = DFB_CUSTOM_KEY( 208 ),
DIKS_CUSTOM209 = DFB_CUSTOM_KEY( 209 ),
DIKS_CUSTOM210 = DFB_CUSTOM_KEY( 210 ),
DIKS_CUSTOM211 = DFB_CUSTOM_KEY( 211 ),
DIKS_CUSTOM212 = DFB_CUSTOM_KEY( 212 ),
DIKS_CUSTOM213 = DFB_CUSTOM_KEY( 213 ),
DIKS_CUSTOM214 = DFB_CUSTOM_KEY( 214 ),
DIKS_CUSTOM215 = DFB_CUSTOM_KEY( 215 ),
DIKS_CUSTOM216 = DFB_CUSTOM_KEY( 216 ),
DIKS_CUSTOM217 = DFB_CUSTOM_KEY( 217 ),
DIKS_CUSTOM218 = DFB_CUSTOM_KEY( 218 ),
DIKS_CUSTOM219 = DFB_CUSTOM_KEY( 219 ),
DIKS_CUSTOM220 = DFB_CUSTOM_KEY( 220 ),
DIKS_CUSTOM221 = DFB_CUSTOM_KEY( 221 ),
DIKS_CUSTOM222 = DFB_CUSTOM_KEY( 222 ),
DIKS_CUSTOM223 = DFB_CUSTOM_KEY( 223 ),
DIKS_CUSTOM224 = DFB_CUSTOM_KEY( 224 ),
DIKS_CUSTOM225 = DFB_CUSTOM_KEY( 225 ),
DIKS_CUSTOM226 = DFB_CUSTOM_KEY( 226 ),
DIKS_CUSTOM227 = DFB_CUSTOM_KEY( 227 ),
DIKS_CUSTOM228 = DFB_CUSTOM_KEY( 228 ),
DIKS_CUSTOM229 = DFB_CUSTOM_KEY( 229 ),
DIKS_CUSTOM230 = DFB_CUSTOM_KEY( 230 ),
DIKS_CUSTOM231 = DFB_CUSTOM_KEY( 231 ),
DIKS_CUSTOM232 = DFB_CUSTOM_KEY( 232 ),
DIKS_CUSTOM233 = DFB_CUSTOM_KEY( 233 ),
DIKS_CUSTOM234 = DFB_CUSTOM_KEY( 234 ),
DIKS_CUSTOM235 = DFB_CUSTOM_KEY( 235 ),
DIKS_CUSTOM236 = DFB_CUSTOM_KEY( 236 ),
DIKS_CUSTOM237 = DFB_CUSTOM_KEY( 237 ),
DIKS_CUSTOM238 = DFB_CUSTOM_KEY( 238 ),
DIKS_CUSTOM239 = DFB_CUSTOM_KEY( 239 ),
DIKS_CUSTOM240 = DFB_CUSTOM_KEY( 240 ),
DIKS_CUSTOM241 = DFB_CUSTOM_KEY( 241 ),
DIKS_CUSTOM242 = DFB_CUSTOM_KEY( 242 ),
DIKS_CUSTOM243 = DFB_CUSTOM_KEY( 243 ),
DIKS_CUSTOM244 = DFB_CUSTOM_KEY( 244 ),
DIKS_CUSTOM245 = DFB_CUSTOM_KEY( 245 ),
DIKS_CUSTOM246 = DFB_CUSTOM_KEY( 246 ),
DIKS_CUSTOM247 = DFB_CUSTOM_KEY( 247 ),
DIKS_CUSTOM248 = DFB_CUSTOM_KEY( 248 ),
DIKS_CUSTOM249 = DFB_CUSTOM_KEY( 249 ),
DIKS_CUSTOM250 = DFB_CUSTOM_KEY( 250 ),
DIKS_CUSTOM251 = DFB_CUSTOM_KEY( 251 ),
DIKS_CUSTOM252 = DFB_CUSTOM_KEY( 252 ),
DIKS_CUSTOM253 = DFB_CUSTOM_KEY( 253 ),
DIKS_CUSTOM254 = DFB_CUSTOM_KEY( 254 ),
DIKS_CUSTOM255 = DFB_CUSTOM_KEY( 255 )
} DFBInputDeviceKeySymbol;
/*
* Flags specifying the key locks that are currently active.
*/
typedef enum {
DILS_SCROLL = 0x00000001, /* scroll-lock active? */
DILS_NUM = 0x00000002, /* num-lock active? */
DILS_CAPS = 0x00000004 /* caps-lock active? */
} DFBInputDeviceLockState;
/*
* Groups and levels as an index to the symbol array.
*/
typedef enum {
DIKSI_BASE = 0x00, /* base group, base level
(no modifier pressed) */
DIKSI_BASE_SHIFT = 0x01, /* base group, shifted level
(with Shift pressed) */
DIKSI_ALT = 0x02, /* alternative group, base level
(with AltGr pressed) */
DIKSI_ALT_SHIFT = 0x03, /* alternative group, shifted level
(with AltGr and Shift pressed) */
DIKSI_LAST = DIKSI_ALT_SHIFT
} DFBInputDeviceKeymapSymbolIndex;
/*
* One entry in the keymap of an input device.
*/
typedef struct {
int code; /* hardware
key code */
DFBInputDeviceLockState locks; /* locks activating
shifted level */
DFBInputDeviceKeyIdentifier identifier; /* basic mapping */
DFBInputDeviceKeySymbol symbols[DIKSI_LAST+1]; /* advanced key
mapping */
} DFBInputDeviceKeymapEntry;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,649 @@
#ifndef __DIRECTFB_KEYNAMES_H__
#define __DIRECTFB_KEYNAMES_H__
struct DFBKeySymbolName {
DFBInputDeviceKeySymbol symbol;
const char *name;
};
#define DirectFBKeySymbolNames(Identifier) struct DFBKeySymbolName Identifier[] = { \
{ DIKS_BACKSPACE, "BACKSPACE" }, \
{ DIKS_TAB, "TAB" }, \
{ DIKS_RETURN, "RETURN" }, \
{ DIKS_CANCEL, "CANCEL" }, \
{ DIKS_ESCAPE, "ESCAPE" }, \
{ DIKS_SPACE, "SPACE" }, \
{ DIKS_EXCLAMATION_MARK, "EXCLAMATION_MARK" }, \
{ DIKS_QUOTATION, "QUOTATION" }, \
{ DIKS_NUMBER_SIGN, "NUMBER_SIGN" }, \
{ DIKS_DOLLAR_SIGN, "DOLLAR_SIGN" }, \
{ DIKS_PERCENT_SIGN, "PERCENT_SIGN" }, \
{ DIKS_AMPERSAND, "AMPERSAND" }, \
{ DIKS_APOSTROPHE, "APOSTROPHE" }, \
{ DIKS_PARENTHESIS_LEFT, "PARENTHESIS_LEFT" }, \
{ DIKS_PARENTHESIS_RIGHT, "PARENTHESIS_RIGHT" }, \
{ DIKS_ASTERISK, "ASTERISK" }, \
{ DIKS_PLUS_SIGN, "PLUS_SIGN" }, \
{ DIKS_COMMA, "COMMA" }, \
{ DIKS_MINUS_SIGN, "MINUS_SIGN" }, \
{ DIKS_PERIOD, "PERIOD" }, \
{ DIKS_SLASH, "SLASH" }, \
{ DIKS_0, "0" }, \
{ DIKS_1, "1" }, \
{ DIKS_2, "2" }, \
{ DIKS_3, "3" }, \
{ DIKS_4, "4" }, \
{ DIKS_5, "5" }, \
{ DIKS_6, "6" }, \
{ DIKS_7, "7" }, \
{ DIKS_8, "8" }, \
{ DIKS_9, "9" }, \
{ DIKS_COLON, "COLON" }, \
{ DIKS_SEMICOLON, "SEMICOLON" }, \
{ DIKS_LESS_THAN_SIGN, "LESS_THAN_SIGN" }, \
{ DIKS_EQUALS_SIGN, "EQUALS_SIGN" }, \
{ DIKS_GREATER_THAN_SIGN, "GREATER_THAN_SIGN" }, \
{ DIKS_QUESTION_MARK, "QUESTION_MARK" }, \
{ DIKS_AT, "AT" }, \
{ DIKS_CAPITAL_A, "CAPITAL_A" }, \
{ DIKS_CAPITAL_B, "CAPITAL_B" }, \
{ DIKS_CAPITAL_C, "CAPITAL_C" }, \
{ DIKS_CAPITAL_D, "CAPITAL_D" }, \
{ DIKS_CAPITAL_E, "CAPITAL_E" }, \
{ DIKS_CAPITAL_F, "CAPITAL_F" }, \
{ DIKS_CAPITAL_G, "CAPITAL_G" }, \
{ DIKS_CAPITAL_H, "CAPITAL_H" }, \
{ DIKS_CAPITAL_I, "CAPITAL_I" }, \
{ DIKS_CAPITAL_J, "CAPITAL_J" }, \
{ DIKS_CAPITAL_K, "CAPITAL_K" }, \
{ DIKS_CAPITAL_L, "CAPITAL_L" }, \
{ DIKS_CAPITAL_M, "CAPITAL_M" }, \
{ DIKS_CAPITAL_N, "CAPITAL_N" }, \
{ DIKS_CAPITAL_O, "CAPITAL_O" }, \
{ DIKS_CAPITAL_P, "CAPITAL_P" }, \
{ DIKS_CAPITAL_Q, "CAPITAL_Q" }, \
{ DIKS_CAPITAL_R, "CAPITAL_R" }, \
{ DIKS_CAPITAL_S, "CAPITAL_S" }, \
{ DIKS_CAPITAL_T, "CAPITAL_T" }, \
{ DIKS_CAPITAL_U, "CAPITAL_U" }, \
{ DIKS_CAPITAL_V, "CAPITAL_V" }, \
{ DIKS_CAPITAL_W, "CAPITAL_W" }, \
{ DIKS_CAPITAL_X, "CAPITAL_X" }, \
{ DIKS_CAPITAL_Y, "CAPITAL_Y" }, \
{ DIKS_CAPITAL_Z, "CAPITAL_Z" }, \
{ DIKS_SQUARE_BRACKET_LEFT, "SQUARE_BRACKET_LEFT" }, \
{ DIKS_BACKSLASH, "BACKSLASH" }, \
{ DIKS_SQUARE_BRACKET_RIGHT, "SQUARE_BRACKET_RIGHT" }, \
{ DIKS_CIRCUMFLEX_ACCENT, "CIRCUMFLEX_ACCENT" }, \
{ DIKS_UNDERSCORE, "UNDERSCORE" }, \
{ DIKS_GRAVE_ACCENT, "GRAVE_ACCENT" }, \
{ DIKS_SMALL_A, "SMALL_A" }, \
{ DIKS_SMALL_B, "SMALL_B" }, \
{ DIKS_SMALL_C, "SMALL_C" }, \
{ DIKS_SMALL_D, "SMALL_D" }, \
{ DIKS_SMALL_E, "SMALL_E" }, \
{ DIKS_SMALL_F, "SMALL_F" }, \
{ DIKS_SMALL_G, "SMALL_G" }, \
{ DIKS_SMALL_H, "SMALL_H" }, \
{ DIKS_SMALL_I, "SMALL_I" }, \
{ DIKS_SMALL_J, "SMALL_J" }, \
{ DIKS_SMALL_K, "SMALL_K" }, \
{ DIKS_SMALL_L, "SMALL_L" }, \
{ DIKS_SMALL_M, "SMALL_M" }, \
{ DIKS_SMALL_N, "SMALL_N" }, \
{ DIKS_SMALL_O, "SMALL_O" }, \
{ DIKS_SMALL_P, "SMALL_P" }, \
{ DIKS_SMALL_Q, "SMALL_Q" }, \
{ DIKS_SMALL_R, "SMALL_R" }, \
{ DIKS_SMALL_S, "SMALL_S" }, \
{ DIKS_SMALL_T, "SMALL_T" }, \
{ DIKS_SMALL_U, "SMALL_U" }, \
{ DIKS_SMALL_V, "SMALL_V" }, \
{ DIKS_SMALL_W, "SMALL_W" }, \
{ DIKS_SMALL_X, "SMALL_X" }, \
{ DIKS_SMALL_Y, "SMALL_Y" }, \
{ DIKS_SMALL_Z, "SMALL_Z" }, \
{ DIKS_CURLY_BRACKET_LEFT, "CURLY_BRACKET_LEFT" }, \
{ DIKS_VERTICAL_BAR, "VERTICAL_BAR" }, \
{ DIKS_CURLY_BRACKET_RIGHT, "CURLY_BRACKET_RIGHT" }, \
{ DIKS_TILDE, "TILDE" }, \
{ DIKS_DELETE, "DELETE" }, \
{ DIKS_CURSOR_LEFT, "CURSOR_LEFT" }, \
{ DIKS_CURSOR_RIGHT, "CURSOR_RIGHT" }, \
{ DIKS_CURSOR_UP, "CURSOR_UP" }, \
{ DIKS_CURSOR_DOWN, "CURSOR_DOWN" }, \
{ DIKS_INSERT, "INSERT" }, \
{ DIKS_HOME, "HOME" }, \
{ DIKS_END, "END" }, \
{ DIKS_PAGE_UP, "PAGE_UP" }, \
{ DIKS_PAGE_DOWN, "PAGE_DOWN" }, \
{ DIKS_PRINT, "PRINT" }, \
{ DIKS_PAUSE, "PAUSE" }, \
{ DIKS_OK, "OK" }, \
{ DIKS_SELECT, "SELECT" }, \
{ DIKS_GOTO, "GOTO" }, \
{ DIKS_CLEAR, "CLEAR" }, \
{ DIKS_POWER, "POWER" }, \
{ DIKS_POWER2, "POWER2" }, \
{ DIKS_OPTION, "OPTION" }, \
{ DIKS_MENU, "MENU" }, \
{ DIKS_HELP, "HELP" }, \
{ DIKS_INFO, "INFO" }, \
{ DIKS_TIME, "TIME" }, \
{ DIKS_VENDOR, "VENDOR" }, \
{ DIKS_ARCHIVE, "ARCHIVE" }, \
{ DIKS_PROGRAM, "PROGRAM" }, \
{ DIKS_CHANNEL, "CHANNEL" }, \
{ DIKS_FAVORITES, "FAVORITES" }, \
{ DIKS_EPG, "EPG" }, \
{ DIKS_PVR, "PVR" }, \
{ DIKS_MHP, "MHP" }, \
{ DIKS_LANGUAGE, "LANGUAGE" }, \
{ DIKS_TITLE, "TITLE" }, \
{ DIKS_SUBTITLE, "SUBTITLE" }, \
{ DIKS_ANGLE, "ANGLE" }, \
{ DIKS_ZOOM, "ZOOM" }, \
{ DIKS_MODE, "MODE" }, \
{ DIKS_KEYBOARD, "KEYBOARD" }, \
{ DIKS_PC, "PC" }, \
{ DIKS_SCREEN, "SCREEN" }, \
{ DIKS_TV, "TV" }, \
{ DIKS_TV2, "TV2" }, \
{ DIKS_VCR, "VCR" }, \
{ DIKS_VCR2, "VCR2" }, \
{ DIKS_SAT, "SAT" }, \
{ DIKS_SAT2, "SAT2" }, \
{ DIKS_CD, "CD" }, \
{ DIKS_TAPE, "TAPE" }, \
{ DIKS_RADIO, "RADIO" }, \
{ DIKS_TUNER, "TUNER" }, \
{ DIKS_PLAYER, "PLAYER" }, \
{ DIKS_TEXT, "TEXT" }, \
{ DIKS_DVD, "DVD" }, \
{ DIKS_AUX, "AUX" }, \
{ DIKS_MP3, "MP3" }, \
{ DIKS_PHONE, "PHONE" }, \
{ DIKS_AUDIO, "AUDIO" }, \
{ DIKS_VIDEO, "VIDEO" }, \
{ DIKS_INTERNET, "INTERNET" }, \
{ DIKS_MAIL, "MAIL" }, \
{ DIKS_NEWS, "NEWS" }, \
{ DIKS_DIRECTORY, "DIRECTORY" }, \
{ DIKS_LIST, "LIST" }, \
{ DIKS_CALCULATOR, "CALCULATOR" }, \
{ DIKS_MEMO, "MEMO" }, \
{ DIKS_CALENDAR, "CALENDAR" }, \
{ DIKS_EDITOR, "EDITOR" }, \
{ DIKS_RED, "RED" }, \
{ DIKS_GREEN, "GREEN" }, \
{ DIKS_YELLOW, "YELLOW" }, \
{ DIKS_BLUE, "BLUE" }, \
{ DIKS_CHANNEL_UP, "CHANNEL_UP" }, \
{ DIKS_CHANNEL_DOWN, "CHANNEL_DOWN" }, \
{ DIKS_BACK, "BACK" }, \
{ DIKS_FORWARD, "FORWARD" }, \
{ DIKS_FIRST, "FIRST" }, \
{ DIKS_LAST, "LAST" }, \
{ DIKS_VOLUME_UP, "VOLUME_UP" }, \
{ DIKS_VOLUME_DOWN, "VOLUME_DOWN" }, \
{ DIKS_MUTE, "MUTE" }, \
{ DIKS_AB, "AB" }, \
{ DIKS_PLAYPAUSE, "PLAYPAUSE" }, \
{ DIKS_PLAY, "PLAY" }, \
{ DIKS_STOP, "STOP" }, \
{ DIKS_RESTART, "RESTART" }, \
{ DIKS_SLOW, "SLOW" }, \
{ DIKS_FAST, "FAST" }, \
{ DIKS_RECORD, "RECORD" }, \
{ DIKS_EJECT, "EJECT" }, \
{ DIKS_SHUFFLE, "SHUFFLE" }, \
{ DIKS_REWIND, "REWIND" }, \
{ DIKS_FASTFORWARD, "FASTFORWARD" }, \
{ DIKS_PREVIOUS, "PREVIOUS" }, \
{ DIKS_NEXT, "NEXT" }, \
{ DIKS_BEGIN, "BEGIN" }, \
{ DIKS_DIGITS, "DIGITS" }, \
{ DIKS_TEEN, "TEEN" }, \
{ DIKS_TWEN, "TWEN" }, \
{ DIKS_BREAK, "BREAK" }, \
{ DIKS_EXIT, "EXIT" }, \
{ DIKS_SETUP, "SETUP" }, \
{ DIKS_CURSOR_LEFT_UP, "CURSOR_LEFT_UP" }, \
{ DIKS_CURSOR_LEFT_DOWN, "CURSOR_LEFT_DOWN" }, \
{ DIKS_CURSOR_UP_RIGHT, "CURSOR_UP_RIGHT" }, \
{ DIKS_CURSOR_DOWN_RIGHT, "CURSOR_DOWN_RIGHT" }, \
{ DIKS_PIP, "PIP" }, \
{ DIKS_SWAP, "SWAP" }, \
{ DIKS_FREEZE, "FREEZE" }, \
{ DIKS_MOVE, "MOVE" }, \
{ DIKS_CALL, "CALL" }, \
{ DIKS_SPEAKER, "SPEAKER" }, \
{ DIKS_SAVE, "SAVE" }, \
{ DIKS_REDIAL, "REDIAL" }, \
{ DIKS_FLASH, "FLASH" }, \
{ DIKS_HOLD, "HOLD" }, \
{ DIKS_F1, "F1" }, \
{ DIKS_F2, "F2" }, \
{ DIKS_F3, "F3" }, \
{ DIKS_F4, "F4" }, \
{ DIKS_F5, "F5" }, \
{ DIKS_F6, "F6" }, \
{ DIKS_F7, "F7" }, \
{ DIKS_F8, "F8" }, \
{ DIKS_F9, "F9" }, \
{ DIKS_F10, "F10" }, \
{ DIKS_F11, "F11" }, \
{ DIKS_F12, "F12" }, \
{ DIKS_SHIFT, "SHIFT" }, \
{ DIKS_CONTROL, "CONTROL" }, \
{ DIKS_ALT, "ALT" }, \
{ DIKS_ALTGR, "ALTGR" }, \
{ DIKS_META, "META" }, \
{ DIKS_SUPER, "SUPER" }, \
{ DIKS_HYPER, "HYPER" }, \
{ DIKS_CAPS_LOCK, "CAPS_LOCK" }, \
{ DIKS_NUM_LOCK, "NUM_LOCK" }, \
{ DIKS_SCROLL_LOCK, "SCROLL_LOCK" }, \
{ DIKS_DEAD_ABOVEDOT, "DEAD_ABOVEDOT" }, \
{ DIKS_DEAD_ABOVERING, "DEAD_ABOVERING" }, \
{ DIKS_DEAD_ACUTE, "DEAD_ACUTE" }, \
{ DIKS_DEAD_BREVE, "DEAD_BREVE" }, \
{ DIKS_DEAD_CARON, "DEAD_CARON" }, \
{ DIKS_DEAD_CEDILLA, "DEAD_CEDILLA" }, \
{ DIKS_DEAD_CIRCUMFLEX, "DEAD_CIRCUMFLEX" }, \
{ DIKS_DEAD_DIAERESIS, "DEAD_DIAERESIS" }, \
{ DIKS_DEAD_DOUBLEACUTE, "DEAD_DOUBLEACUTE" }, \
{ DIKS_DEAD_GRAVE, "DEAD_GRAVE" }, \
{ DIKS_DEAD_IOTA, "DEAD_IOTA" }, \
{ DIKS_DEAD_MACRON, "DEAD_MACRON" }, \
{ DIKS_DEAD_OGONEK, "DEAD_OGONEK" }, \
{ DIKS_DEAD_SEMIVOICED_SOUND, "DEAD_SEMIVOICED_SOUND" }, \
{ DIKS_DEAD_TILDE, "DEAD_TILDE" }, \
{ DIKS_DEAD_VOICED_SOUND, "DEAD_VOICED_SOUND" }, \
{ DIKS_CUSTOM0, "CUSTOM0" }, \
{ DIKS_CUSTOM1, "CUSTOM1" }, \
{ DIKS_CUSTOM2, "CUSTOM2" }, \
{ DIKS_CUSTOM3, "CUSTOM3" }, \
{ DIKS_CUSTOM4, "CUSTOM4" }, \
{ DIKS_CUSTOM5, "CUSTOM5" }, \
{ DIKS_CUSTOM6, "CUSTOM6" }, \
{ DIKS_CUSTOM7, "CUSTOM7" }, \
{ DIKS_CUSTOM8, "CUSTOM8" }, \
{ DIKS_CUSTOM9, "CUSTOM9" }, \
{ DIKS_CUSTOM10, "CUSTOM10" }, \
{ DIKS_CUSTOM11, "CUSTOM11" }, \
{ DIKS_CUSTOM12, "CUSTOM12" }, \
{ DIKS_CUSTOM13, "CUSTOM13" }, \
{ DIKS_CUSTOM14, "CUSTOM14" }, \
{ DIKS_CUSTOM15, "CUSTOM15" }, \
{ DIKS_CUSTOM16, "CUSTOM16" }, \
{ DIKS_CUSTOM17, "CUSTOM17" }, \
{ DIKS_CUSTOM18, "CUSTOM18" }, \
{ DIKS_CUSTOM19, "CUSTOM19" }, \
{ DIKS_CUSTOM20, "CUSTOM20" }, \
{ DIKS_CUSTOM21, "CUSTOM21" }, \
{ DIKS_CUSTOM22, "CUSTOM22" }, \
{ DIKS_CUSTOM23, "CUSTOM23" }, \
{ DIKS_CUSTOM24, "CUSTOM24" }, \
{ DIKS_CUSTOM25, "CUSTOM25" }, \
{ DIKS_CUSTOM26, "CUSTOM26" }, \
{ DIKS_CUSTOM27, "CUSTOM27" }, \
{ DIKS_CUSTOM28, "CUSTOM28" }, \
{ DIKS_CUSTOM29, "CUSTOM29" }, \
{ DIKS_CUSTOM30, "CUSTOM30" }, \
{ DIKS_CUSTOM31, "CUSTOM31" }, \
{ DIKS_CUSTOM32, "CUSTOM32" }, \
{ DIKS_CUSTOM33, "CUSTOM33" }, \
{ DIKS_CUSTOM34, "CUSTOM34" }, \
{ DIKS_CUSTOM35, "CUSTOM35" }, \
{ DIKS_CUSTOM36, "CUSTOM36" }, \
{ DIKS_CUSTOM37, "CUSTOM37" }, \
{ DIKS_CUSTOM38, "CUSTOM38" }, \
{ DIKS_CUSTOM39, "CUSTOM39" }, \
{ DIKS_CUSTOM40, "CUSTOM40" }, \
{ DIKS_CUSTOM41, "CUSTOM41" }, \
{ DIKS_CUSTOM42, "CUSTOM42" }, \
{ DIKS_CUSTOM43, "CUSTOM43" }, \
{ DIKS_CUSTOM44, "CUSTOM44" }, \
{ DIKS_CUSTOM45, "CUSTOM45" }, \
{ DIKS_CUSTOM46, "CUSTOM46" }, \
{ DIKS_CUSTOM47, "CUSTOM47" }, \
{ DIKS_CUSTOM48, "CUSTOM48" }, \
{ DIKS_CUSTOM49, "CUSTOM49" }, \
{ DIKS_CUSTOM50, "CUSTOM50" }, \
{ DIKS_CUSTOM51, "CUSTOM51" }, \
{ DIKS_CUSTOM52, "CUSTOM52" }, \
{ DIKS_CUSTOM53, "CUSTOM53" }, \
{ DIKS_CUSTOM54, "CUSTOM54" }, \
{ DIKS_CUSTOM55, "CUSTOM55" }, \
{ DIKS_CUSTOM56, "CUSTOM56" }, \
{ DIKS_CUSTOM57, "CUSTOM57" }, \
{ DIKS_CUSTOM58, "CUSTOM58" }, \
{ DIKS_CUSTOM59, "CUSTOM59" }, \
{ DIKS_CUSTOM60, "CUSTOM60" }, \
{ DIKS_CUSTOM61, "CUSTOM61" }, \
{ DIKS_CUSTOM62, "CUSTOM62" }, \
{ DIKS_CUSTOM63, "CUSTOM63" }, \
{ DIKS_CUSTOM64, "CUSTOM64" }, \
{ DIKS_CUSTOM65, "CUSTOM65" }, \
{ DIKS_CUSTOM66, "CUSTOM66" }, \
{ DIKS_CUSTOM67, "CUSTOM67" }, \
{ DIKS_CUSTOM68, "CUSTOM68" }, \
{ DIKS_CUSTOM69, "CUSTOM69" }, \
{ DIKS_CUSTOM70, "CUSTOM70" }, \
{ DIKS_CUSTOM71, "CUSTOM71" }, \
{ DIKS_CUSTOM72, "CUSTOM72" }, \
{ DIKS_CUSTOM73, "CUSTOM73" }, \
{ DIKS_CUSTOM74, "CUSTOM74" }, \
{ DIKS_CUSTOM75, "CUSTOM75" }, \
{ DIKS_CUSTOM76, "CUSTOM76" }, \
{ DIKS_CUSTOM77, "CUSTOM77" }, \
{ DIKS_CUSTOM78, "CUSTOM78" }, \
{ DIKS_CUSTOM79, "CUSTOM79" }, \
{ DIKS_CUSTOM80, "CUSTOM80" }, \
{ DIKS_CUSTOM81, "CUSTOM81" }, \
{ DIKS_CUSTOM82, "CUSTOM82" }, \
{ DIKS_CUSTOM83, "CUSTOM83" }, \
{ DIKS_CUSTOM84, "CUSTOM84" }, \
{ DIKS_CUSTOM85, "CUSTOM85" }, \
{ DIKS_CUSTOM86, "CUSTOM86" }, \
{ DIKS_CUSTOM87, "CUSTOM87" }, \
{ DIKS_CUSTOM88, "CUSTOM88" }, \
{ DIKS_CUSTOM89, "CUSTOM89" }, \
{ DIKS_CUSTOM90, "CUSTOM90" }, \
{ DIKS_CUSTOM91, "CUSTOM91" }, \
{ DIKS_CUSTOM92, "CUSTOM92" }, \
{ DIKS_CUSTOM93, "CUSTOM93" }, \
{ DIKS_CUSTOM94, "CUSTOM94" }, \
{ DIKS_CUSTOM95, "CUSTOM95" }, \
{ DIKS_CUSTOM96, "CUSTOM96" }, \
{ DIKS_CUSTOM97, "CUSTOM97" }, \
{ DIKS_CUSTOM98, "CUSTOM98" }, \
{ DIKS_CUSTOM99, "CUSTOM99" }, \
{ DIKS_CUSTOM100, "CUSTOM100" }, \
{ DIKS_CUSTOM101, "CUSTOM101" }, \
{ DIKS_CUSTOM102, "CUSTOM102" }, \
{ DIKS_CUSTOM103, "CUSTOM103" }, \
{ DIKS_CUSTOM104, "CUSTOM104" }, \
{ DIKS_CUSTOM105, "CUSTOM105" }, \
{ DIKS_CUSTOM106, "CUSTOM106" }, \
{ DIKS_CUSTOM107, "CUSTOM107" }, \
{ DIKS_CUSTOM108, "CUSTOM108" }, \
{ DIKS_CUSTOM109, "CUSTOM109" }, \
{ DIKS_CUSTOM110, "CUSTOM110" }, \
{ DIKS_CUSTOM111, "CUSTOM111" }, \
{ DIKS_CUSTOM112, "CUSTOM112" }, \
{ DIKS_CUSTOM113, "CUSTOM113" }, \
{ DIKS_CUSTOM114, "CUSTOM114" }, \
{ DIKS_CUSTOM115, "CUSTOM115" }, \
{ DIKS_CUSTOM116, "CUSTOM116" }, \
{ DIKS_CUSTOM117, "CUSTOM117" }, \
{ DIKS_CUSTOM118, "CUSTOM118" }, \
{ DIKS_CUSTOM119, "CUSTOM119" }, \
{ DIKS_CUSTOM120, "CUSTOM120" }, \
{ DIKS_CUSTOM121, "CUSTOM121" }, \
{ DIKS_CUSTOM122, "CUSTOM122" }, \
{ DIKS_CUSTOM123, "CUSTOM123" }, \
{ DIKS_CUSTOM124, "CUSTOM124" }, \
{ DIKS_CUSTOM125, "CUSTOM125" }, \
{ DIKS_CUSTOM126, "CUSTOM126" }, \
{ DIKS_CUSTOM127, "CUSTOM127" }, \
{ DIKS_CUSTOM128, "CUSTOM128" }, \
{ DIKS_CUSTOM129, "CUSTOM129" }, \
{ DIKS_CUSTOM130, "CUSTOM130" }, \
{ DIKS_CUSTOM131, "CUSTOM131" }, \
{ DIKS_CUSTOM132, "CUSTOM132" }, \
{ DIKS_CUSTOM133, "CUSTOM133" }, \
{ DIKS_CUSTOM134, "CUSTOM134" }, \
{ DIKS_CUSTOM135, "CUSTOM135" }, \
{ DIKS_CUSTOM136, "CUSTOM136" }, \
{ DIKS_CUSTOM137, "CUSTOM137" }, \
{ DIKS_CUSTOM138, "CUSTOM138" }, \
{ DIKS_CUSTOM139, "CUSTOM139" }, \
{ DIKS_CUSTOM140, "CUSTOM140" }, \
{ DIKS_CUSTOM141, "CUSTOM141" }, \
{ DIKS_CUSTOM142, "CUSTOM142" }, \
{ DIKS_CUSTOM143, "CUSTOM143" }, \
{ DIKS_CUSTOM144, "CUSTOM144" }, \
{ DIKS_CUSTOM145, "CUSTOM145" }, \
{ DIKS_CUSTOM146, "CUSTOM146" }, \
{ DIKS_CUSTOM147, "CUSTOM147" }, \
{ DIKS_CUSTOM148, "CUSTOM148" }, \
{ DIKS_CUSTOM149, "CUSTOM149" }, \
{ DIKS_CUSTOM150, "CUSTOM150" }, \
{ DIKS_CUSTOM151, "CUSTOM151" }, \
{ DIKS_CUSTOM152, "CUSTOM152" }, \
{ DIKS_CUSTOM153, "CUSTOM153" }, \
{ DIKS_CUSTOM154, "CUSTOM154" }, \
{ DIKS_CUSTOM155, "CUSTOM155" }, \
{ DIKS_CUSTOM156, "CUSTOM156" }, \
{ DIKS_CUSTOM157, "CUSTOM157" }, \
{ DIKS_CUSTOM158, "CUSTOM158" }, \
{ DIKS_CUSTOM159, "CUSTOM159" }, \
{ DIKS_CUSTOM160, "CUSTOM160" }, \
{ DIKS_CUSTOM161, "CUSTOM161" }, \
{ DIKS_CUSTOM162, "CUSTOM162" }, \
{ DIKS_CUSTOM163, "CUSTOM163" }, \
{ DIKS_CUSTOM164, "CUSTOM164" }, \
{ DIKS_CUSTOM165, "CUSTOM165" }, \
{ DIKS_CUSTOM166, "CUSTOM166" }, \
{ DIKS_CUSTOM167, "CUSTOM167" }, \
{ DIKS_CUSTOM168, "CUSTOM168" }, \
{ DIKS_CUSTOM169, "CUSTOM169" }, \
{ DIKS_CUSTOM170, "CUSTOM170" }, \
{ DIKS_CUSTOM171, "CUSTOM171" }, \
{ DIKS_CUSTOM172, "CUSTOM172" }, \
{ DIKS_CUSTOM173, "CUSTOM173" }, \
{ DIKS_CUSTOM174, "CUSTOM174" }, \
{ DIKS_CUSTOM175, "CUSTOM175" }, \
{ DIKS_CUSTOM176, "CUSTOM176" }, \
{ DIKS_CUSTOM177, "CUSTOM177" }, \
{ DIKS_CUSTOM178, "CUSTOM178" }, \
{ DIKS_CUSTOM179, "CUSTOM179" }, \
{ DIKS_CUSTOM180, "CUSTOM180" }, \
{ DIKS_CUSTOM181, "CUSTOM181" }, \
{ DIKS_CUSTOM182, "CUSTOM182" }, \
{ DIKS_CUSTOM183, "CUSTOM183" }, \
{ DIKS_CUSTOM184, "CUSTOM184" }, \
{ DIKS_CUSTOM185, "CUSTOM185" }, \
{ DIKS_CUSTOM186, "CUSTOM186" }, \
{ DIKS_CUSTOM187, "CUSTOM187" }, \
{ DIKS_CUSTOM188, "CUSTOM188" }, \
{ DIKS_CUSTOM189, "CUSTOM189" }, \
{ DIKS_CUSTOM190, "CUSTOM190" }, \
{ DIKS_CUSTOM191, "CUSTOM191" }, \
{ DIKS_CUSTOM192, "CUSTOM192" }, \
{ DIKS_CUSTOM193, "CUSTOM193" }, \
{ DIKS_CUSTOM194, "CUSTOM194" }, \
{ DIKS_CUSTOM195, "CUSTOM195" }, \
{ DIKS_CUSTOM196, "CUSTOM196" }, \
{ DIKS_CUSTOM197, "CUSTOM197" }, \
{ DIKS_CUSTOM198, "CUSTOM198" }, \
{ DIKS_CUSTOM199, "CUSTOM199" }, \
{ DIKS_CUSTOM200, "CUSTOM200" }, \
{ DIKS_CUSTOM201, "CUSTOM201" }, \
{ DIKS_CUSTOM202, "CUSTOM202" }, \
{ DIKS_CUSTOM203, "CUSTOM203" }, \
{ DIKS_CUSTOM204, "CUSTOM204" }, \
{ DIKS_CUSTOM205, "CUSTOM205" }, \
{ DIKS_CUSTOM206, "CUSTOM206" }, \
{ DIKS_CUSTOM207, "CUSTOM207" }, \
{ DIKS_CUSTOM208, "CUSTOM208" }, \
{ DIKS_CUSTOM209, "CUSTOM209" }, \
{ DIKS_CUSTOM210, "CUSTOM210" }, \
{ DIKS_CUSTOM211, "CUSTOM211" }, \
{ DIKS_CUSTOM212, "CUSTOM212" }, \
{ DIKS_CUSTOM213, "CUSTOM213" }, \
{ DIKS_CUSTOM214, "CUSTOM214" }, \
{ DIKS_CUSTOM215, "CUSTOM215" }, \
{ DIKS_CUSTOM216, "CUSTOM216" }, \
{ DIKS_CUSTOM217, "CUSTOM217" }, \
{ DIKS_CUSTOM218, "CUSTOM218" }, \
{ DIKS_CUSTOM219, "CUSTOM219" }, \
{ DIKS_CUSTOM220, "CUSTOM220" }, \
{ DIKS_CUSTOM221, "CUSTOM221" }, \
{ DIKS_CUSTOM222, "CUSTOM222" }, \
{ DIKS_CUSTOM223, "CUSTOM223" }, \
{ DIKS_CUSTOM224, "CUSTOM224" }, \
{ DIKS_CUSTOM225, "CUSTOM225" }, \
{ DIKS_CUSTOM226, "CUSTOM226" }, \
{ DIKS_CUSTOM227, "CUSTOM227" }, \
{ DIKS_CUSTOM228, "CUSTOM228" }, \
{ DIKS_CUSTOM229, "CUSTOM229" }, \
{ DIKS_CUSTOM230, "CUSTOM230" }, \
{ DIKS_CUSTOM231, "CUSTOM231" }, \
{ DIKS_CUSTOM232, "CUSTOM232" }, \
{ DIKS_CUSTOM233, "CUSTOM233" }, \
{ DIKS_CUSTOM234, "CUSTOM234" }, \
{ DIKS_CUSTOM235, "CUSTOM235" }, \
{ DIKS_CUSTOM236, "CUSTOM236" }, \
{ DIKS_CUSTOM237, "CUSTOM237" }, \
{ DIKS_CUSTOM238, "CUSTOM238" }, \
{ DIKS_CUSTOM239, "CUSTOM239" }, \
{ DIKS_CUSTOM240, "CUSTOM240" }, \
{ DIKS_CUSTOM241, "CUSTOM241" }, \
{ DIKS_CUSTOM242, "CUSTOM242" }, \
{ DIKS_CUSTOM243, "CUSTOM243" }, \
{ DIKS_CUSTOM244, "CUSTOM244" }, \
{ DIKS_CUSTOM245, "CUSTOM245" }, \
{ DIKS_CUSTOM246, "CUSTOM246" }, \
{ DIKS_CUSTOM247, "CUSTOM247" }, \
{ DIKS_CUSTOM248, "CUSTOM248" }, \
{ DIKS_CUSTOM249, "CUSTOM249" }, \
{ DIKS_CUSTOM250, "CUSTOM250" }, \
{ DIKS_CUSTOM251, "CUSTOM251" }, \
{ DIKS_CUSTOM252, "CUSTOM252" }, \
{ DIKS_CUSTOM253, "CUSTOM253" }, \
{ DIKS_CUSTOM254, "CUSTOM254" }, \
{ DIKS_CUSTOM255, "CUSTOM255" }, \
{ (DFBInputDeviceKeySymbol) DIKS_NULL, "NULL" } \
};
struct DFBKeyIdentifierName {
DFBInputDeviceKeyIdentifier identifier;
const char *name;
};
#define DirectFBKeyIdentifierNames(Identifier) struct DFBKeyIdentifierName Identifier[] = { \
{ DIKI_A, "A" }, \
{ DIKI_B, "B" }, \
{ DIKI_C, "C" }, \
{ DIKI_D, "D" }, \
{ DIKI_E, "E" }, \
{ DIKI_F, "F" }, \
{ DIKI_G, "G" }, \
{ DIKI_H, "H" }, \
{ DIKI_I, "I" }, \
{ DIKI_J, "J" }, \
{ DIKI_K, "K" }, \
{ DIKI_L, "L" }, \
{ DIKI_M, "M" }, \
{ DIKI_N, "N" }, \
{ DIKI_O, "O" }, \
{ DIKI_P, "P" }, \
{ DIKI_Q, "Q" }, \
{ DIKI_R, "R" }, \
{ DIKI_S, "S" }, \
{ DIKI_T, "T" }, \
{ DIKI_U, "U" }, \
{ DIKI_V, "V" }, \
{ DIKI_W, "W" }, \
{ DIKI_X, "X" }, \
{ DIKI_Y, "Y" }, \
{ DIKI_Z, "Z" }, \
{ DIKI_0, "0" }, \
{ DIKI_1, "1" }, \
{ DIKI_2, "2" }, \
{ DIKI_3, "3" }, \
{ DIKI_4, "4" }, \
{ DIKI_5, "5" }, \
{ DIKI_6, "6" }, \
{ DIKI_7, "7" }, \
{ DIKI_8, "8" }, \
{ DIKI_9, "9" }, \
{ DIKI_F1, "F1" }, \
{ DIKI_F2, "F2" }, \
{ DIKI_F3, "F3" }, \
{ DIKI_F4, "F4" }, \
{ DIKI_F5, "F5" }, \
{ DIKI_F6, "F6" }, \
{ DIKI_F7, "F7" }, \
{ DIKI_F8, "F8" }, \
{ DIKI_F9, "F9" }, \
{ DIKI_F10, "F10" }, \
{ DIKI_F11, "F11" }, \
{ DIKI_F12, "F12" }, \
{ DIKI_SHIFT_L, "SHIFT_L" }, \
{ DIKI_SHIFT_R, "SHIFT_R" }, \
{ DIKI_CONTROL_L, "CONTROL_L" }, \
{ DIKI_CONTROL_R, "CONTROL_R" }, \
{ DIKI_ALT_L, "ALT_L" }, \
{ DIKI_ALT_R, "ALT_R" }, \
{ DIKI_META_L, "META_L" }, \
{ DIKI_META_R, "META_R" }, \
{ DIKI_SUPER_L, "SUPER_L" }, \
{ DIKI_SUPER_R, "SUPER_R" }, \
{ DIKI_HYPER_L, "HYPER_L" }, \
{ DIKI_HYPER_R, "HYPER_R" }, \
{ DIKI_CAPS_LOCK, "CAPS_LOCK" }, \
{ DIKI_NUM_LOCK, "NUM_LOCK" }, \
{ DIKI_SCROLL_LOCK, "SCROLL_LOCK" }, \
{ DIKI_ESCAPE, "ESCAPE" }, \
{ DIKI_LEFT, "LEFT" }, \
{ DIKI_RIGHT, "RIGHT" }, \
{ DIKI_UP, "UP" }, \
{ DIKI_DOWN, "DOWN" }, \
{ DIKI_TAB, "TAB" }, \
{ DIKI_ENTER, "ENTER" }, \
{ DIKI_SPACE, "SPACE" }, \
{ DIKI_BACKSPACE, "BACKSPACE" }, \
{ DIKI_INSERT, "INSERT" }, \
{ DIKI_DELETE, "DELETE" }, \
{ DIKI_HOME, "HOME" }, \
{ DIKI_END, "END" }, \
{ DIKI_PAGE_UP, "PAGE_UP" }, \
{ DIKI_PAGE_DOWN, "PAGE_DOWN" }, \
{ DIKI_PRINT, "PRINT" }, \
{ DIKI_PAUSE, "PAUSE" }, \
{ DIKI_QUOTE_LEFT, "QUOTE_LEFT" }, \
{ DIKI_MINUS_SIGN, "MINUS_SIGN" }, \
{ DIKI_EQUALS_SIGN, "EQUALS_SIGN" }, \
{ DIKI_BRACKET_LEFT, "BRACKET_LEFT" }, \
{ DIKI_BRACKET_RIGHT, "BRACKET_RIGHT" }, \
{ DIKI_BACKSLASH, "BACKSLASH" }, \
{ DIKI_SEMICOLON, "SEMICOLON" }, \
{ DIKI_QUOTE_RIGHT, "QUOTE_RIGHT" }, \
{ DIKI_COMMA, "COMMA" }, \
{ DIKI_PERIOD, "PERIOD" }, \
{ DIKI_SLASH, "SLASH" }, \
{ DIKI_LESS_SIGN, "LESS_SIGN" }, \
{ DIKI_KP_DIV, "KP_DIV" }, \
{ DIKI_KP_MULT, "KP_MULT" }, \
{ DIKI_KP_MINUS, "KP_MINUS" }, \
{ DIKI_KP_PLUS, "KP_PLUS" }, \
{ DIKI_KP_ENTER, "KP_ENTER" }, \
{ DIKI_KP_SPACE, "KP_SPACE" }, \
{ DIKI_KP_TAB, "KP_TAB" }, \
{ DIKI_KP_F1, "KP_F1" }, \
{ DIKI_KP_F2, "KP_F2" }, \
{ DIKI_KP_F3, "KP_F3" }, \
{ DIKI_KP_F4, "KP_F4" }, \
{ DIKI_KP_EQUAL, "KP_EQUAL" }, \
{ DIKI_KP_SEPARATOR, "KP_SEPARATOR" }, \
{ DIKI_KP_DECIMAL, "KP_DECIMAL" }, \
{ DIKI_KP_0, "KP_0" }, \
{ DIKI_KP_1, "KP_1" }, \
{ DIKI_KP_2, "KP_2" }, \
{ DIKI_KP_3, "KP_3" }, \
{ DIKI_KP_4, "KP_4" }, \
{ DIKI_KP_5, "KP_5" }, \
{ DIKI_KP_6, "KP_6" }, \
{ DIKI_KP_7, "KP_7" }, \
{ DIKI_KP_8, "KP_8" }, \
{ DIKI_KP_9, "KP_9" }, \
{ (DFBInputDeviceKeyIdentifier) DIKI_UNKNOWN, "UNKNOWN" } \
};
#endif

Some files were not shown because too many files have changed in this diff Show More