[libfann] 157/242: win32 dll fixes
Christian Kastner
chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:37 UTC 2014
This is an automated email from the git hooks/post-receive script.
chrisk-guest pushed a commit to tag Version2_0_0
in repository libfann.
commit cf4e67cf0f5ee6eef40c1e307bb0386cb0b0ebf7
Author: Steffen Nissen <lukesky at diku.dk>
Date: Wed Jul 7 23:23:13 2004 +0000
win32 dll fixes
---
src/fann_train.c | 2 +-
src/fann_train_data.c | 4 +-
src/include/compat_time.h | 234 ++++++++++++++++++-----------------
src/include/fann.h | 4 +-
win32_dll/examples/bin/xor_float.net | 7 ++
win32_dll/readme.txt | 14 +--
6 files changed, 134 insertions(+), 131 deletions(-)
diff --git a/src/fann_train.c b/src/fann_train.c
index 267a5d1..8fd6100 100644
--- a/src/fann_train.c
+++ b/src/fann_train.c
@@ -551,7 +551,7 @@ void fann_update_weights_irpropm(struct fann *ann, unsigned int num_data)
unsigned int i = ann->total_connections;
while(i--){
- prev_step = fann_max(prev_steps[i], 0.001); /* prev_step may not be zero because then the training will stop */
+ prev_step = fann_max(prev_steps[i], (fann_type)0.001); /* prev_step may not be zero because then the training will stop */
slope = train_slopes[i];
prev_slope = prev_train_slopes[i];
next_step = 0.0;
diff --git a/src/fann_train_data.c b/src/fann_train_data.c
index 11ca2b0..9ade7c1 100644
--- a/src/fann_train_data.c
+++ b/src/fann_train_data.c
@@ -184,7 +184,7 @@ FANN_EXTERNAL float FANN_API fann_test_data(struct fann *ann, struct fann_train_
/* Train directly on the training data.
*/
-FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error))
+FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (FANN_API *callback)(unsigned int epochs, float error))
{
float error;
unsigned int i;
@@ -251,7 +251,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_tra
/* Wrapper to make it easy to train directly on a training data file.
*/
-FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error))
+FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (FANN_API *callback)(unsigned int epochs, float error))
{
struct fann_train_data *data = fann_read_train_from_file(filename);
if(data == NULL){
diff --git a/src/include/compat_time.h b/src/include/compat_time.h
index 7402091..58b1f24 100644
--- a/src/include/compat_time.h
+++ b/src/include/compat_time.h
@@ -1,56 +1,57 @@
-/*
-
-Originally timeval.h by Wu Yongwei
-
-Fast Artificial Neural Network Library (fann)
-Copyright (C) 2003 Steffen Nissen (lukesky at diku.dk)
-
-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.1 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
-*/
-
-/*
- * timeval.h 1.0 01/12/19
- *
- * Defines gettimeofday, timeval, etc. for Win32
- *
- * By Wu Yongwei
- *
- */
-
-#ifndef _TIMEVAL_H
-#define _TIMEVAL_H
-
-#ifdef _WIN32
-
-/* Modified to compile as ANSI C without include of windows.h
- If this gives problems with future Windows/MSC versions, then
- uncomment the USE_WINDOWS_H definition to switch back. */
-/* #define USE_WINDOWS_H */
-#ifdef USE_WINDOWS_H
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
-#else
- #define VOID void
- #define WINAPI __stdcall
- #define OUT
- #define WINBASEAPI
-
- typedef long LONG;
- typedef unsigned long DWORD;
- typedef __int64 LONGLONG;
-
+/*
+
+Originally timeval.h by Wu Yongwei
+
+Fast Artificial Neural Network Library (fann)
+Copyright (C) 2003 Steffen Nissen (lukesky at diku.dk)
+
+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.1 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
+*/
+
+/*
+ * timeval.h 1.0 01/12/19
+ *
+ * Defines gettimeofday, timeval, etc. for Win32
+ *
+ * By Wu Yongwei
+ *
+ */
+
+#ifndef _TIMEVAL_H
+#define _TIMEVAL_H
+
+#ifdef _WIN32
+
+/* Modified to compile as ANSI C without include of windows.h
+ If this gives problems with future Windows/MSC versions, then
+ uncomment the USE_WINDOWS_H definition to switch back. */
+/* #define USE_WINDOWS_H */
+#ifdef USE_WINDOWS_H
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+#else
+#ifndef _INC_WINDOWS
+ #define VOID void
+ #define WINAPI __stdcall
+ #define OUT
+ #define WINBASEAPI
+
+ typedef long LONG;
+ typedef unsigned long DWORD;
+ typedef __int64 LONGLONG;
+
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
@@ -72,66 +73,67 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
WINBASEAPI VOID WINAPI
GetSystemTimeAsFileTime(OUT LPFILETIME lpSystemTimeAsFileTime);
-#endif /* USE_WINDOWS_H */
-
-#include <time.h>
-
-#ifndef __GNUC__
-#define EPOCHFILETIME (116444736000000000i64)
-#else
-#define EPOCHFILETIME (116444736000000000LL)
-#endif
-
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* microseconds */
-};
-
-struct timezone {
- int tz_minuteswest; /* minutes W of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- FILETIME ft;
- LARGE_INTEGER li;
- __int64 t;
- static int tzflag;
-
- if (tv)
- {
- GetSystemTimeAsFileTime(&ft);
-
- /* The following two lines have been modified to use the named
- union member. Unnamed members are not ANSI C compatible. */
- li.u.LowPart = ft.dwLowDateTime;
- li.u.HighPart = ft.dwHighDateTime;
- t = li.QuadPart; /* In 100-nanosecond intervals */
- t -= EPOCHFILETIME; /* Offset to the Epoch time */
- t /= 10; /* In microseconds */
- tv->tv_sec = (long)(t / 1000000);
- tv->tv_usec = (long)(t % 1000000);
- }
-
- if (tz)
- {
- if (!tzflag)
- {
- _tzset();
- tzflag++;
- }
- tz->tz_minuteswest = _timezone / 60;
- tz->tz_dsttime = _daylight;
- }
-
- return 0;
-}
-
-#else /* _WIN32 */
-
-#include <sys/time.h>
-
-#endif /* _WIN32 */
-
-#endif /* _TIMEVAL_H */
+#endif /* _INC_WINDOWS */
+#endif /* USE_WINDOWS_H */
+
+#include <time.h>
+
+#ifndef __GNUC__
+#define EPOCHFILETIME (116444736000000000i64)
+#else
+#define EPOCHFILETIME (116444736000000000LL)
+#endif
+
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* microseconds */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ LARGE_INTEGER li;
+ __int64 t;
+ static int tzflag;
+
+ if (tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+
+ /* The following two lines have been modified to use the named
+ union member. Unnamed members are not ANSI C compatible. */
+ li.u.LowPart = ft.dwLowDateTime;
+ li.u.HighPart = ft.dwHighDateTime;
+ t = li.QuadPart; /* In 100-nanosecond intervals */
+ t -= EPOCHFILETIME; /* Offset to the Epoch time */
+ t /= 10; /* In microseconds */
+ tv->tv_sec = (long)(t / 1000000);
+ tv->tv_usec = (long)(t % 1000000);
+ }
+
+ if (tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+#else /* _WIN32 */
+
+#include <sys/time.h>
+
+#endif /* _WIN32 */
+
+#endif /* _TIMEVAL_H */
diff --git a/src/include/fann.h b/src/include/fann.h
index 9fdf739..d426a7b 100644
--- a/src/include/fann.h
+++ b/src/include/fann.h
@@ -266,7 +266,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_data(struct fann *ann, struct fann_tra
If the callback returns -1, then the training is terminated, otherwise
it continues until the normal stop criteria.
*/
-FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error));
+FANN_EXTERNAL void FANN_API fann_train_on_data_callback(struct fann *ann, struct fann_train_data *data, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (FANN_API *callback)(unsigned int epochs, float error));
/* Does the same as train_on_data, but reads the data directly from a file.
*/
@@ -275,7 +275,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
/* Does the same as train_on_data_callback, but
reads the data directly from a file.
*/
-FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (*callback)(unsigned int epochs, float error));
+FANN_EXTERNAL void FANN_API fann_train_on_file_callback(struct fann *ann, char *filename, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, int (FANN_API *callback)(unsigned int epochs, float error));
/* shuffles training data, randomizing the order
*/
diff --git a/win32_dll/examples/bin/xor_float.net b/win32_dll/examples/bin/xor_float.net
new file mode 100644
index 0000000..e2f26ae
--- /dev/null
+++ b/win32_dll/examples/bin/xor_float.net
@@ -0,0 +1,7 @@
+FANN_FLO_1.1
+3 0.700000 1.000000 0 5 5 5.00000000000000000000e-001 5.00000000000000000000e-001
+3 6 2
+0 0 0
+3 3 3 3 3 0
+6 0
+(0 4.44420337677001950000e+000) (1 4.73887491226196290000e+000) (2 -1.20584356784820560000e+000) (0 -6.32938385009765630000e-001) (1 -7.37979412078857420000e-001) (2 2.66613572835922240000e-001) (0 -8.96201014518737790000e-001) (1 -8.29967260360717770000e-001) (2 6.71092569828033450000e-001) (0 4.32361066341400150000e-002) (1 -4.60810512304306030000e-002) (2 -1.31924357265233990000e-002) (0 -2.09028571844100950000e-002) (1 -3.54402959346771240000e-002) (2 5.18605820834636690000e-002) (3 [...]
diff --git a/win32_dll/readme.txt b/win32_dll/readme.txt
index dbfbbf9..57a803b 100755
--- a/win32_dll/readme.txt
+++ b/win32_dll/readme.txt
@@ -2,14 +2,8 @@
Fann win32 dll readme:
Rebuilding the fann win32 dll's require Microsoft Visual Studio C++ 2003/7.1.
-The prebuilt dll's and import libraries in win32/bin can be used by previous
-versions.
-
-A command line version of the VS C++ 2003/7.1 compiler can be downloaded
-from Microsoft at http://msdn.microsoft.com/visualc/vctoolkit2003/. A link
-to the Microsoft Windows Platform SDK is provided on the same web page.
-See instructions at the end of the readme file for further instructions on
-rebuilding the fann win32 dll's on a command line.
+The build process places dll's and import libraries in win32/bin. Once built the
+dll's can be used by earlier compilers and other development tools.
Project configurations:
@@ -44,9 +38,9 @@ Application usage:
To use a dll in an application include one of the doublefann.h, fixedfann.h
or floatfann.h header files in the source code and depending on the
-number format selected and the settings (debug, realease, single or
+number format selected and the settings (debug, release, single or
multithreaded) in the application link with the matching import library.
-When executing the application make sure the required dll is in search
+When executing the application make sure the required dll is in the search
path. For example copy the dll to the same directory as the application or
add win32/bin to the search path (for example on WinXP use the System
applet Configuration Manager and select Advanced and Environment Variables).
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfann.git
More information about the debian-science-commits
mailing list