Author: remi
Date: 2009-02-15 18:55:53 +0100 (Sun, 15 Feb 2009)
New Revision: 3637
Added:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/threading.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/
software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/threading.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/threading.h
Removed:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/platform_independent.h
software_suite_v2/tuxware/tuxosl-ose/trunk/src/platform_independent.cpp
Modified:
software_suite_v2/tuxware/tuxosl-ose/trunk/Makefile.win32
software_suite_v2/tuxware/tuxosl-ose/trunk/include/channel.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/fifo.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/mixer.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/wav_player.h
software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/playback.h
software_suite_v2/tuxware/tuxosl-ose/trunk/src/equalizer.cpp
software_suite_v2/tuxware/tuxosl-ose/trunk/src/log.cpp
software_suite_v2/tuxware/tuxosl-ose/trunk/test/main.cpp
Log:
* added threading headers
* removed platform_independent module which only contains duplicated functions
* fixed all modules with theses changes
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/Makefile.win32
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/Makefile.win32 2009-02-15
16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/Makefile.win32 2009-02-15
17:55:53 UTC (rev 3637)
@@ -18,8 +18,6 @@
-...@echo ---------------------------
-...@echo --- Compile the modules ---
-...@echo ---------------------------
- -...@echo platform_independent
- -...@$(CC2) -c $(CFLAGS) $(SRC_DIR)/platform_independent.cpp
$(C_INCLUDE_DIRS) -o $(OBJ_DIR)/platform_independent.o
-...@echo log
-...@$(CC2) -c $(CFLAGS) $(SRC_DIR)/log.cpp $(C_INCLUDE_DIRS) -o
$(OBJ_DIR)/log.o
-...@echo misc compat
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/include/channel.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/channel.h
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/channel.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -30,7 +30,8 @@
#include "fifo.h"
#include "config.h"
-#include "platform_independent.h"
+#include "misc.h"
+#include "threading.h"
/**
* \enum channel_type_t
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/include/fifo.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/fifo.h 2009-02-15
16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/fifo.h 2009-02-15
17:55:53 UTC (rev 3637)
@@ -27,7 +27,8 @@
#include "types.h"
#include "config.h"
-#include "platform_independent.h"
+#include "misc.h"
+#include "threading.h"
#ifndef _FIFO_H_
#define _FIFO_H_
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/include/mixer.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/mixer.h 2009-02-15
16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/mixer.h 2009-02-15
17:55:53 UTC (rev 3637)
@@ -30,7 +30,8 @@
#include "channel.h"
#include "config.h"
-#include "platform_independent.h"
+#include "misc.h"
+#include "threading.h"
/**
* \class TOMixer
Deleted:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/platform_independent.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/platform_independent.h
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/platform_independent.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -1,85 +0,0 @@
-/*
- * Tux OSL - platform_independent - Cross-compilable constants and functions
- * Copyright (C) 2009 C2ME Sa <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/**
- * \file platform_independent.h
- * \brief Cross-compilable constants and functions.
- * \author [email protected]
- * \ingroup platform_independent
- */
-
-#ifndef _PLATFORM_INDEPENDENT_H_
-#define _PLATFORM_INDEPENDENT_H_
-
-#ifdef WIN32
-# include <windows.h>
-# define sleep(sec) Sleep(sec *
1000)
-# define usleep(usec) Sleep(usec / 1000)
-# define LIBEXPORT __declspec(dllexport)
-# define LIBLOCAL
-# define callback_t unsigned long __stdcall
-# define thread_t HANDLE
-# define thread_create(thrd, fct, param) thrd =
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(fct),(param),0,NULL)
-# define thread_delete(thrd) CloseHandle(thrd);
-# define thread_wait_close(thrd) WaitForMultipleObjects(1, &thrd,
TRUE, INFINITE)
-# define mutex_t CRITICAL_SECTION
-# define mutex_init(mutex) InitializeCriticalSection(& mutex)
-# define mutex_lock(mutex) EnterCriticalSection(& mutex)
-# define mutex_unlock(mutex) LeaveCriticalSection(& mutex)
-# define mutex_delete(mutex) DeleteCriticalSection(& mutex)
-# define semaphore_t HANDLE
-# define semaphore_init(sema, max, place) ((sema) = CreateSemaphore(NULL,
(max), (place), NULL))
-# define semaphore_lock(sema) WaitForSingleObject((sema),
INFINITE)
-# define semaphore_unlock(sema) ReleaseSemaphore((sema), 1, NULL)
-# define semaphore_delete(sema) CloseHandle(sema)
-#else
-# include <pthread.h>
-# define LIBEXPORT __attribute__ ((visibility
("default")))
-# define LIBLOCAL __attribute__ ((visibility
("internal")))
-# define callback_t void *
-# define thread_t pthread_t
-# define thread_create(thrd, fct, param) pthread_create(&thrd, NULL, (fct),
((void *)param));
-# define thread_delete(thrd) if ((pthread_t)thrd !=
(pthread_t)NULL) \
- pthread_detach(thrd)
-# define thread_wait_close(thrd) pthread_join(thrd, NULL)
-# include <semaphore.h>
-# define mutex_t pthread_mutex_t
-# define mutex_init(mutex) pthread_mutex_init ((&mutex), NULL)
-# define mutex_lock(mutex) pthread_mutex_lock((&mutex))
-# define mutex_unlock(mutex) pthread_mutex_unlock((&mutex))
-# define mutex_delete(mutex) pthread_mutex_destroy((&mutex))
-# define semaphore_t sem_t*
-# define semaphore_init(sema, max, place) (sema) = new sem_t; sem_init
((sema), (max), (place))
-# define semaphore_lock(sema) sem_wait((sema))
-# define semaphore_unlock(sema) sem_post((sema))
-# define semaphore_delete(sema) sem_destroy((sema)); delete
((sema))
-#endif
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-extern double getTime(void);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* _PLATFORM_INDEPENDENT_H_ */
Added: software_suite_v2/tuxware/tuxosl-ose/trunk/include/threading.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/threading.h
(rev 0)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/threading.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -0,0 +1,25 @@
+/*
+ * Tux OSL - Threading
+ * Copyright (C) 2009 C2ME Sa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifdef WIN32
+# include "win32/threading.h"
+#else
+# include "unix/threading.h"
+#endif
Property changes on:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/threading.h
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/threading.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/threading.h
(rev 0)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/threading.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -0,0 +1,51 @@
+/*
+ * Tux OSL - Threading
+ * Copyright (C) 2009 C2ME Sa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+/**
+ * \file threading.h
+ * \brief Threading module.
+ * \author [email protected]
+ * \ingroup threading
+ */
+
+#ifndef _THREADING_H_
+#define _THREADING_H_
+
+#include <pthread.h>
+
+#define callback_t void *
+#define thread_t pthread_t
+#define thread_create(thrd, fct, param) pthread_create(&thrd, NULL, (fct),
((void *)param));
+#define thread_delete(thrd) if ((pthread_t)thrd !=
(pthread_t)NULL) \
+ pthread_detach(thrd)
+#define thread_wait_close(thrd) pthread_join(thrd, NULL)
+#include <semaphore.h>
+#define mutex_t pthread_mutex_t
+#define mutex_init(mutex) pthread_mutex_init ((&mutex), NULL)
+#define mutex_lock(mutex) pthread_mutex_lock((&mutex))
+#define mutex_unlock(mutex) pthread_mutex_unlock((&mutex))
+#define mutex_delete(mutex) pthread_mutex_destroy((&mutex))
+#define semaphore_t sem_t*
+#define semaphore_init(sema, max, place) (sema) = new sem_t; sem_init ((sema),
(max), (place))
+#define semaphore_lock(sema) sem_wait((sema))
+#define semaphore_unlock(sema) sem_post((sema))
+#define semaphore_delete(sema) sem_destroy((sema)); delete ((sema))
+
+#endif /* _THREADING_H_ */
Property changes on:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/unix/threading.h
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/include/wav_player.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/wav_player.h
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/wav_player.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -30,7 +30,7 @@
#include "channel.h"
#include "types.h"
-#include "platform_independent.h"
+#include "misc.h"
/**
* \class TOWavPlayer
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/playback.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/playback.h
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/playback.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -30,9 +30,10 @@
#include <portaudio.h>
-#include "../platform_independent.h"
+#include "../misc.h"
#include "../types.h"
#include "../mixer.h"
+#include "../threading.h"
/**
* \class TOPlayback
Added: software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/threading.h
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/threading.h
(rev 0)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/threading.h
2009-02-15 17:55:53 UTC (rev 3637)
@@ -0,0 +1,49 @@
+/*
+ * Tux OSL - Threading
+ * Copyright (C) 2009 C2ME Sa <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+/**
+ * \file threading.h
+ * \brief Threading module.
+ * \author [email protected]
+ * \ingroup threading
+ */
+
+#ifndef _THREADING_H_
+#define _THREADING_H_
+
+#include <windows.h>
+
+#define callback_t unsigned long __stdcall
+#define thread_t HANDLE
+#define thread_create(thrd, fct, param) thrd =
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(fct),(param),0,NULL)
+#define thread_delete(thrd) CloseHandle(thrd);
+#define thread_wait_close(thrd) WaitForMultipleObjects(1, &thrd,
TRUE, INFINITE)
+#define mutex_t CRITICAL_SECTION
+#define mutex_init(mutex) InitializeCriticalSection(& mutex)
+#define mutex_lock(mutex) EnterCriticalSection(& mutex)
+#define mutex_unlock(mutex) LeaveCriticalSection(& mutex)
+#define mutex_delete(mutex) DeleteCriticalSection(& mutex)
+#define semaphore_t HANDLE
+#define semaphore_init(sema, max, place) ((sema) = CreateSemaphore(NULL,
(max), (place), NULL))
+#define semaphore_lock(sema) WaitForSingleObject((sema), INFINITE)
+#define semaphore_unlock(sema) ReleaseSemaphore((sema), 1, NULL)
+#define semaphore_delete(sema) CloseHandle(sema)
+
+#endif /* _THREADING_H_ */
Property changes on:
software_suite_v2/tuxware/tuxosl-ose/trunk/include/win32/threading.h
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/src/equalizer.cpp
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/src/equalizer.cpp
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/src/equalizer.cpp
2009-02-15 17:55:53 UTC (rev 3637)
@@ -31,7 +31,7 @@
#include "../dependencies/adspengine/include/libadspengine.h"
#include "../include/config.h"
#include "../include/log.h"
-#include "../include/platform_independent.h"
+#include "../include/misc.h"
/**
* \name Libadspengine configuration.
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/src/log.cpp
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/src/log.cpp 2009-02-15
16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/src/log.cpp 2009-02-15
17:55:53 UTC (rev 3637)
@@ -30,7 +30,7 @@
#include <time.h>
#include "../include/log.h"
-#include "../include/platform_independent.h"
+#include "../include/misc.h"
/** Name of log file for target LOG_TARGET_TUX */
#define LOG_FILE "libtuxosl.log"
Deleted: software_suite_v2/tuxware/tuxosl-ose/trunk/src/platform_independent.cpp
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/src/platform_independent.cpp
2009-02-15 16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/src/platform_independent.cpp
2009-02-15 17:55:53 UTC (rev 3637)
@@ -1,113 +0,0 @@
-/*
- * Tux OSL - platform_independent - Cross-compilable constants and functions
- * Copyright (C) 2009 C2ME Sa <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/**
- * \file platform_independent.cpp
- * \brief Cross-compilable constants and functions.
- * \author [email protected]
- * \ingroup platform_independent
- */
-
-#ifdef WIN32
-# include <time.h>
-#else
-# include <sys/time.h>
-#endif
-
-#include "../include/platform_independent.h"
-
-#ifdef WIN32
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
-# define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
-#else
-# define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
-#endif
-
-/**
- * \struct timezone.
- * \brief Timezone structure for windows.
- */
-struct timezone
-{
- int tz_minuteswest; /**< minutes W of Greenwich */
- int tz_dsttime; /**< type of dst correction */
-};
-
-/**
- * \fn static int gettimeofday(struct timeval *tv, struct timezone *tz)
- * \brief The gettimeofday function like linux.
- * \param tv Time value.
- * \param tz Time zone.
- * \return The success.
- */
-static int
-gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- FILETIME ft;
- unsigned __int64 tmpres = 0;
- static int tzflag;
-
- if (NULL != tv)
- {
- GetSystemTimeAsFileTime(&ft);
-
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
-
- /*converting file time to unix epoch*/
- tmpres -= DELTA_EPOCH_IN_MICROSECS;
- tmpres /= 10; /*convert into microseconds*/
- tv->tv_sec = (long)(tmpres / 1000000UL);
- tv->tv_usec = (long)(tmpres % 1000000UL);
- }
-
- if (NULL != tz)
- {
- if (!tzflag)
- {
- _tzset();
- tzflag++;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
-#endif /* WIN32 */
-
-/**
- * \fn double getTime(void)
- * \brief Get the current time OS.
- * \return The current time.
- */
-LIBLOCAL double
-getTime(void)
-{
- double result;
- struct timeval tv;
- struct timezone tz;
-
- gettimeofday(&tv, &tz);
- result = ((float)tv.tv_usec / 1000000) + (float)tv.tv_sec;
-
- return result;
-}
Modified: software_suite_v2/tuxware/tuxosl-ose/trunk/test/main.cpp
===================================================================
--- software_suite_v2/tuxware/tuxosl-ose/trunk/test/main.cpp 2009-02-15
16:47:27 UTC (rev 3636)
+++ software_suite_v2/tuxware/tuxosl-ose/trunk/test/main.cpp 2009-02-15
17:55:53 UTC (rev 3637)
@@ -21,7 +21,7 @@
#include "../include/win32/playback.h"
#include "../include/log.h"
#include "../include/types.h"
-#include "../include/platform_independent.h"
+#include "../include/misc.h"
#include "../include/fifo.h"
#include "../include/channel.h"
#include "../include/mixer.h"
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn