From d99b88d451fa7c47c06ca0d8f32bd5c9c85e3a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 30 Jan 2012 01:23:31 +0000 Subject: [PATCH] [GB.GSL] * NEW: Skeleton for a new component based on the GNU Scientific Library. It will be developed by Randall Morgan. git-svn-id: svn://localhost/gambas/trunk@4428 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- TEMPLATE/conf/gb.gsl.conf | 76 +++++++++++++++++++++++++++++++++++++ gb.gsl/NEWS | 0 gb.gsl/component.am | 1 + gb.gsl/src/Makefile.am | 11 ++++++ gb.gsl/src/c_gsl.c | 58 ++++++++++++++++++++++++++++ gb.gsl/src/c_gsl.h | 37 ++++++++++++++++++ gb.gsl/src/gb.gsl.component | 5 +++ gb.gsl/src/main.c | 60 +++++++++++++++++++++++++++++ gb.gsl/src/main.h | 37 ++++++++++++++++++ gb.qt4/src/ext/gview.cpp | 2 +- 10 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 TEMPLATE/conf/gb.gsl.conf create mode 100644 gb.gsl/NEWS create mode 120000 gb.gsl/component.am create mode 100644 gb.gsl/src/Makefile.am create mode 100644 gb.gsl/src/c_gsl.c create mode 100644 gb.gsl/src/c_gsl.h create mode 100644 gb.gsl/src/gb.gsl.component create mode 100644 gb.gsl/src/main.c create mode 100644 gb.gsl/src/main.h diff --git a/TEMPLATE/conf/gb.gsl.conf b/TEMPLATE/conf/gb.gsl.conf new file mode 100644 index 000000000..9dc4a6039 --- /dev/null +++ b/TEMPLATE/conf/gb.gsl.conf @@ -0,0 +1,76 @@ +/* Copyrights */ +#define __COPYRIGHT (c) 2012 +#define __AUTHOR Randall Morgan +#define __EMAIL + +/* Name of the component */ +#define __COMPONENT gb.gsl + +/* Name of the component with points replaced by underscore */ +#define __COMPONENT_UNDERSCORE gb_gsl + +/* Short name of the component */ +#define __NAME gsl + +/* Short name of the component in uppercase */ +#define __UNAME GSL + +/* Description of the component */ +#define __DESCRIPTION GNU Scientific Library component + +/* If the component detection uses pkg-config */ +#define __USE_PKGCONFIG 1 + +#if __USE_PKGCONFIG + + /* Name of the package for pkg-config */ + #define __PKGCONFIG_NAME gsl + + /* Minimum version needed */ + #define __PKGCONFIG_VERSION + +#else /* __USE_PKGCONFIG */ + + /* If your component uses C */ + #define __USE_C 1 + + /* If your component uses C++ */ + #define __USE_CPLUSPLUS 1 + + /* If your component uses multi-threading */ + #define __USE_THREAD 0 + + /* If your component uses X-Window */ + #define __USE_XWINDOW 0 + + /* Includes to search for */ + #define __SEARCH_INCLUDE + + /* Includes directories search path */ + #define __SEARCH_INCLUDE_PATH /usr/local/lib /usr/local /usr/lib /usr + + /* Includes sub-directories search */ + #define __SEARCH_INCLUDE_DIR /usr/local/include gsl/include include gsl*/include gsl/*/include + + /* Libraries to search for */ + #define __SEARCH_LIBRARY libgsl.$SHLIBEXT + + /* Libraries directories search path */ + #define __SEARCH_LIBRARY_PATH /usr/local /usr + + /* Libraries sub-directories search path */ + #define __SEARCH_LIBRARY_DIR local/lib lib + + /* Libraries to link with */ + #define __LIBRARY libgsl + + /* Includes to link with */ + #define __INCLUDE libgsl + +#endif /* __USE_PKGCONFIG */ + +/* Source file list */ +#define __SOURCES main.c main.h c_gsl.c c_gsl.h + +/* Main C/C++ source basename in uppercase */ +#define __MAIN_UNAME MAIN diff --git a/gb.gsl/NEWS b/gb.gsl/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/gb.gsl/component.am b/gb.gsl/component.am new file mode 120000 index 000000000..2f0eee34f --- /dev/null +++ b/gb.gsl/component.am @@ -0,0 +1 @@ +../component.am \ No newline at end of file diff --git a/gb.gsl/src/Makefile.am b/gb.gsl/src/Makefile.am new file mode 100644 index 000000000..e81740bb2 --- /dev/null +++ b/gb.gsl/src/Makefile.am @@ -0,0 +1,11 @@ +COMPONENT = gb.gsl +include $(top_srcdir)/component.am + +INCLUDES = @GSL_INC@ + +gblib_LTLIBRARIES = gb.gsl.la + +gb_gsl_la_LIBADD = @GSL_LIB@ +gb_gsl_la_LDFLAGS = -module @LD_FLAGS@ @GSL_LDFLAGS@ + +gb_gsl_la_SOURCES = main.c main.h c_gsl.c c_gsl.h diff --git a/gb.gsl/src/c_gsl.c b/gb.gsl/src/c_gsl.c new file mode 100644 index 000000000..00d769d5a --- /dev/null +++ b/gb.gsl/src/c_gsl.c @@ -0,0 +1,58 @@ +/*************************************************************************** + + gsl.c + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __C_GSL_C +#define __C_GSL_C + +#include "gambas.h" +#include "gb_common.h" +#include "c_gsl.h" +//#include "/usr/local/include/gsl/gsl_math.h" +#include + +#endif + +/*----------------------------------------------- + Small Integer Power Functions +-----------------------------------------------*/ +BEGIN_METHOD(GSL_INTPOW2, GB_INTEGER x;) + // Return x^2 using a small int safe method + // call gsl native function double gsl_pow_2(int x) + GB.ReturnFloat(gsl_pow_2(VARG(x))); +END_METHOD + +/************************************************** + Describe Class properties and methods to Gambas +**************************************************/ +GB_DESC CGslDesc[] = +{ + GB_DECLARE("GSL",0), GB_NOT_CREATABLE(), + + GB_METHOD("IntPow", "f", GSL_INTPOW2, "(x)f"), + + GB_END_DECLARE +}; + + diff --git a/gb.gsl/src/c_gsl.h b/gb.gsl/src/c_gsl.h new file mode 100644 index 000000000..2de5425bf --- /dev/null +++ b/gb.gsl/src/c_gsl.h @@ -0,0 +1,37 @@ +/*************************************************************************** + + c_gsl.h + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __C_GSL_H +#define __C_GSL_H + +#include "gambas.h" + +GB_INTERFACE GB EXPORT; + +extern GB_DESC CGslDesc[]; + +//extern GSL_INTPOW2; + +#endif /* __C_GSL_H */ diff --git a/gb.gsl/src/gb.gsl.component b/gb.gsl/src/gb.gsl.component new file mode 100644 index 000000000..5b233b3c4 --- /dev/null +++ b/gb.gsl/src/gb.gsl.component @@ -0,0 +1,5 @@ +[Component] +Key=__COMPONENT +Name=__DESCRIPTION +Author= +Alpha=1 diff --git a/gb.gsl/src/main.c b/gb.gsl/src/main.c new file mode 100644 index 000000000..89e247a1b --- /dev/null +++ b/gb.gsl/src/main.c @@ -0,0 +1,60 @@ +/*************************************************************************** + + main.c + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#define __MAIN_C + +#include "main.h" +#include "c_gsl.h" +#include "gambas.h" +#include "gb_common.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +GB_INTERFACE GB EXPORT; + +GB_DESC *GB_CLASSES[] EXPORT = +{ + CGslDesc, + NULL +}; + +int EXPORT GB_INIT(void) +{ + //CLASS_GSL = GB.FindClass("CGsl"); + return 0; +} + +void EXPORT GB_EXIT() +{ +} + + + +#ifdef _cpluscplus +} +#endif diff --git a/gb.gsl/src/main.h b/gb.gsl/src/main.h new file mode 100644 index 000000000..90d08b490 --- /dev/null +++ b/gb.gsl/src/main.h @@ -0,0 +1,37 @@ +/*************************************************************************** + + main.h + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __MAIN_H +#define __MAIN_H + +#include "gambas.h" + +#include "c_gsl.h" + +#ifndef __MAIN_C +extern GB_CLASS CGslDesc[]; +#endif + +#endif /* __MAIN_H */ diff --git a/gb.qt4/src/ext/gview.cpp b/gb.qt4/src/ext/gview.cpp index 0f8196096..5e143d56f 100644 --- a/gb.qt4/src/ext/gview.cpp +++ b/gb.qt4/src/ext/gview.cpp @@ -191,7 +191,7 @@ GEditor::GEditor(QWidget *parent) updateFont(); blinkTimer = new QTimer(this); - //connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blinkTimerTimeout())); + connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blinkTimerTimeout())); //startBlink(); scrollTimer = new QTimer(this);