summaryrefslogtreecommitdiff
path: root/packages/forte
diff options
context:
space:
mode:
authorSteffen Sledz <sledz@dresearch.de>2009-02-17 08:17:38 +0100
committerSteffen Sledz <sledz@dresearch.de>2009-02-17 08:17:38 +0100
commit2cfc560391c1ce0a7737f17952c22e96839f7b83 (patch)
treebf2c2a933d6b31c90b00f21ceab1bc3f65dff941 /packages/forte
parent2975e105f9abf0daf87e08250ffa1ebe67302b6a (diff)
forte: new package
4DIAC-RTE (FORTE) is a small portable implementation of an IEC 61499 runtime environment, see http://www.fordiac.org/8.0.html
Diffstat (limited to 'packages/forte')
-rw-r--r--packages/forte/forte-0.3.5/forte-0.3.5_socket_reuse.patch20
-rw-r--r--packages/forte/forte-0.3.5/forte-0.3.5_stdlib_inc_fix.patch22
-rw-r--r--packages/forte/forte-0.3.5/forte-0.3.5_timer.patch48
-rw-r--r--packages/forte/forte-0.3/forte-0.3-patch_20081008.diff109
-rw-r--r--packages/forte/forte.inc15
-rw-r--r--packages/forte/forte_0.3.5.bb10
-rw-r--r--packages/forte/forte_0.3.bb10
7 files changed, 234 insertions, 0 deletions
diff --git a/packages/forte/forte-0.3.5/forte-0.3.5_socket_reuse.patch b/packages/forte/forte-0.3.5/forte-0.3.5_socket_reuse.patch
new file mode 100644
index 0000000000..a3dcd10917
--- /dev/null
+++ b/packages/forte/forte-0.3.5/forte-0.3.5_socket_reuse.patch
@@ -0,0 +1,20 @@
+diff -Naur FORTE-0.3.5.orig/src/arch/pc/pcsochan.cpp FORTE-0.3.5/src/arch/pc/pcsochan.cpp
+--- FORTE-0.3.5.orig/src/arch/pc/pcsochan.cpp 2009-01-13 16:17:18.000000000 +0000
++++ FORTE-0.3.5/src/arch/pc/pcsochan.cpp 2009-02-16 10:08:53.000000000 +0000
+@@ -128,6 +128,16 @@
+ }
+ // switch between client/server:
+ if (pa_stConnectionInformation.m_enServiceType == e_Server) {
++ unsigned int opt = 1;
++
++ if (setsockopt(sock_id, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) != 0)
++ {
++ char acError[80] = { "TCP-Socket setsockopt() failed: " };
++ strcat(acError, strerror(errno));
++ DEVLOG_ERROR(cg_nID_CSocketHandler, 0x10, acError);
++ return -1;
++ }
++
+ sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ if (bind(sock_id, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr)) != 0) {
+ DEVLOG_ERROR_2(cg_nID_CSocketHandler, 0x02, "TCP-Socket bind() failed: %s", strerror(errno) );
diff --git a/packages/forte/forte-0.3.5/forte-0.3.5_stdlib_inc_fix.patch b/packages/forte/forte-0.3.5/forte-0.3.5_stdlib_inc_fix.patch
new file mode 100644
index 0000000000..3ebd47325a
--- /dev/null
+++ b/packages/forte/forte-0.3.5/forte-0.3.5_stdlib_inc_fix.patch
@@ -0,0 +1,22 @@
+diff -Naur FORTE-0.3.5.orig/src/core/datatypes/forte_lreal.cpp FORTE-0.3.5/src/core/datatypes/forte_lreal.cpp
+--- FORTE-0.3.5.orig/src/core/datatypes/forte_lreal.cpp 2008-12-11 16:05:26.000000000 +0000
++++ FORTE-0.3.5/src/core/datatypes/forte_lreal.cpp 2009-02-16 11:01:44.000000000 +0000
+@@ -8,6 +8,7 @@
+ * Contributors:
+ * <date>: <author>, <author email> - changes
+ *******************************************************************************/
++#include <stdlib.h>
+ #include <math.h>
+ #include "forte_lreal.h"
+
+diff -Naur FORTE-0.3.5.orig/src/core/datatypes/forte_real.cpp FORTE-0.3.5/src/core/datatypes/forte_real.cpp
+--- FORTE-0.3.5.orig/src/core/datatypes/forte_real.cpp 2008-12-11 16:05:40.000000000 +0000
++++ FORTE-0.3.5/src/core/datatypes/forte_real.cpp 2009-02-16 11:12:16.000000000 +0000
+@@ -8,6 +8,7 @@
+ * Contributors:
+ * <date>: <author>, <author email> - changes
+ *******************************************************************************/
++#include <stdlib.h>
+ #include <math.h>
+ #include "forte_real.h"
+
diff --git a/packages/forte/forte-0.3.5/forte-0.3.5_timer.patch b/packages/forte/forte-0.3.5/forte-0.3.5_timer.patch
new file mode 100644
index 0000000000..2064cda581
--- /dev/null
+++ b/packages/forte/forte-0.3.5/forte-0.3.5_timer.patch
@@ -0,0 +1,48 @@
+diff -Naur FORTE-0.3.5.orig/src/arch/pc/pctimeha.cpp FORTE-0.3.5/src/arch/pc/pctimeha.cpp
+--- FORTE-0.3.5.orig/src/arch/pc/pctimeha.cpp 2009-01-13 16:17:18.000000000 +0000
++++ FORTE-0.3.5/src/arch/pc/pctimeha.cpp 2009-02-16 10:16:37.000000000 +0000
+@@ -11,6 +11,7 @@
+ #include "pctimeha.h"
+ #include "../../core/devexec.h"
+ #include <time.h>
++#include <sys/time.h>
+
+ const TINT32 CPCTimerHandler::csm_nTicksPerSecond = 1000;
+
+@@ -28,14 +29,34 @@
+ disableHandler();
+ }
+
++static inline unsigned long long GetTicks(struct timeval* stTmVal, TINT32 ticksPerSecond)
++{
++ unsigned long long ret = stTmVal->tv_sec * 1000LL;// sec -> ms
++ ret += stTmVal->tv_usec/1000;// + us -> ms
++ ret /= 1000/ticksPerSecond; // ms -> ticks
++ return ret;
++}
++
+ bool CPCTimerHandler::run(){
+ struct timespec stReq;
++ struct timeval stTmNow;
++ unsigned long long tickStart;
++ unsigned long long tickNow;
++ unsigned long long tickCalled = 0;
+ stReq.tv_sec = 0;
+- stReq.tv_nsec = 1000000 / (csm_nTicksPerSecond / 1000);
++ stReq.tv_nsec = 1000000000 / (csm_nTicksPerSecond);
++
++ gettimeofday(&stTmNow, NULL);
++ tickNow = tickStart = GetTicks(&stTmNow, csm_nTicksPerSecond);
+
+ while(m_bAlive){
+- nanosleep(&stReq, NULL);
++ if( (tickNow-tickStart) <= (tickCalled+1) ) {
++ nanosleep(&stReq, NULL);
++ }
+ nextTick();
++ ++tickCalled;
++ gettimeofday(&stTmNow, NULL);
++ tickNow = GetTicks(&stTmNow, csm_nTicksPerSecond);
+ }
+ return true;
+ }
diff --git a/packages/forte/forte-0.3/forte-0.3-patch_20081008.diff b/packages/forte/forte-0.3/forte-0.3-patch_20081008.diff
new file mode 100644
index 0000000000..8478e5f531
--- /dev/null
+++ b/packages/forte/forte-0.3/forte-0.3-patch_20081008.diff
@@ -0,0 +1,109 @@
+diff -Naur forte-0.3.orig/src/arch/netos/txsocha.cpp forte-0.3/src/arch/netos/txsocha.cpp
+--- forte-0.3.orig/src/arch/netos/txsocha.cpp 2008-07-10 07:33:44.000000000 +0000
++++ forte-0.3/src/arch/netos/txsocha.cpp 2008-09-24 13:29:32.000000000 +0000
+@@ -167,7 +167,7 @@
+ strcpy(ip, pa_stConnectionInformation.m_pcConnectionID);
+ sock_addr.sin_family = AF_INET;
+ sock_addr.sin_port = htons(atoi(splitString(ip)));
+- memset(&(sock_addr.sin_zero), '\0', 8);
++ memset(&(sock_addr.sin_zero), '\0', sizeof(sock_addr.sin_zero));
+ fprintf(stderr,"CTXSocketHandler:: Opening TCP-Connection at IP: %s\n",pa_stConnectionInformation.m_pcConnectionID);
+
+ if ((sock_id = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
+diff -Naur forte-0.3.orig/src/arch/pc/pcsochan.cpp forte-0.3/src/arch/pc/pcsochan.cpp
+--- forte-0.3.orig/src/arch/pc/pcsochan.cpp 2008-07-10 07:33:44.000000000 +0000
++++ forte-0.3/src/arch/pc/pcsochan.cpp 2008-09-30 10:23:36.000000000 +0000
+@@ -116,9 +116,9 @@
+ strcpy(ip, pa_stConnectionInformation.m_pcConnectionID);
+ sock_addr.sin_family = AF_INET;
+ sock_addr.sin_port = htons(atoi(splitString(ip)));
+- memset(&(sock_addr.sin_zero), '\0', 8);
++ memset(&(sock_addr.sin_zero), '\0', sizeof(sock_addr.sin_zero));
+
+- char acInfo[64] = { "CPCSocketHandler:: Opening TCP-Connection at IP: " };
++ char acInfo[128] = { "CPCSocketHandler:: Opening TCP-Connection at IP: " };
+ strcat(acInfo, pa_stConnectionInformation.m_pcConnectionID);
+ DEVLOG_INFO(cg_nID_CSocketHandler, 0x10, acInfo);
+
+@@ -130,6 +130,16 @@
+ }
+ // switch between client/server:
+ if (pa_stConnectionInformation.m_enServiceType == e_Server) {
++ unsigned int opt = 1;
++
++ if (setsockopt(sock_id, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) != 0)
++ {
++ char acError[80] = { "TCP-Socket setsockopt() failed: " };
++ strcat(acError, strerror(errno));
++ DEVLOG_ERROR(cg_nID_CSocketHandler, 0x10, acError);
++ return -1;
++ }
++
+ sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ if (bind(sock_id, (struct sockaddr *)&sock_addr, sizeof(struct sockaddr))
+ != 0) {
+@@ -191,8 +201,15 @@
+ int CPCSocketHandler::receiveDataOnTCP(SSocketHandlerListEntry &pa_stData) {
+ DEVLOG_INFO(cg_nID_CSocketHandler, 0x10, "CPCSocketHandler:: Entering ReceiveDataOnTCP\n");
+
++ int sock_id;
++
++ if (pa_stData.m_bAcceptedConnection)
++ sock_id = pa_stData.m_nAcceptID;
++ else
++ sock_id = pa_stData.m_nSocketID;
++
+ receveagain: pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_nFilledSize
+- =recv(pa_stData.m_nAcceptID, pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_pcData, pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_nMaxSize, 0);
++ =recv(sock_id, pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_pcData, pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_nMaxSize, 0);
+
+ if (pa_stData.m_stConnectionInformation.m_pstRecvBuffer->m_nFilledSize == -1) {
+ if (errno == EINTR) {
+diff -Naur forte-0.3.orig/src/arch/pc/pctimeha.cpp forte-0.3/src/arch/pc/pctimeha.cpp
+--- forte-0.3.orig/src/arch/pc/pctimeha.cpp 2008-04-22 13:31:52.000000000 +0000
++++ forte-0.3/src/arch/pc/pctimeha.cpp 2008-10-08 12:27:09.000000000 +0000
+@@ -11,6 +11,7 @@
+ #include "pctimeha.h"
+ #include "../../core/devexec.h"
+ #include <time.h>
++#include <sys/time.h>
+
+ const TINT32 CPCTimerHandler::csm_nTicksPerSecond = 1000;
+
+@@ -28,14 +29,34 @@
+ disableHandler();
+ }
+
++static inline unsigned long long GetTicks(struct timeval* stTmVal, TINT32 ticksPerSecond)
++{
++ unsigned long long ret = stTmVal->tv_sec * 1000LL;// sec -> ms
++ ret += stTmVal->tv_usec/1000;// + us -> ms
++ ret /= 1000/ticksPerSecond; // ms -> ticks
++ return ret;
++}
++
+ bool CPCTimerHandler::run(){
+ struct timespec stReq;
++ struct timeval stTmNow;
++ unsigned long long tickStart;
++ unsigned long long tickNow;
++ unsigned long long tickCalled = 0;
+ stReq.tv_sec = 0;
+- stReq.tv_nsec = 1000000 / (csm_nTicksPerSecond / 1000);
++ stReq.tv_nsec = 1000000000 / (csm_nTicksPerSecond);
++
++ gettimeofday(&stTmNow, NULL);
++ tickNow = tickStart = GetTicks(&stTmNow, csm_nTicksPerSecond);
+
+ while(m_bAlive){
+- nanosleep(&stReq, NULL);
++ if( (tickNow-tickStart) <= (tickCalled+1) ) {
++ nanosleep(&stReq, NULL);
++ }
+ nextTick();
++ ++tickCalled;
++ gettimeofday(&stTmNow, NULL);
++ tickNow = GetTicks(&stTmNow, csm_nTicksPerSecond);
+ }
+ return true;
+ }
diff --git a/packages/forte/forte.inc b/packages/forte/forte.inc
new file mode 100644
index 0000000000..fa97055729
--- /dev/null
+++ b/packages/forte/forte.inc
@@ -0,0 +1,15 @@
+DESCRIPTION = "4DIAC-RTE (FORTE) is a small portable implementation of an IEC 61499 runtime environment"
+HOMEPAGE = "http://www.fordiac.org/8.0.html"
+SECTION = "console/network"
+DEPENDS = ""
+RDEPENDS = ""
+LICENSE = "EPL"
+
+inherit autotools
+
+EXTRA_OEMAKE = 'LIBS+="-lpthread" CXXFLAGS+="-O0 -g" CPPFLAGS+="-DLOGDEBUG -I${S}/src/core -I${S}/src/core/datatypes -I${S}/src/fblib/events -I${S}/src/fblib/ita -I${S}/src/fblib/math -I${S}/src/fblib/net"'
+
+do_configure_prepend() {
+ chmod +x ${S}/configure
+ ln -s -f ${S}/src/arch/pc ${S}/src/arch/active_arch
+}
diff --git a/packages/forte/forte_0.3.5.bb b/packages/forte/forte_0.3.5.bb
new file mode 100644
index 0000000000..7aeeb8e42e
--- /dev/null
+++ b/packages/forte/forte_0.3.5.bb
@@ -0,0 +1,10 @@
+require forte.inc
+
+PR = "r0"
+
+SRC_URI = "http://downloads.sourceforge.net/fordiac/FORTE-0.3.5.zip \
+ file://forte-0.3.5_socket_reuse.patch;patch=1 \
+ file://forte-0.3.5_timer.patch;patch=1 \
+ file://forte-0.3.5_stdlib_inc_fix.patch;patch=1"
+
+S="${WORKDIR}/FORTE-${PV}"
diff --git a/packages/forte/forte_0.3.bb b/packages/forte/forte_0.3.bb
new file mode 100644
index 0000000000..c434fb39b8
--- /dev/null
+++ b/packages/forte/forte_0.3.bb
@@ -0,0 +1,10 @@
+require forte.inc
+
+PR = "r0"
+
+DEFAULT_PREFERENCE_oxnas = "1"
+
+SRC_URI = "http://kent.dl.sourceforge.net/sourceforge/fordiac/forte-0.3.zip \
+ file://forte-0.3-patch_20081008.diff;patch=1"
+
+S="${WORKDIR}/forte-${PV}"