From 7ded15d59695df9f66b0a7b21ba2010b15104b3e Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Sat, 21 Feb 2026 15:40:21 +0000 Subject: [PATCH] chore: remove LTK, MOC, and QVTKViewport2 components. --- src/Gui/Qt/QVTKViewport2/Makefile.am | 35 - src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro | 18 - .../Qt/QVTKViewport2/QVTKViewport2.pro.user | 453 ------ src/Gui/Qt/QVTKViewport2/main.cpp | 38 - src/Gui/Qt/QVTKViewport2/vtkviewport.cpp | 41 - src/Gui/Qt/QVTKViewport2/vtkviewport.h | 49 - src/Gui/Qt/QVTKViewport2/vtkviewport.ui | 32 - src/ltk/CMakeLists.txt | 12 - src/ltk/DenseMatrix.h | 111 -- src/ltk/Makefile.am | 6 - src/ltk/Object.c | 18 - src/ltk/Object.h | 78 - src/ltk/Vector.h | 195 --- src/ltk/container.h | 43 - src/ltk/ltk.h | 32 - src/ltk/ltk_bridge/ltkb.c | 339 ----- src/ltk/ltk_bridge/ltkb_test.c | 40 - src/ltk/ltk_bridge/setup.sh | 21 - src/ltk/ltkdebug.c | 4 - src/ltk/ltkdebug.h | 105 -- src/ltk/ltkmacros.h | 61 - src/ltk/ltktypes.h | 127 -- src/ltk/main.c | 72 - src/ltk/templates.c | 92 -- src/ltk/templates.h | 303 ---- src/ltk/test_comma.h | 117 -- src/ltk/testing/Makefile.am | 37 - src/ltk/testing/Object-cc.cpp | 40 - src/ltk/testing/Object.c | 11 - src/ltk/testing/Vector-cc.cpp | 79 -- src/ltk/testing/Vector.c | 14 - src/ltk/testing/testing-prototype.h | 37 - src/utils/moc/Makefile | 24 - src/utils/moc/moc_actions.h | 92 -- src/utils/moc/parse.y | 1257 ----------------- src/utils/moc/sample.cpp | 51 - src/utils/moc/scan.l | 252 ---- 37 files changed, 4336 deletions(-) delete mode 100644 src/Gui/Qt/QVTKViewport2/Makefile.am delete mode 100644 src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro delete mode 100644 src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro.user delete mode 100644 src/Gui/Qt/QVTKViewport2/main.cpp delete mode 100644 src/Gui/Qt/QVTKViewport2/vtkviewport.cpp delete mode 100644 src/Gui/Qt/QVTKViewport2/vtkviewport.h delete mode 100644 src/Gui/Qt/QVTKViewport2/vtkviewport.ui delete mode 100644 src/ltk/CMakeLists.txt delete mode 100644 src/ltk/DenseMatrix.h delete mode 100644 src/ltk/Makefile.am delete mode 100644 src/ltk/Object.c delete mode 100644 src/ltk/Object.h delete mode 100644 src/ltk/Vector.h delete mode 100644 src/ltk/container.h delete mode 100644 src/ltk/ltk.h delete mode 100644 src/ltk/ltk_bridge/ltkb.c delete mode 100644 src/ltk/ltk_bridge/ltkb_test.c delete mode 100755 src/ltk/ltk_bridge/setup.sh delete mode 100644 src/ltk/ltkdebug.c delete mode 100755 src/ltk/ltkdebug.h delete mode 100644 src/ltk/ltkmacros.h delete mode 100644 src/ltk/ltktypes.h delete mode 100644 src/ltk/main.c delete mode 100644 src/ltk/templates.c delete mode 100644 src/ltk/templates.h delete mode 100644 src/ltk/test_comma.h delete mode 100644 src/ltk/testing/Makefile.am delete mode 100644 src/ltk/testing/Object-cc.cpp delete mode 100644 src/ltk/testing/Object.c delete mode 100644 src/ltk/testing/Vector-cc.cpp delete mode 100644 src/ltk/testing/Vector.c delete mode 100644 src/ltk/testing/testing-prototype.h delete mode 100644 src/utils/moc/Makefile delete mode 100644 src/utils/moc/moc_actions.h delete mode 100644 src/utils/moc/parse.y delete mode 100644 src/utils/moc/sample.cpp delete mode 100644 src/utils/moc/scan.l diff --git a/src/Gui/Qt/QVTKViewport2/Makefile.am b/src/Gui/Qt/QVTKViewport2/Makefile.am deleted file mode 100644 index c6e1b8c..0000000 --- a/src/Gui/Qt/QVTKViewport2/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# SUBDIRS = . - -include $(top_srcdir)/Common.am - -DISTSOURCES = vtkviewport.cpp main.cpp -DISTHEADERS_MOC = -DISTHEADERS_NO_MOC = -FORMS = vtkviewport.ui - -FORMHEADERS = $(FORMS:.ui=.h) -MOC_CC = $(FORMS:.ui=.moc.cpp) $(DISTHEADERS_MOC:.h=.moc.cpp) - -bin_PROGRAMS = QTVtkViewport - -BUILT_SOURCES = $(FORMHEADERS) $(MOC_CC) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = $(FORMS) -QTVtkViewport_SOURCES = $(DISTSOURCES) $(DISTHEADERS_MOC) $(DISTHEADERS_NO_MOC) -nodist_QTVtkViewport_SOURCES = $(MOC_CC) - -QTVtkViewport_LDADD = $(top_srcdir)/libmutom.la - - -.ui.h: $(FORMS) - $(UIC) -o ui_$@ $< - -.ui.hpp: $(FORMS_HPP) - $(UIC) -o $@ $< - -.h.moc.cpp: - $(MOC) -o $@ $< - - -SUFFIXES = .h .ui .moc.cpp diff --git a/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro b/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro deleted file mode 100644 index 6a3a510..0000000 --- a/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro +++ /dev/null @@ -1,18 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2012-08-30T18:59:53 -# -#------------------------------------------------- - -QT += core gui - -TARGET = QVTKViewport2 -TEMPLATE = app - - -SOURCES += main.cpp\ - vtkviewport.cpp - -HEADERS += vtkviewport.h - -FORMS += vtkviewport.ui diff --git a/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro.user b/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro.user deleted file mode 100644 index 419ba5a..0000000 --- a/src/Gui/Qt/QVTKViewport2/QVTKViewport2.pro.user +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - System - false - 4 - true - 1 - true - 0 - true - 1 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop - Desktop - Qt4ProjectManager.Target.DesktopTarget - 0 - 0 - 0 - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Desktop Qt 4.7.4 for GCC (Qt SDK) Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 3 - false - - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Desktop Qt 4.7.4 for GCC (Qt SDK) Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 3 - false - - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Qt 4.7.0 in PATH (System) Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 4 - false - - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Qt 4.7.0 in PATH (System) Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 4 - false - - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Qt 4.7.0 (System) Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 5 - false - - - ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb - - - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - Make - - Qt4ProjectManager.MakeStep - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - Make - - Qt4ProjectManager.MakeStep - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Qt 4.7.0 (System) Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /home/andrea/devel/MuonTomography/mutom/uLib/trunk/src/Gui/Qt/QVTKViewport2 - 5 - false - - 6 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - No deployment - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - - - false - false - false - false - false - false - false - false - true - true - 0.01 - 0.01 - 10 - 10 - false - false - 25 - 25 - - - true - true - valgrind - valgrind - - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - QVTKViewport2 - - Qt4ProjectManager.Qt4RunConfiguration - 2 - - QVTKViewport2.pro - false - false - - - 3768 - true - false - false - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.EnvironmentId - {f8bb0047-7f6e-45df-9cc8-e746abebf883} - - - ProjectExplorer.Project.Updater.FileVersion - 10 - - diff --git a/src/Gui/Qt/QVTKViewport2/main.cpp b/src/Gui/Qt/QVTKViewport2/main.cpp deleted file mode 100644 index aabcdd9..0000000 --- a/src/Gui/Qt/QVTKViewport2/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#include -#include "vtkviewport.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - VtkViewport w; - w.show(); - - return a.exec(); -} diff --git a/src/Gui/Qt/QVTKViewport2/vtkviewport.cpp b/src/Gui/Qt/QVTKViewport2/vtkviewport.cpp deleted file mode 100644 index 77629da..0000000 --- a/src/Gui/Qt/QVTKViewport2/vtkviewport.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#include "vtkviewport.h" -#include "ui_vtkviewport.h" - -VtkViewport::VtkViewport(QWidget *parent) : - QWidget(parent), - ui(new Ui::VtkViewport) -{ - ui->setupUi(this); -} - -VtkViewport::~VtkViewport() -{ - delete ui; -} diff --git a/src/Gui/Qt/QVTKViewport2/vtkviewport.h b/src/Gui/Qt/QVTKViewport2/vtkviewport.h deleted file mode 100644 index 09c2d7d..0000000 --- a/src/Gui/Qt/QVTKViewport2/vtkviewport.h +++ /dev/null @@ -1,49 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#ifndef VTKVIEWPORT_H -#define VTKVIEWPORT_H - -#include - -namespace Ui { -class VtkViewport; -} - -class VtkViewport : public QWidget -{ - Q_OBJECT - -public: - explicit VtkViewport(QWidget *parent = 0); - ~VtkViewport(); - -private: - Ui::VtkViewport *ui; -}; - -#endif // VTKVIEWPORT_H diff --git a/src/Gui/Qt/QVTKViewport2/vtkviewport.ui b/src/Gui/Qt/QVTKViewport2/vtkviewport.ui deleted file mode 100644 index 095019b..0000000 --- a/src/Gui/Qt/QVTKViewport2/vtkviewport.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - VtkViewport - - - - 0 - 0 - 580 - 536 - - - - Form - - - - - 140 - 170 - 161 - 41 - - - - Hello World ! - - - - - - diff --git a/src/ltk/CMakeLists.txt b/src/ltk/CMakeLists.txt deleted file mode 100644 index 8921da0..0000000 --- a/src/ltk/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ - -set(HEADERS - ltktypes.h - ltkmacros.h - ltkdebug.h -) - -SET(SOURCES) - -set(LIBRARIES) - -uLib_add_shared_library(${uLib-module}) diff --git a/src/ltk/DenseMatrix.h b/src/ltk/DenseMatrix.h deleted file mode 100644 index 1214526..0000000 --- a/src/ltk/DenseMatrix.h +++ /dev/null @@ -1,111 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - - -#ifndef DENSEMATRIX_H -#define DENSEMATRIX_H - -#include "templates.h" -#include "Vector.h" - -BEGIN_NAMESPACE(ltk) - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// MATRIX ////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -C_BEGIN_DECLS - -#define LTK_MATRIX_DECLARE_FUNC(Type,ltkType,Class_name,csize,rsize) \ - inline Type ltkType##_##Class_name##_get(ltkType m, \ - unsigned int c, \ - unsigned int r) \ - { \ - assert(c + r * csize < csize * rsize); \ - return *((ltkType)m + c + r * csize); \ - } \ - inline void ltkType##_##Class_name##_set(ltkType m, \ - unsigned int c, \ - unsigned int r, \ - Type t) \ - { \ - assert (c + r * csize < csize * rsize); \ - *((ltkType)m + c + r * csize) = t; \ - } - - -#define LTK_MATRIX_DECLARE(Type,Type_name,csize,rsize) \ - typedef Type * Type_name; \ - LTK_SIMPLE_ALLOC_FUNC(Type, Type_name,ltk_matrix,csize * rsize) \ - LTK_MATRIX_DECLARE_FUNC(Type,Type_name,ltk_matrix,csize,rsize) - -C_END_DECLS - -#ifdef __cplusplus - -template class ltkDenseMatrix -: public ltkAbstractBuffer< T, csize * rsize > -{ -protected: - typedef ltkDenseMatrix ThisClass; - typedef ltkAbstractBuffer BaseClass; -public: - ltkDenseMatrix() {} - ~ltkDenseMatrix() { } - - inline T* getBuffer() { - return (T*)m_buffer; - } - inline const T* getBuffer() const { - return (const T*)m_buffer; - } - - ThisClass & operator =(const ThisClass &src) { - if (this != &src) { - CType_ltk_matrix_copy(m_buffer, (const CType) src.getBuffer()); - } - } - - typedef struct BaseClass::CommaInit CommaInit; - inline CommaInit operator = (T scalar) { - return this->operator <<(scalar); - } - - -private: - LTK_MATRIX_DECLARE(T,CType, csize, rsize); - T m_buffer [csize * rsize]; -}; - - - - -#endif // __cplusplus - -END_NAMESPACE - -#endif // DENSEMATRIX_H diff --git a/src/ltk/Makefile.am b/src/ltk/Makefile.am deleted file mode 100644 index 5f0e5d0..0000000 --- a/src/ltk/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -include $(top_srcdir)/Common.am - -library_includedir = $(includedir)/libmutom-${PACKAGE_VERSION}/ltk -library_include_HEADERS = ltktypes.h \ - ltkmacros.h \ - ltkdebug.h diff --git a/src/ltk/Object.c b/src/ltk/Object.c deleted file mode 100644 index 6269c9a..0000000 --- a/src/ltk/Object.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "Object.h" - - -static const struct _ltkObjectClass { - size_t class_size; - void (* constructor)(struct _Object *); - void (* destructor) (struct _Object *); - int (* GetElement) (struct _Object *); -} _ObjectClassInstance; - -const struct _ltkObjectClass *ltkObjectClass = &_ObjectClassInstance; - -ltkPointer Object_new(struct _ObjectClass klass) -{ - struct _Object *ob = (struct _Object)malloc(klass->class_size); - klass->constructor(ob); - return ob; -} diff --git a/src/ltk/Object.h b/src/ltk/Object.h deleted file mode 100644 index a39a87a..0000000 --- a/src/ltk/Object.h +++ /dev/null @@ -1,78 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#ifndef OBJECT_H -#define OBJECT_H - -#include // for std allocator // -#include // for memcpy // -#include - -#include "templates.h" - -BEGIN_NAMESPACE(ltk) - - -C_BEGIN_DECLS - -struct _ltkObject -{ - int element; -}; - -struct _ltkObjectClass { - size_t class_size; - void (* constructor)(struct _ltkObject *); - void (* destructor) (struct _ltkObject *); - int (* GetElement) (struct _ltkObject *); -}; - -struct _ltkObject *ltk_object_new() -{ - return NULL; -} - - -C_END_DECLS - -#ifdef __cplusplus - -class Object -{ - struct _ltkObject *d; - typedef struct _ltkObject ObjectType; - public: - Object() : d(new ObjectType()) { d->element = 5552368; } - int GetElement() { return d->element; } -}; - -#endif - - -END_NAMESPACE - -#endif //OBJECT_H diff --git a/src/ltk/Vector.h b/src/ltk/Vector.h deleted file mode 100644 index 229295b..0000000 --- a/src/ltk/Vector.h +++ /dev/null @@ -1,195 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -/* - * File: denseVector.h - * Author: andrea - * - * Created on July 6, 2012, 3:41 PM - */ - -#ifndef VECTOR_H -#define VECTOR_H - -#include // for std allocator // -#include // for memcpy // -#include - -#include "templates.h" - -BEGIN_NAMESPACE(ltk) - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// VECTOR ///////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -C_BEGIN_DECLS - -#define LTK_VECTOR_DECLARE(Type,Type_name,size) \ - typedef Type *Type_name; \ - LTK_SIMPLE_ALLOC_FUNC(Type,Type_name,ltk_vector,size) \ - inline unsigned int Type_name##_ltk_vector_size() { return size; } \ - inline Type Type_name##_ltk_vector_get(Type_name vector, unsigned int i) \ - { return *(vector+i); } \ - inline void Type_name##_ltk_vector_set(Type_name vector, unsigned int i, \ - Type data) { *(vector+i) = data; } - -C_END_DECLS - -#ifdef __cplusplus - -template class ltkVector -: public ltkAbstractBuffer< T, size > -{ - T m_vector [size]; -protected: - typedef ltkVector ThisClass; - typedef ltkAbstractBuffer BaseClass; -public: - ltkVector() {} - ltkVector(const ltkVector ©) { - CType_ltk_vector_copy(m_vector, (const CType) copy.getBuffer()); - } - - virtual ~ltkVector() { } - - inline unsigned int getSize() const { - return size; - } - inline T* getBuffer() { - return (T*)m_vector; - } - inline const T* getBuffer() const { - return (const T*)m_vector; - } - - - - ThisClass & operator =(const ThisClass &src) { - if (this != &src) { - CType_ltk_vector_copy(m_vector, (const CType) src.getBuffer()); - } - } - - typedef struct BaseClass::CommaInit CommaInit; - inline CommaInit operator = (T scalar) { - return this->operator <<(scalar); - } - - // MATH // - inline bool operator ==(const ThisClass &in) { - int test = 0; - for (int i = 0; i < size; ++i) test += this->at(i) != in(i); - return test == 0; - } - - inline bool operator !=(const ThisClass &in) { - return !this->operator ==(in); - } - - inline void operator +=(const ThisClass &in) { - for (int i = 0; i < size; ++i) this->at(i) += in(i); - } - inline void operator -=(const ThisClass &in) { - for (int i = 0; i < size; ++i) this->at(i) -= in(i); - } - inline void operator *=(const ThisClass &in) { - for (int i = 0; i < size; ++i) this->at(i) *= in(i); - } - inline void operator /=(const ThisClass &in) { - for (int i = 0; i < size; ++i) this->at(i) /= in(i); - } - - inline void operator +=(const T t) { - for (int i = 0; i < size; ++i) this->at(i) += t; - } - inline void operator -=(const T t) { - for (int i = 0; i < size; ++i) this->at(i) -= t; - } - inline void operator *=(const T t) { - for (int i = 0; i < size; ++i) this->at(i) *= t; - } - inline void operator /=(const T t) { - for (int i = 0; i < size; ++i) this->at(i) /= t; - } - - inline ThisClass & operator + (const ThisClass &in) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) + in(i); - return *out; - } - inline ThisClass & operator - (const ThisClass &in) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) - in(i); - return *out; - } - - // fix with constructor and product null element ------------- // - inline T operator * (const ThisClass &in) { - T out = 0; - for (int i = 0; i < size; ++i) out += this->at(i) * in(i); - return out; - } - inline T operator / (const ThisClass &in) { - T out = 0; - for (int i = 0; i < size; ++i) out += this->at(i) / in(i); - return out; - } - // ------------------------------------------------------------- // - - inline ThisClass & operator +(const T t) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) + t; - return *out; - } - inline ThisClass & operator -(const T t) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) - t; - return *out; - } - inline ThisClass & operator *(const T t) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) * t; - return *out; - } - inline ThisClass & operator /(const T t) { - ThisClass *out = new ThisClass(); - for (int i = 0; i < size; ++i) out->at(i) = this->at(i) / t; - return *out; - } -private: - LTK_VECTOR_DECLARE(T,CType, size) -}; - -#endif // __cplusplus - - - - -END_NAMESPACE // ltk -#endif /* DENSEVECTOR_H */ - diff --git a/src/ltk/container.h b/src/ltk/container.h deleted file mode 100644 index 58dbdc7..0000000 --- a/src/ltk/container.h +++ /dev/null @@ -1,43 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -/* - * File: comma_init.h - * Author: andrea - * - * Created on May 24, 2012, 3:12 PM - */ - -#ifndef CONTAINER_H -#define CONTAINER_H - -#include - - - -#endif /* CONTAINER_H */ - diff --git a/src/ltk/ltk.h b/src/ltk/ltk.h deleted file mode 100644 index 38a16f2..0000000 --- a/src/ltk/ltk.h +++ /dev/null @@ -1,32 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - - - -#include "templates.h" -#include "Vector.h" -#include "DenseMatrix.h" diff --git a/src/ltk/ltk_bridge/ltkb.c b/src/ltk/ltk_bridge/ltkb.c deleted file mode 100644 index f1b3d91..0000000 --- a/src/ltk/ltk_bridge/ltkb.c +++ /dev/null @@ -1,339 +0,0 @@ -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef MODVERSIONS -# include -#endif -#include -#include -#include - - - -/* methods of the character device */ -static int ltkb_open(struct inode *inode, struct file *filp); -static int ltkb_release(struct inode *inode, struct file *filp); -static int ltkb_mmap(struct file *filp, struct vm_area_struct *vma); -static ssize_t ltkb_read(struct file *filp, - char __user *buffer, - size_t count, - loff_t *offp); -static ssize_t ltkb_write(struct file *filp, - const char __user *buffer, - size_t count, - loff_t *offp); - - -// internal data -// length of the two memory areas -#define NPAGES 16 -// pointer to the vmalloc'd area - alway page aligned -static int *vmalloc_area; -// pointer to the kmalloc'd area, rounded up to a page boundary -static int *kmalloc_area; -// original pointer for kmalloc'd area as returned by kmalloc -static void *kmalloc_ptr; - - -#define BUF_LEN 80 -static int Device_Open = 0; - -static char Message[BUF_LEN]; -/* - * How far did the process reading the message get? - * Useful if the message is larger than the size of the - * buffer we get to fill in device_read. - */ -static char *Message_Ptr; - - -struct ltkb_dev { - struct cdev cdev; // device structure - struct semaphore semaphore; // lock semaphore for race control - char *message; // message passing from/to user - unsigned int size; // size of data stored - unsigned int acl_key; // user access control -}; - -struct ltkb_dev *_ltkb_devices; // devices array // - - - - - -/////// OPEN AND RELEASE /////////////////////////////////////////////////////// -static int ltkb_open(struct inode *inode, struct file *filp) -{ - // insert cdev data in dev structure and file->private_data // - struct ltkb_dev *dev; - dev = container_of (inode->i_cdev, struct ltkb_dev, cdev); - - // this shares dev for all methods // - filp->private_data = dev; - - pr_debug("ltk bridge opened"); - return 0; -} -/* character device last close method */ -static int ltkb_release(struct inode *inode, struct file *filp) -{ - pr_debug("ltk bridge released"); - return 0; -} -// -------------------------------------------------------------------------- // - - - -// kmalloc instancer // -int ltkb_kmem(struct file *filp, struct vm_area_struct *vma) -{ - int ret; - long length = vma->vm_end - vma->vm_start; - - /* check length - do not allow larger mappings than the number of - pages allocated */ - if (length > NPAGES * PAGE_SIZE) - return -EIO; - - /* map the whole physically contiguous area in one piece */ - if ((ret = remap_pfn_range(vma, - vma->vm_start, - virt_to_phys((void *)kmalloc_area) >> PAGE_SHIFT, - length, - vma->vm_page_prot)) < 0) { - return ret; - } - return 0; -} -// vmalloc instancer // -int ltkb_vmem(struct file *filp, struct vm_area_struct *vma) -{ - int ret; - long length = vma->vm_end - vma->vm_start; - unsigned long start = vma->vm_start; - char *vmalloc_area_ptr = (char *)vmalloc_area; - unsigned long pfn; - - /* check length - do not allow larger mappings than the number of - pages allocated */ - if (length > NPAGES * PAGE_SIZE) - return -EIO; - - /* loop over all pages, map it page individually */ - while (length > 0) { - pfn = vmalloc_to_pfn(vmalloc_area_ptr); - if ((ret = remap_pfn_range(vma, start, pfn, PAGE_SIZE, - PAGE_SHARED)) < 0) { - return ret; - } - start += PAGE_SIZE; - vmalloc_area_ptr += PAGE_SIZE; - length -= PAGE_SIZE; - } - return 0; -} - - - -// mmap function // -static int ltkb_mmap(struct file *filp, struct vm_area_struct *vma) -{ - /* at offset 0 we map the vmalloc'd area */ - if (vma->vm_pgoff == 0) { - return ltkb_vmem(filp, vma); - } - /* at offset NPAGES we map the kmalloc'd area */ - if (vma->vm_pgoff == NPAGES) { - return ltkb_kmem(filp, vma); - } - /* at any other offset we return an error */ - return -EIO; -} - - - - -////////////// CHAR DEVICE READ/WRITE ///////////////////////////////////////// -static ssize_t ltkb_read(struct file *filp, /* see include/linux/fs.h */ - char __user *buffer, /* buffer to fill with data */ - size_t length, /* length of the buffer */ - loff_t * offset) -{ - -#ifdef _DEBUG - printk(KERN_INFO "device_read(%p,%s,%d)", filp, buffer, (int)length); -#endif - - return 0; -} - -static ssize_t ltkb_write(struct file *filp, - const char __user *buffer, - size_t length, - loff_t * offset) -{ -#ifdef _DEBUG - printk(KERN_INFO "device_write(%p,%s,%d)", filp, buffer, (int)length); -#endif - return 0; -} -// ------------------------------------------------------------------------- // - - -#define LTKB_IOC_HEADER 'b' - -#define LTKB_IOC_RESET _IO(LTKB_IOC_HEADER, 0) -#define LTKB_IOC_PING _IOWR(LTKB_IOC_HEADER, 1, char) - -#define LTKB_IOC_MAXNR 1 - -////////////// IOCTL /////////////////////////////////////////////////////////// -int ltkb_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - char c = 0; - int retval = 0; - - /* - * extract the type and number bitfields, and don't decode - * wrong cmds: return ENOTTY (inappropriate ioctl) before access_ok() - */ - if (_IOC_TYPE(cmd) != LTKB_IOC_HEADER) return -ENOTTY; - if (_IOC_NR(cmd) > LTKB_IOC_MAXNR) return -ENOTTY; - - // TODO user access control // - - - switch(cmd) { - case LTKB_IOC_RESET: - if(!capable(CAP_SYS_ADMIN)) - return -EPERM; - // TODO free all memory mapping// - break; - case LTKB_IOC_PING: - retval = __get_user(c,(char __user *)arg); - c++; - retval = __put_user(c,(char __user *)arg); - break; - default: - return -ENOTTY; - } - return retval; - -} -// ------------------------------------------------------------------------- // - - - - - -#ifndef LTKB_MAJOR -#define LTKB_MAJOR 0 -#endif - -#ifndef LTKB_NR_DEVS -#define LTKB_NR_DEVS 4 -#endif - -#ifndef LTKB_DEVICE_NAME -#define LTKB_DEVICE_NAME "ltkb" -#endif - - - -/* the file operations, i.e. all character device methods */ -static struct file_operations ltkb_fops = { - .open = ltkb_open, - .release = ltkb_release, - .read = ltkb_read, - .write = ltkb_write, - .ioctl = ltkb_ioctl, - .mmap = ltkb_mmap, - .owner = THIS_MODULE, -}; - -static int _ltkb_major_number = LTKB_MAJOR; - -// Module init function //////////////////////////////////////////////////////// -static int __init ltkb_init(void) -{ - int i,ret = 0; - dev_t dev = 0; - - // REGISTER DEVICE // - if(_ltkb_major_number) - { - dev = MKDEV(_ltkb_major_number,0); - ret = register_chrdev_region(dev, LTKB_NR_DEVS, LTKB_DEVICE_NAME); - } - else { - ret = alloc_chrdev_region(&dev, 0, LTKB_NR_DEVS, LTKB_DEVICE_NAME ); - _ltkb_major_number = MAJOR(dev); - } - if (ret < 0) { - printk(KERN_WARNING "could not allocate major number %d for ltkb\n", - _ltkb_major_number); - return ret; - } - - // ALLOCATE DEVICES // - _ltkb_devices = kmalloc( LTKB_NR_DEVS * sizeof(struct ltkb_dev), GFP_KERNEL ); - if(!_ltkb_devices) { - printk(KERN_ERR "error allocating device structure in memory"); - return -ENOMEM; - } - memset(_ltkb_devices, 0, LTKB_NR_DEVS * sizeof(struct ltkb_dev)); - - // SETUP DEVICES // - for (i = 0 ; i < LTKB_NR_DEVS ; i++ ) - { - struct ltkb_dev *dev = &_ltkb_devices[i]; - int devno = MKDEV(_ltkb_major_number, i); - cdev_init (&dev->cdev, <kb_fops); - dev->cdev.owner = THIS_MODULE; - dev->cdev.ops = <kb_fops; - ret = cdev_add(&dev->cdev,devno,1); - if(ret) printk(KERN_NOTICE "Error %d adding ltkb%d device", ret, i); - init_MUTEX(&dev->semaphore); - } - printk( KERN_NOTICE "ltk bridge module loaded"); - return ret; -} - -// module release // -static void __exit ltkb_exit(void) -{ - // remove the character deivce // - int i; - dev_t devno = MKDEV(_ltkb_major_number,0); - if(_ltkb_devices) - { - for(i=0;i -#include -#include -#include -#include -#include -#include -#include - -#define LTKB_IOC_HEADER 'b' - -#define LTKB_IOC_RESET _IO(LTKB_IOC_HEADER, 0) -#define LTKB_IOC_PING _IOWR(LTKB_IOC_HEADER, 1, char) - -#define LTKB_IOC_MAXNR 1 - - -int main(void) -{ - int fd; - - if ((fd=open("ltkb0", O_RDWR|O_SYNC))<0) - { - perror("open"); - exit(-1); - } - - char buffer[200] = "hello"; - write(fd, (void *)&buffer, 6); - - char c = 'a'; - printf("%c ",c); - ioctl(fd, LTKB_IOC_PING, &c); - printf("%c ",c); - ioctl(fd, LTKB_IOC_PING, &c); - printf("%c\n",c); - close(fd); - return(0); -} - diff --git a/src/ltk/ltk_bridge/setup.sh b/src/ltk/ltk_bridge/setup.sh deleted file mode 100755 index 1886632..0000000 --- a/src/ltk/ltk_bridge/setup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -module="ltkb" -device="ltkb" -mode="664" - -/sbin/insmod ./$module.ko $* || exit 1 - -rm -f ./${device}[0-3] - -major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices) - -mknod ./${device}0 c $major 0 -mknod ./${device}1 c $major 1 -mknod ./${device}2 c $major 2 -mknod ./${device}3 c $major 3 - -group="mutom" -grep -q '^mutom:' /etc/group || group="adm" - -chgrp $group ./${device}[0-3] -chmod $mode ./${device}[0-3] \ No newline at end of file diff --git a/src/ltk/ltkdebug.c b/src/ltk/ltkdebug.c deleted file mode 100644 index 03b5024..0000000 --- a/src/ltk/ltkdebug.c +++ /dev/null @@ -1,4 +0,0 @@ - -#include "ltkdebug.h" - - diff --git a/src/ltk/ltkdebug.h b/src/ltk/ltkdebug.h deleted file mode 100755 index fe55a04..0000000 --- a/src/ltk/ltkdebug.h +++ /dev/null @@ -1,105 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#ifndef LTKDEBUG_H -#define LTKDEBUG_H - - -#include "ltkmacros.h" -#include "ltktypes.h" - -//! Provide a string for current function, non-concatenatable -#if defined (__GNUC__) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L) -# define __func_to_string__ ((const char*) (__func__)) -#else -# define __func_to_string__ ((const char*) ("???")) -#endif - -//! Provide a string for current function in pretty format, non-concatenatable -#if defined (__GNUC__) -# define __pfunc_to_string__ ((const char*) (__PRETTY_FUNCTION__)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L -# define __pfunc_to_string__ ((const char*) (__func__)) -#else -# define __pfunc_to_string__ ((const char*) ("???")) -#endif - - - -//////////////////////////////////////////////////////////////////////////////// -//// Pragma Messages for debug allerts during compilation ///////////////////// -//////////////////////////////////////////////////////////////////////////////// - -#ifdef PRAGMA_MESSAGES -#define DEBUG_DO_PRAGMA(x) _Pragma (#x) -#else -#define DEBUG_DO_PRAGMA(x) ; -#endif - -#define TODO(x) DEBUG_DO_PRAGMA(message ("\n\n [TODO] >> " #x " <<\n")) -#define OPTIMIZE(x) DEBUG_DO_PRAGMA(message ("\n\n [OPTIMIZE] > " #x " <\n")) -#define DUMP(x) DEBUG_DO_PRAGMA(message ("\n\n [DUMP] > " #x " <\n")) - -// ------------------------------------------------------------------------ // - - - -C_BEGIN_DECLS - - -typedef enum -{ - LOG_FLAG_ACTIVE = 1 << 0, - LOG_FLAG_FATAL = 1 << 1, - LOG_LEVEL_ERROR = 1 << 2, - LOG_LEVEL_CRITICAL = 1 << 3, - LOG_LEVEL_WARNING = 1 << 4, - LOG_LEVEL_MESSAGE = 1 << 5, - LOG_LEVEL_INFO = 1 << 6, - LOG_LEVEL_DEBUG = 1 << 7, - LOG_LEVEL_ANNOING = 1 << 8, - LOG_LEVEL_PARANOID = 1 << 9 -} LogLevelFlags; - - - - -void debug_log( - void *handler, - LogLevelFlags flags, - const char *function_name, - const char *message, - ...); - - - -C_END_DECLS - - - - -#endif // LTKDEBUG_H diff --git a/src/ltk/ltkmacros.h b/src/ltk/ltkmacros.h deleted file mode 100644 index c5e921d..0000000 --- a/src/ltk/ltkmacros.h +++ /dev/null @@ -1,61 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -/* - * File: macros.h - * Author: andrea - * - * Created on May 23, 2012, 9:01 AM - */ - -#ifndef LTK_MACROS_H -#define LTK_MACROS_H - -// C code in headers, while including them from C++ -#ifdef __cplusplus - -# define C_BEGIN_DECLS extern "C" { -# define C_END_DECLS } - -#define BEGIN_NAMESPACE(name) namespace name { -#define END_NAMESPACE } - -#else - -# define C_BEGIN_DECLS -# define C_END_DECLS - -#define BEGIN_NAMESPACE(name) -#define END_NAMESPACE - -#endif - - - - -#endif /* MACROS_H */ - diff --git a/src/ltk/ltktypes.h b/src/ltk/ltktypes.h deleted file mode 100644 index c243841..0000000 --- a/src/ltk/ltktypes.h +++ /dev/null @@ -1,127 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#ifndef LTK_TYPE_H -#define LTK_TYPE_H - -#include -#include - -//#include "templates.h" -#include "ltkmacros.h" - -#ifdef __cplusplus -# define LTK_TYPECAST(T, Type) static_cast< T >(Type) -#else -# define LTK_TYPECAST(T, Type) ((T)(Type)) -#endif - - -BEGIN_NAMESPACE(ltk) - -C_BEGIN_DECLS - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// TYPE DEFINITIONS ////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - - -typedef void * Pointer_t; -typedef id_t Id_t; -typedef size_t Size_t; - -#ifndef LTK_DOUBLE_PRECISION -typedef float Real_t; -#else -typedef double Real_t; -#endif - -#define LTK_SIGNED_CHAR_MIN LTK_TYPECAST(signed char, 0x80) -#define LTK_SIGNED_CHAR_MAX LTK_TYPECAST(signed char, 0x7f) - -#define LTK_UNSIGNED_CHAR_MIN LTK_TYPECAST(unsigned char, 0u) -#define LTK_UNSIGNED_CHAR_MAX LTK_TYPECAST(unsigned char, 0xffu) - -#define LTK_SHORT_MIN LTK_TYPECAST(short, 0x8000) -#define LTK_SHORT_MAX LTK_TYPECAST(short, 0x7fff) - -#define LTK_UNSIGNED_SHORT_MIN LTK_TYPECAST(unsigned short, 0u) -#define LTK_UNSIGNED_SHORT_MAX LTK_TYPECAST(unsigned short, 0xffffu) - -#define LTK_INT_MIN LTK_TYPECAST(int, ~(~0u >> 1)) -#define LTK_INT_MAX LTK_TYPECAST(int, ~0u >> 1) - -#define LTK_INT8_MIN LTK_TYPECAST(int8_t, 0x80) -#define LTK_INT8_MAX LTK_TYPECAST(int8_t, 0x7f) - -#define LTK_INT16_MIN LTK_TYPECAST(int16_t, 0x8000u) -#define LTK_INT16_MAX LTK_TYPECAST(int16_t, 0x7fffu) - -#define LTK_UNSIGNED_INT16_MIN LTK_TYPECAST(int16_t, 0u) -#define LTK_UNSIGNED_INT16_MAX LTK_TYPECAST(unsigned int16_t, 0xffffu) - -#define LTK_INT32_MIN LTK_TYPECAST(int32_t, 0x80000000u) -#define LTK_INT32_MAX LTK_TYPECAST(int32_t, 0x7fffffffu) - -#define LTK_UNSIGNED_INT32_MIN LTK_TYPECAST(unsigned int32_t, 0u) -#define LTK_UNSIGNED_INT32_MAX LTK_TYPECAST(unsigned int32_t, 0xffffffffu) - -#define LTK_INT64_MIN LTK_TYPECAST(int64_t, 0x8000000000000000u) -#define LTK_INT64_MAX LTK_TYPECAST(int64_t, 0x7fffffffffffffffu) - -#define LTK_UNSIGNED_INT8_MIN LTK_TYPECAST(int8_t, 0u) -#define LTK_UNSIGNED_INT8_MAX LTK_TYPECAST(int8_t, 0xffu) - -#define LTK_UNSIGNED_INT64_MIN LTK_TYPECAST(unsigned int64_t, 0u) -#define LTK_UNSIGNED_INT64_MAX LTK_TYPECAST(unsigned int64_t, \ - 0xffffffffffffffffu) - -#define LTK_UNSIGNED_INT_MIN LTK_TYPECAST(unsigned int, 0) -#define LTK_UNSIGNED_INT_MAX LTK_TYPECAST(unsigned int, ~0u) - -#define LTK_LONG_MIN LTK_TYPECAST(long, ~(~0ul >> 1)) -#define LTK_LONG_MAX LTK_TYPECAST(long, ~0ul >> 1) - -#define LTK_UNSIGNED_LONG_MIN LTK_TYPECAST(unsigned long, 0ul) -#define LTK_UNSIGNED_LONG_MAX LTK_TYPECAST(unsigned long, ~0ul) - -#define LTK_FLOAT_MIN LTK_TYPECAST(float, -1.0e+38f) -#define LTK_FLOAT_MAX LTK_TYPECAST(float, 1.0e+38f) - -#define LTK_DOUBLE_MIN LTK_TYPECAST(double, -1.0e+299) -#define LTK_DOUBLE_MAX LTK_TYPECAST(double, 1.0e+299) - - - - - -C_END_DECLS - -END_NAMESPACE - - -#endif //TYPE_H diff --git a/src/ltk/main.c b/src/ltk/main.c deleted file mode 100644 index 12c29cd..0000000 --- a/src/ltk/main.c +++ /dev/null @@ -1,72 +0,0 @@ - -#include "DenseMatrix.h" -#include "Vector.h" -#include "Object.h" - -#include "vectormath/simd/instrset.h" - -/* LTK_VECTOR_DECLARE(int,LtkInt4,4) */ - -/* LTK_MATRIX_DECLARE(int,LtkInt2x2,2,2) */ -/* LTK_MATRIX_DECLARE(int,LtkInt4x1,4,1) */ -/* LTK_MATRIX_DECLARE(int,LtkInt4x4,4,4) */ - -int test(int a) { return 0; } - - -int main(void) -{ - - // testing dense matrix // - /****************************************************/ - /* LtkInt2x2 a; */ - /* LtkInt4x1 b; */ - /* LtkInt4x4 c; */ - /* LtkInt4 v, w; */ - /* */ - /* v = LtkInt4_ltk_vector_new (); */ - /* w = LtkInt4_ltk_vector_new (); */ - /* */ - /* int i; */ - /* for (i = 0; i < LtkInt4_ltk_vector_size (); ++i) */ - /* { */ - /* LtkInt4_ltk_vector_set (v, i, 0); */ - /* LtkInt4_ltk_vector_set (w, i, 3); */ - /* } */ - /* */ - /* printf ("v = "); */ - /* for (i = 0; i < 4; ++i) */ - /* printf ("%d ", LtkInt4_ltk_vector_get (v, i)); */ - /* printf ("\n"); */ - /* */ - /* printf ("w = "); */ - /* for (i = 0; i < 4; ++i) */ - /* printf ("%d ", LtkInt4_ltk_vector_get (w, i)); */ - /* printf ("\n"); */ - /****************************************************/ - - // testing intrinsics // - printf("INSTRUCTION SET -> %d\n",INSTRSET); - __m128 aligned_float = _mm_setzero_ps(); - float *p = &aligned_float; - printf("%f,%f,%f,%f\n",p[0],p[1],p[2],p[3]); - - // adder // - __m128 a_1,a_2; - a_1 = _mm_set_ps(3,3,3,3); - a_2 = _mm_set_ps(1,2,3,4); - - - aligned_float = _mm_add_ps(a_1,a_2); - p = &aligned_float; printf("%f,%f,%f,%f\n",p[0],p[1],p[2],p[3]); - - - - // testing Objects // - //LTK_MATRIX_DECLARE(TypeName, type, r, c); - // Object *ob = New(ObjectClass); - // int el = ObjectClass->GetElement(ob); - - - return 0; -} diff --git a/src/ltk/templates.c b/src/ltk/templates.c deleted file mode 100644 index a154d1a..0000000 --- a/src/ltk/templates.c +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -#include -#include "templates.h" - - -LtkList ltk_list_new() -{ - LtkList list = malloc(sizeof(struct _template_list)); - list->size = 0; - list->start = NULL; - list->end = NULL; - return list; -} - -void ltk_list_nodepush(LtkList list,LtkListNode node) -{ - if(list == NULL) return; - node->next = list->start; - list->start = node; - if(list->end == NULL) list->end = node; - list->size++; -} - -LtkListNode ltk_list_get_start(LtkList list) -{ - if (list==NULL || list->start==NULL) return NULL; - return list->start; -} - -LtkListNode ltk_list_get_end(LtkList list) -{ - if (list==NULL || list->end==NULL) return NULL; - return list->end; -} - -void ltk_list_remove(LtkList list,LtkListNode node) -{ - if (list == NULL || list->start==NULL) return; - struct _template_list_node *node_tofree,*prev; - node_tofree=list->start; - while (node_tofree != node) { - if(node_tofree->next == NULL) return; - prev = node_tofree; - node_tofree = node_tofree->next; - } - if(node_tofree == list->start) list->start = node_tofree->next; - else prev->next = node_tofree->next; - free(node_tofree); -} - -void ltk_list_pop_start(LtkList list) -{ - if (list==NULL || list->start==NULL) return; - struct _template_list_node *nodetofree; - nodetofree=list->start; - list->start = list->start->next; - free(nodetofree); -} - -void ltk_list_pop_end(LtkList list) -{ - if (list==NULL || list->end==NULL) return; - struct _template_list_node *iter; - iter=list->start; - if(iter==list->end) { - free(iter); - list->start = list->end = NULL; - } - else { - while(iter->next!=list->end) iter=iter->next; - free(iter->next); - iter->next = NULL; - list->end = iter; - } - list->size--; -} - -int ltk_list_get_size(LtkList list) -{ - if(list==NULL) return 0; - return list->size; -} - - -LtkListIterator ltk_list_iterator_new(LtkList list) -{ - if(list==NULL || list->start == NULL) return NULL; - return (LtkListIterator)list->start; -} - - diff --git a/src/ltk/templates.h b/src/ltk/templates.h deleted file mode 100644 index 00abd01..0000000 --- a/src/ltk/templates.h +++ /dev/null @@ -1,303 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -/* - * - * Copyright (C) 2012 Andrea Rigoni Garola - * - * 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 of the License, 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, see . - * - */ - - -#ifndef TEMPLATES_H -#define TEMPLATES_H - -#include // for std allocator // -#include // for memcpy // -#include - -#include "ltkmacros.h" // default environment // -#include "container.h" // TODO !!! // - -#include - - - - - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// ALLOC FUNCTIONS ///////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -C_BEGIN_DECLS - -//inline ltkPointer ltk_malloc(unsigned int size) { return malloc(size); } -//inline void ltk_free (ltkPointer ptr) { free(ptr); } - -#define LTK_SIMPLE_ALLOC_FUNC(Type, ltkType, Class_name, size) \ - inline ltkType ltkType##_##Class_name##_new() \ - { \ - return LTK_TYPECAST(ltkType, malloc(sizeof(Type) * size)); \ - } \ - inline void ltkType##_##Class_name##_delete(ltkType t) \ - { free(t); } \ - inline void ltkType##_##Class_name##_copy(ltkType dst, const ltkType src) \ - { memcpy((ltkPointer)dst, (ltkPointer)src, sizeof(Type) * size ); } - -C_END_DECLS - - - - - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// ABSTRACT C BUFFER /////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -C_BEGIN_DECLS - -#define LTK_ABSTRACT_BUFFER_DECLARE_FUNC(Type,ltkType,Class_name,size) \ - inline int ltkType##_##Class_name##_size() { return size; } \ - inline Type ltkType##_##Class_name##_get(ltkType v, unsigned int c) \ - { assert(c < size); return *((ltkType)m + c); } \ - inline void ltkType##_##Class_name##_set(ltkType v, Type t, unsigned int c) \ - { assert(c < size); *((ltkType)m + c) = t; } - -// FINIRE !!! // - -C_END_DECLS - -#ifdef __cplusplus - -template class ltkAbstractBuffer -{ - typedef ltkAbstractBuffer ThisClass; -protected: - typedef T ContentType; - virtual T* getBuffer() = 0; - virtual const T* getBuffer() const = 0; - - struct CommaInit - { - inline explicit CommaInit(ltkAbstractBuffer *container,float s) - : container(container) { - this->index = 0; - this->container->getBuffer()[0] = s; - } - inline CommaInit & operator, (float s) { - this->index++; - assert(index < size); - this->container->getBuffer()[this->index] = s; - return *this; - } - ltkAbstractBuffer *container; - unsigned int index; - }; - -public: - inline CommaInit operator =(T scalar) { - return CommaInit(this, scalar); - } - inline CommaInit operator <<(T scalar) { - return CommaInit(this, scalar); - } - - inline T& at(const unsigned int i) { - return *(this->getBuffer() + i); - } - - inline T & operator[](unsigned int i) { - return *(this->getBuffer() + i); - } - inline const T & operator[](unsigned int i) const { - return *(this->getBuffer() + i); - } - inline T & operator()(unsigned int i) { - return *(this->getBuffer() + i); - } - inline const T & operator()(unsigned int i) const { - return *(this->getBuffer() + i); - } - - -}; - -#endif // __cplusplus - - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// ARRAY /////////////////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ - -// COMING SOON // - - - - - - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -/// DO NOT USE ANYTHING AFTER THIS LINE ... EXPERIMENTAL ////////////////// - - - - - - - - - -/* ////////////////////////////////////////////////////////////////////////// */ -/* //////////////////////////// CIRCULAR BUFFER ///////////////////////////// */ -/* ////////////////////////////////////////////////////////////////////////// */ -/* CIRCULAR BUFFER */ - -struct _ltk_template_buffer { - void *pos; - void *head; -}; - -#define LTK_BUFFER_DECLARE(Type, Type_name, size, overlap) \ -typedef struct _ltk_template_buffer *Type_name; \ -inline Type_name Type_name##_ltk_buffer_new() \ -{ Type_name out = (Type_name)ltk_malloc \ - (sizeof(Type) * (size + overlap) + 2); \ - out->head = (void *)out + 2 + overlap * sizeof(Type); \ - out->pos = out->head; \ -return out; } \ -inline void Type_name##_ltk_buffer_free(Type_name buffer) { ltk_free(buffer); }\ - - - -// TO BE CONTINUED.... // - - - - - - - - -///// LtkPTree //////// - -struct _LtkPTreeNode -{ - struct _LtkPTreeNode *parent; -}; -typedef struct _LtkPTreeNode *LtkPtree; - - - - - - - - - - - - -/* - one way list template usable as FIFO or LIFO by macros - Element must be a pointer to a real allocated object. -*/ -// this acts as dummy node, never really instanciated // -struct _template_list_node { - struct _template_list_node *next; -}; -typedef struct _template_list_node *LtkListNode; -#define LTK_LIST_HEADER LtkListNode ltk_list_node_next; - -struct _template_list { - int size; - struct _template_list_node *start; - struct _template_list_node *end; -}; - -typedef struct _template_list *LtkList; -typedef struct _template_list_node *LtkListIterator; - -LtkList ltk_list_new(); -void ltk_list_nodepush(LtkList list,LtkListNode node); -LtkListNode ltk_list_get_start(LtkList list); -LtkListNode ltk_list_get_end(LtkList list); -void ltk_list_remove(LtkList list,LtkListNode node); -void ltk_list_pop_start(LtkList list); -void ltk_list_pop_end(LtkList list); - - -#define LTK_LIST_DECLARE(Type,Type_name) \ - static LtkList (* Type_name##_list_new)(void) = ltk_list_new;\ - void (* Type_name##_list_nodepush)(LtkList list, Type *node) = (void (*)(LtkList, Type *))ltk_list_nodepush; \ - Type * (* Type_name##_list_get_start)(LtkList list) = (Type *(*)(LtkList))ltk_list_get_start; \ - Type * (* Type_name##_list_get_end)(LtkList list) = (Type *(*)(LtkList))ltk_list_get_end; \ - void (* Type_name##_list_remove)(LtkList list, Type *node) = (void (*)(LtkList, Type *))ltk_list_remove; \ - void (* Type_name##_list_pop_start)(LtkList list) = (void (*)(LtkList))ltk_list_pop_start; \ - void (* Type_name##_list_pop_end)(LtkList list) = (void (*)(LtkList))ltk_list_pop_end; - -#define LTK_LIST_DECLARE_KEYACCESS(Type,Type_name,KeyType,key_member_name,key_function) \ - Type * Type_name##_list_key_lookup(LtkList list, KeyType key) { \ - LtkListIterator iter = ltk_list_iterator_new(list); \ - while(iter) { \ - if (key_function( ((Type *)iter)->key_member_name, key )) \ - return (Type *)iter; \ - iter = iter->next; } \ - return NULL; } \ - \ - void Type_name##_list_key_remove(LtkList list, KeyType key) { \ - LtkListNode node = (LtkListNode)Type_name##_list_key_lookup(list,key); \ - if(node) ltk_list_remove(list,node); } \ - - -LtkListIterator ltk_list_iterator_new(LtkList list); - -#endif // TEMPLATES_H diff --git a/src/ltk/test_comma.h b/src/ltk/test_comma.h deleted file mode 100644 index 2d69036..0000000 --- a/src/ltk/test_comma.h +++ /dev/null @@ -1,117 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -/* - * File: test_comma.h - * Author: andrea - * - * Created on May 24, 2012, 4:47 PM - */ - -#ifndef TEST_COMMA_H -#define TEST_COMMA_H - -#include - -struct Vector3 -{ - union - { - struct { float x, y, z; }; - float data[3]; - }; - - struct CommaAssign; - - CommaAssign operator=(float _x) - { - x = _x; - return CommaAssign(this,1); - } - - struct CommaAssign - { - Vector3 *vec3; - int index; - - explicit CommaAssign(Vector3 *vec3, int index) : vec3(vec3) { - this->index = index; - } - CommaAssign operator, (float f) { - vec3->data[index] = f; - return CommaAssign(vec3, index + 1); - } - - }; - -}; - - - -struct Container -{ - union - { - struct { float x, y, z; }; - float data[3]; - }; - - inline float *getBuffer() { - return this->data; - } - - template class CommaAssign - { - private: - T *container; - int index; - - public: - inline explicit CommaAssign(T *container, float s) : container(container) { - this->index = 0; - this->container->getBuffer()[0] = s; - } - - inline CommaAssign& operator, (float s) { - this->index++; - assert(index < size); - this->container->getBuffer()[this->index] = s; - return *this; - } - }; - - CommaAssign operator=(float s) { - return CommaAssign (this, s); - } - -}; - - - - -#endif /* TEST_COMMA_H */ - diff --git a/src/ltk/testing/Makefile.am b/src/ltk/testing/Makefile.am deleted file mode 100644 index 1964340..0000000 --- a/src/ltk/testing/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ - -include $(top_srcdir)/Common.am - -#AM_DEFAULT_SOURCE_EXT = .cpp - - - -TESTS = LtkDebugTest \ - LtkFunctionToStringTest - -LDADD = ../../../libmutom-0.1.la -check_PROGRAMS = $(TESTS) - - -#################################################### -# Hybrid c/c++ Ltk Specific tests # -#################################################### - -check_PROGRAMS += Vector-test -Vector_test_SOURCES = Vector.c -TESTS += Vector-test - -check_PROGRAMS += Vector-test-cc -Vector_test_cc_SOURCES = Vector-cc.cpp -TESTS += Vector-test-cc - -check_PROGRAMS += Object-test -Object_test_SOURCES = Object.c -TESTS += Object-test - -check_PROGRAMS += Object-test-cc -Object_test_cc_SOURCES = Object-cc.cpp -TESTS += Object-test-cc - -#################################################### - -AM_COLOR_TESTS = always diff --git a/src/ltk/testing/Object-cc.cpp b/src/ltk/testing/Object-cc.cpp deleted file mode 100644 index 011af7f..0000000 --- a/src/ltk/testing/Object-cc.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#include "testing-prototype.h" -#include "../Object.h" - -using namespace ltk; - -int main() { - BEGIN_TESTING(Object - cc); - - Object ob; - TEST1( ob.GetElement() == 5552368 ); - - END_TESTING; -} diff --git a/src/ltk/testing/Object.c b/src/ltk/testing/Object.c deleted file mode 100644 index 9627bb9..0000000 --- a/src/ltk/testing/Object.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "testing-prototype.h" -#include "../Object.h" - - -int main() { - BEGIN_TESTING(Object); - - struct _Object *ob = Object_new(ObjectClass); - - END_TESTING; -} diff --git a/src/ltk/testing/Vector-cc.cpp b/src/ltk/testing/Vector-cc.cpp deleted file mode 100644 index d0d75fc..0000000 --- a/src/ltk/testing/Vector-cc.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#include "testing-prototype.h" -#include "../Vector.h" - -using namespace ltk; - -int main() { - BEGIN_TESTING(Vector - cc); - - typedef ltkVector ltkInt4; - - ltkInt4 v, w; - v = 1, 2, 3, 4; - w = v; - - printf("v -> %d,%d,%d,%d\n", v[0], *(v.getBuffer() + 1), v.at(2), v(3)); - - - // test assign operator - TEST1(v == w); - TEST0(v != w); - - // test accessors - TEST1(v[0] == 1); - TEST1(*(v.getBuffer() + 1) == 2); - TEST1(v.at(2) == 3); - TEST1(v(3) == 4); - - // setter - w << 1, 4, 9, 16; - TEST1(w[0] == 1); - TEST1(w[1] == 4); - TEST1(w[2] == 9); - TEST1(w[3] == 16); - - // math operators - v *= v; - w = 1, 4, 9, 16; - TEST1(v == w); - v /= v; - w = 1, 1, 1, 1; - TEST1(v == w); - v += v; - w = 2, 2, 2, 2; - TEST1(v == w); - - v << 1, 1, -1, 1; - w << -1, 1, 1, 1; - TEST0(v * w); - TEST0(v / w); - - END_TESTING; -} diff --git a/src/ltk/testing/Vector.c b/src/ltk/testing/Vector.c deleted file mode 100644 index f7d1ab7..0000000 --- a/src/ltk/testing/Vector.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include "testing-prototype.h" -#include "../Vector.h" - - -LTK_VECTOR_DECLARE (float, uFloat4, 4) - -int main() -{ - BEGIN_TESTING (Vector); - uFloat4 f = uFloat4_ltk_vector_new (); - - END_TESTING; -} diff --git a/src/ltk/testing/testing-prototype.h b/src/ltk/testing/testing-prototype.h deleted file mode 100644 index 39f4e6c..0000000 --- a/src/ltk/testing/testing-prototype.h +++ /dev/null @@ -1,37 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#include - -#define BEGIN_TESTING(name) \ -static int _fail = 0; \ -printf("..:: Testing " #name " ::..\n"); - -#define TEST1(val) _fail += (val)==0 -#define TEST0(val) _fail += (val)!=0 -#define END_TESTING return _fail; - diff --git a/src/utils/moc/Makefile b/src/utils/moc/Makefile deleted file mode 100644 index d42bd6d..0000000 --- a/src/utils/moc/Makefile +++ /dev/null @@ -1,24 +0,0 @@ - - -# Makefile example -- scanner and parser. -# -CXX = g++ -D_DEBUG -LEX = flex -YACC = bison -y -t -YFLAGS = -d -objects = parse.o scan.o - -moc: $(objects) - $(CXX) -o $@ $(objects) -lfl - -parse.o: parse.y - -# parse.h: parse.c -# mv -f y.tab.h parse.h - -scan.o: scan.l - - -clean: - rm -f *.o parse.tab.c parse.tab.h - diff --git a/src/utils/moc/moc_actions.h b/src/utils/moc/moc_actions.h deleted file mode 100644 index db6e97e..0000000 --- a/src/utils/moc/moc_actions.h +++ /dev/null @@ -1,92 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - -#ifndef MOC_ACTION_H -#define MOC_ACTION_H - -#include -#include -#include -#include - -#ifndef NDEBUG -#define DEBUG( ... ) { printf(" /*["); printf( __VA_ARGS__ ); printf("]*/ "); } -#else -#define DEBUG( ... ) ; -#endif - -#define CONCAT( dest , ... ) string_append(dest, __VA_ARGS__, NULL) - -char * string_append(char *first, ... ) { - va_list ap; - va_start (ap, first); /* Initialize the argument list. */ - - char *str_in = first; - char *str = malloc(sizeof(char) * strlen(str_in)); - strcat(str,str_in); - - str_in = va_arg (ap,char *); - while (str_in) { - char *tmp = malloc(sizeof(char) * (strlen(str)+strlen(str_in)) ); - memcpy(tmp,str,strlen(str)); - memcpy(tmp+strlen(str),str_in,strlen(str_in)); - free(str); - str = tmp; - str_in = va_arg (ap,char *); - } - return str; -} - - - - - - -// ACTIONS // - - - -#define SIMPLE_DECLARATION simple_declaration_action - -static int simple_declaration_action(const char *type, const char *ids); - - - - - - -// move to implementation .. // -static int simple_declaration_action(const char *type, const char *ids) { - DEBUG("simple_declaration -> type:\"%s\" decl:\"%s\" ",type,ids); - return 0; -} - - - - - -#endif // MOC_ACTION_H diff --git a/src/utils/moc/parse.y b/src/utils/moc/parse.y deleted file mode 100644 index ba06996..0000000 --- a/src/utils/moc/parse.y +++ /dev/null @@ -1,1257 +0,0 @@ -%{ - -#include -#include -#include "moc_actions.h" - -#define EMPTY strdup(""); -#define YYDEBUG 1 -#define YYPRINT(file, type, value) yyprint (file, type, value) - -%} - -// Symbols. // -%union -{ - char *sval; -}; - -%token MOC_PROPERTY MOC_OBJECT_PARAMETERS -%type MOC_monk_seq_opt MOC_monk - - - -%token IDENTIFIER -%token INTEGER FLOATING CHARACTER STRING -%token TYPEDEF_NAME NAMESPACE_NAME CLASS_NAME ENUM_NAME TEMPLATE_NAME - -%token COLONCOLON -%token ELLIPSIS DOTSTAR ADDEQ SUBEQ MULEQ DIVEQ MODEQ -%token XOREQ ANDEQ OREQ SL SR SREQ SLEQ EQ NOTEQ LTEQ GTEQ ANDAND OROR -%token PLUSPLUS MINUSMINUS ARROWSTAR ARROW - - -%token ASM AUTO BOOL BREAK CASE CATCH CHAR CLASS CONST CONST_CAST CONTINUE -%token DEFAULT DELETE DO DOUBLE DYNAMIC_CAST ELSE ENUM EXPLICIT EXPORT EXTERN -%token FALSE FLOAT FOR FRIEND GOTO IF INLINE INT LONG MUTABLE NAMESPACE NEW -%token OPERATOR PRIVATE PROTECTED PUBLIC REGISTER REINTERPRET_CAST RETURN -%token SHORT SIGNED SIZEOF STATIC STATIC_CAST STRUCT SWITCH TEMPLATE THIS -%token THROW TRUE TRY TYPEDEF TYPEID TYPENAME UNION UNSIGNED USING VIRTUAL -%token VOID VOLATILE WCHAR_T WHILE - - - - -%type type_name class_name enum_name typedef_name - -%type simple_type_specifier -%type decl_specifier_seq decl_specifier -%type simple_declaration block_declaration - -%type init_declarator_list init_declarator -%type initializer initializer_clause -%type declarator direct_declarator ptr_operator declarator_id -%type type_specifier type_specifier_seq elaborated_type_specifier class_key nested_name_specifier template_argument_list -%type enum_specifier enumerator_list enumerator_definition enumerator -%type class_or_namespace_name -%type identifier -%type id_expression -%type constant_expression - - -%type declaration_seq_opt -%type TEMPLATE_opt -%type nested_name_specifier_opt -%type expression_list_opt -%type COLONCOLON_opt -%type new_placement_opt -%type new_initializer_opt -%type new_declarator_opt -%type expression_opt -%type statement_seq_opt -%type condition_opt -%type decl_specifier_seq_opt -%type init_declarator_list_opt -%type identifier_opt -%type enumerator_list_opt -%type TYPENAME_opt -%type initializer_opt -%type cv_qualifier_seq_opt -%type exception_specification_opt -%type constant_expression_opt -%type abstract_declarator_opt -%type type_specifier_seq_opt -%type direct_abstract_declarator_opt -%type parameter_declaration_list_opt -%type ELLIPSIS_opt -%type ctor_initializer_opt -%type COMMA_opt -%type member_specification_opt -%type base_clause_opt -%type member_declarator_list_opt -%type SEMICOLON_opt -%type pure_specifier_opt -%type constant_initializer_opt -%type access_specifier_opt -%type VIRTUAL_opt -%type conversion_declarator_opt -%type EXPORT_opt -%type handler_seq_opt -%type assignment_expression_opt -%type type_id_list_opt - - -%error-verbose -//%debug -%% - -MOC_block_seq_opt - : /* empty */ - | MOC_block_seq_opt MOC_uLib_Parameters - | MOC_block_seq_opt MOC_Property - ; - -MOC_Property: - MOC_PROPERTY '(' IDENTIFIER ')' '{' { DEBUG("found property: %s",$3); } - MOC_prop_content_opt - '}' { DEBUG("property ends"); } - ; - -MOC_uLib_Parameters: - MOC_OBJECT_PARAMETERS '(' IDENTIFIER ')' '{' { DEBUG("found parameters: %s",$3); } - MOC_prop_content_opt - '}' { DEBUG("parameters ends"); } - ; - -MOC_prop_content_opt - : - | translation_unit - ; - - -MOC_monk_seq_opt - : { $$ = EMPTY; } - | MOC_monk_seq_opt MOC_monk { $$ = CONCAT($1,$2); } - ; - -MOC_monk - : INT IDENTIFIER ';' { $$ = CONCAT("type:",$1," ","id:",$2," "); } - | CHAR IDENTIFIER ';' { $$ = CONCAT("type:",$1," ","id:",$2," "); } - | decl_specifier_seq_opt decl_specifier_seq_opt ';' { $$ = CONCAT("type:",$1," ","id:",$2," "); } - ; - -/*---------------------------------------------------------------------- - * Lexical elements. - *----------------------------------------------------------------------*/ - -identifier: - IDENTIFIER - ; - -literal: - integer_literal - | character_literal - | floating_literal - | string_literal - | boolean_literal - ; - -integer_literal: - INTEGER - ; - -character_literal: - CHARACTER - ; - -floating_literal: - FLOATING - ; - -string_literal: - STRING - ; - -boolean_literal: - TRUE - | FALSE - ; - -/*---------------------------------------------------------------------- - * Translation unit. - *----------------------------------------------------------------------*/ - -translation_unit: - declaration_seq_opt { DEBUG("t unit"); } - ; - -/*---------------------------------------------------------------------- - * Expressions. - *----------------------------------------------------------------------*/ - -primary_expression: - literal - | THIS - | COLONCOLON identifier - | COLONCOLON operator_function_id - | COLONCOLON qualified_id - | '(' expression ')' - | id_expression - ; - -id_expression: - unqualified_id - | qualified_id - ; - -unqualified_id: - identifier - | operator_function_id - | conversion_function_id - | '~' class_name - | template_id - ; - -qualified_id: - nested_name_specifier TEMPLATE_opt unqualified_id - ; - -nested_name_specifier: - class_or_namespace_name COLONCOLON nested_name_specifier_opt - ; - -class_or_namespace_name: - class_name - | namespace_name - ; - -postfix_expression: - primary_expression - | postfix_expression '[' expression ']' - | postfix_expression '(' expression_list_opt ')' - | simple_type_specifier '(' expression_list_opt ')' - | postfix_expression '.' TEMPLATE_opt COLONCOLON_opt id_expression - | postfix_expression ARROW TEMPLATE_opt COLONCOLON_opt id_expression - | postfix_expression '.' pseudo_destructor_name - | postfix_expression ARROW pseudo_destructor_name - | postfix_expression PLUSPLUS - | postfix_expression MINUSMINUS - | DYNAMIC_CAST '<' type_id '>' '(' expression ')' - | STATIC_CAST '<' type_id '>' '(' expression ')' - | REINTERPRET_CAST '<' type_id '>' '(' expression ')' - | CONST_CAST '<' type_id '>' '(' expression ')' - | TYPEID '(' expression ')' - | TYPEID '(' type_id ')' - ; - -expression_list: - assignment_expression - | expression_list ',' assignment_expression - ; - -pseudo_destructor_name: - COLONCOLON_opt nested_name_specifier_opt type_name COLONCOLON '~' type_name - | COLONCOLON_opt nested_name_specifier_opt '~' type_name - ; - -unary_expression: - postfix_expression - | PLUSPLUS cast_expression - | MINUSMINUS cast_expression - | unary_operator cast_expression - | SIZEOF unary_expression - | SIZEOF '(' type_id ')' - | new_expression - | delete_expression - ; - -unary_operator: - '*' - | '&' - | '+' - | '-' - | '!' - | '~' - ; - -new_expression: - COLONCOLON_opt NEW new_placement_opt new_type_id new_initializer_opt - | COLONCOLON_opt NEW new_placement_opt '(' type_id ')' new_initializer_opt - ; - -new_placement: - '(' expression_list ')' - ; - -new_type_id: - type_specifier_seq new_declarator_opt - ; - -new_declarator: - ptr_operator new_declarator_opt - | direct_new_declarator - ; - -direct_new_declarator: - '[' expression ']' - | direct_new_declarator '[' constant_expression ']' - ; - -new_initializer: - '(' expression_list_opt ')' - ; - -delete_expression: - COLONCOLON_opt DELETE cast_expression - | COLONCOLON_opt DELETE '[' ']' cast_expression - ; - -cast_expression: - unary_expression - | '(' type_id ')' cast_expression - ; - -pm_expression: - cast_expression - | pm_expression DOTSTAR cast_expression - | pm_expression ARROWSTAR cast_expression - ; - -multiplicative_expression: - pm_expression - | multiplicative_expression '*' pm_expression - | multiplicative_expression '/' pm_expression - | multiplicative_expression '%' pm_expression - ; - -additive_expression: - multiplicative_expression - | additive_expression '+' multiplicative_expression - | additive_expression '-' multiplicative_expression - ; - -shift_expression: - additive_expression - | shift_expression SL additive_expression - | shift_expression SR additive_expression - ; - -relational_expression: - shift_expression - | relational_expression '<' shift_expression - | relational_expression '>' shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - ; - -equality_expression: - relational_expression - | equality_expression EQ relational_expression - | equality_expression NOTEQ relational_expression - ; - -and_expression: - equality_expression - | and_expression '&' equality_expression - ; - -exclusive_or_expression: - and_expression - | exclusive_or_expression '^' and_expression - ; - -inclusive_or_expression: - exclusive_or_expression - | inclusive_or_expression '|' exclusive_or_expression - ; - -logical_and_expression: - inclusive_or_expression - | logical_and_expression ANDAND inclusive_or_expression - ; - -logical_or_expression: - logical_and_expression - | logical_or_expression OROR logical_and_expression - ; - -conditional_expression: - logical_or_expression - | logical_or_expression '?' expression ':' assignment_expression - ; - -assignment_expression: - conditional_expression - | logical_or_expression assignment_operator assignment_expression - | throw_expression - ; - -assignment_operator: - '=' - | MULEQ - | DIVEQ - | MODEQ - | ADDEQ - | SUBEQ - | SREQ - | SLEQ - | ANDEQ - | XOREQ - | OREQ - ; - -expression: - assignment_expression - | expression ',' assignment_expression - ; - -constant_expression: - conditional_expression - ; - -/*---------------------------------------------------------------------- - * Statements. - *----------------------------------------------------------------------*/ - -statement: - labeled_statement - | expression_statement - | compound_statement - | selection_statement - | iteration_statement - | jump_statement - | declaration_statement - | try_block - ; - -labeled_statement: - identifier ':' statement - | CASE constant_expression ':' statement - | DEFAULT ':' statement - ; - -expression_statement: - expression_opt ';' - ; - -compound_statement: - '{' statement_seq_opt '}' - ; - -statement_seq: - statement - | statement_seq statement - ; - -selection_statement: - IF '(' condition ')' statement - | IF '(' condition ')' statement ELSE statement - | SWITCH '(' condition ')' statement - ; - -condition: - expression - | type_specifier_seq declarator '=' assignment_expression - ; - -iteration_statement: - WHILE '(' condition ')' statement - | DO statement WHILE '(' expression ')' ';' - | FOR '(' for_init_statement condition_opt ';' expression_opt ')' statement - ; - -for_init_statement: - expression_statement - | simple_declaration - ; - -jump_statement: - BREAK ';' - | CONTINUE ';' - | RETURN expression_opt ';' - | GOTO identifier ';' - ; - -declaration_statement: - block_declaration - ; - -/*---------------------------------------------------------------------- - * Declarations. - *----------------------------------------------------------------------*/ - -declaration_seq: - declaration - | declaration_seq declaration - ; - -declaration: - block_declaration - | function_definition - | template_declaration - | explicit_instantiation - | explicit_specialization - | linkage_specification - | namespace_definition - ; - -block_declaration: - simple_declaration - | asm_definition - | namespace_alias_definition - | using_declaration - | using_directive - ; - -simple_declaration: - decl_specifier_seq_opt init_declarator_list_opt ';' { SIMPLE_DECLARATION($1,$2); } - ; - -decl_specifier: - storage_class_specifier - | type_specifier - | function_specifier - | FRIEND - | TYPEDEF - ; - -decl_specifier_seq: - decl_specifier_seq_opt decl_specifier { $$ = CONCAT($1,$2); } - ; - -storage_class_specifier: - AUTO - | REGISTER - | STATIC - | EXTERN - | MUTABLE - ; - -function_specifier: - INLINE - | VIRTUAL - | EXPLICIT - ; - -typedef_name: - identifier - ; - -type_specifier: - simple_type_specifier - | class_specifier - | enum_specifier - | elaborated_type_specifier - | cv_qualifier - ; - -simple_type_specifier: - COLONCOLON_opt /*nested_name_specifier_opt*/ type_name { $$ = CONCAT($1,$2); } /*<<<<< FIX DISAMBIGUATION <<<<<<*/ - | CHAR - | WCHAR_T - | BOOL - | SHORT - | INT - | LONG - | SIGNED - | UNSIGNED - | FLOAT - | DOUBLE - | VOID - ; - -type_name: - class_name - | enum_name - | typedef_name - ; - -elaborated_type_specifier: - class_key COLONCOLON_opt nested_name_specifier_opt identifier { $$ = CONCAT($1,$2,$3,$4); } - | ENUM COLONCOLON_opt nested_name_specifier_opt identifier { $$ = CONCAT($1,$2,$3,$4); } - | TYPENAME COLONCOLON_opt nested_name_specifier identifier { $$ = CONCAT($1,$2,$3,$4); } - | TYPENAME COLONCOLON_opt nested_name_specifier identifier '<' template_argument_list '>' { $$ = CONCAT($1,$2,$3,$4,"<",$6,">"); } - ; - -enum_name: - identifier - ; - -enum_specifier: - ENUM identifier_opt '{' enumerator_list_opt '}' { $$ = CONCAT($1,$2,"{",$4,"}"); } - ; - -enumerator_list: - enumerator_definition - | enumerator_list ',' enumerator_definition { $$ = CONCAT($1,",",$3); } - ; - -enumerator_definition: - enumerator - | enumerator '=' constant_expression { $$ = CONCAT($1,"=",$3); } - ; - -enumerator: - identifier - ; - -namespace_name: - original_namespace_name - | namespace_alias - ; - -original_namespace_name: - identifier - ; - -namespace_definition: - named_namespace_definition - | unnamed_namespace_definition - ; - -named_namespace_definition: - original_namespace_definition - | extension_namespace_definition - ; - -original_namespace_definition: - NAMESPACE identifier '{' namespace_body '}' - ; - -extension_namespace_definition: - NAMESPACE original_namespace_name '{' namespace_body '}' - ; - -unnamed_namespace_definition: - NAMESPACE '{' namespace_body '}' - ; - -namespace_body: - declaration_seq_opt - ; - -namespace_alias: - identifier - ; - -namespace_alias_definition: - NAMESPACE identifier '=' qualified_namespace_specifier ';' - ; - -qualified_namespace_specifier: - COLONCOLON_opt nested_name_specifier_opt namespace_name - ; - -using_declaration: - USING TYPENAME_opt COLONCOLON_opt nested_name_specifier unqualified_id ';' - | USING COLONCOLON unqualified_id ';' - ; - -using_directive: - USING NAMESPACE COLONCOLON_opt nested_name_specifier_opt namespace_name ';' - ; - -asm_definition: - ASM '(' string_literal ')' ';' - ; - -linkage_specification: - EXTERN string_literal '{' declaration_seq_opt '}' - | EXTERN string_literal declaration - ; - -/*---------------------------------------------------------------------- - * Declarators. - *----------------------------------------------------------------------*/ - -init_declarator_list: - init_declarator - | init_declarator_list ',' init_declarator { $$ = CONCAT($1,",",$3); } - ; - -init_declarator: - declarator initializer_opt { $$ = CONCAT($1,$2); } - ; - -declarator: - direct_declarator - | ptr_operator declarator { $$ = CONCAT($1,$2); } - ; - -direct_declarator: - declarator_id - | direct_declarator '('parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt - | direct_declarator '[' constant_expression_opt ']' { $$ = CONCAT($1,"[",$3,"]"); } - | '(' declarator ')' { $$ = CONCAT("(",$2,")"); } - ; - -ptr_operator: - '*' cv_qualifier_seq_opt { $$ = CONCAT("*",$2); } - | '&' { $$ = strdup("&"); } - | COLONCOLON_opt nested_name_specifier '*' cv_qualifier_seq_opt { $$ = CONCAT($1,$2,"*",$4); } - ; - -cv_qualifier_seq: - cv_qualifier cv_qualifier_seq_opt - ; - -cv_qualifier: - CONST - | VOLATILE - ; - -declarator_id: - COLONCOLON_opt id_expression { $$ = CONCAT($1,$2); } - | COLONCOLON_opt nested_name_specifier_opt type_name { $$ = CONCAT($1,$2,$3); } - ; - -type_id: - type_specifier_seq abstract_declarator_opt /*{ $$ = CONCAT($1,$2); }*/ - ; - -type_specifier_seq: - type_specifier type_specifier_seq_opt { $$ = CONCAT($1,$2); } - ; - -abstract_declarator: - ptr_operator abstract_declarator_opt /*{ $$ = CONCAT($1,$2); }*/ - | direct_abstract_declarator - ; - -direct_abstract_declarator: - direct_abstract_declarator_opt '(' parameter_declaration_clause ')' cv_qualifier_seq_opt exception_specification_opt - | direct_abstract_declarator_opt '[' constant_expression_opt ']' - | '(' abstract_declarator ')' - ; - -parameter_declaration_clause: - parameter_declaration_list_opt ELLIPSIS_opt - | parameter_declaration_list ',' ELLIPSIS - ; - -parameter_declaration_list: - parameter_declaration - | parameter_declaration_list ',' parameter_declaration - ; - -parameter_declaration: - decl_specifier_seq declarator - | decl_specifier_seq declarator '=' assignment_expression - | decl_specifier_seq abstract_declarator_opt - | decl_specifier_seq abstract_declarator_opt '=' assignment_expression - ; - -function_definition: - decl_specifier_seq_opt declarator ctor_initializer_opt function_body - | decl_specifier_seq_opt declarator function_try_block - ; - -function_body: - compound_statement - ; - -initializer: - '=' initializer_clause { $$ = strdup($2); } - | '(' expression_list ')' - ; - -initializer_clause: - assignment_expression - | '{' initializer_list COMMA_opt '}' - | '{' '}' - ; - -initializer_list: - initializer_clause - | initializer_list ',' initializer_clause - ; - -/*---------------------------------------------------------------------- - * Classes. - *----------------------------------------------------------------------*/ - -class_name: - identifier - | template_id - ; - -class_specifier: - class_head '{' member_specification_opt '}' - ; - -class_head: - class_key identifier_opt base_clause_opt - | class_key nested_name_specifier identifier base_clause_opt - ; - -class_key: - CLASS - | STRUCT - | UNION - ; - -member_specification: - member_declaration member_specification_opt - | access_specifier ':' member_specification_opt - ; - -member_declaration: - decl_specifier_seq_opt member_declarator_list_opt ';' - | function_definition SEMICOLON_opt - | qualified_id ';' - | using_declaration - | template_declaration - ; - -member_declarator_list: - member_declarator - | member_declarator_list ',' member_declarator - ; - -member_declarator: - declarator pure_specifier_opt - | declarator constant_initializer_opt - | identifier_opt ':' constant_expression - ; - -pure_specifier: - '=' '0' - ; - -constant_initializer: - '=' constant_expression - ; - -/*---------------------------------------------------------------------- - * Derived classes. - *----------------------------------------------------------------------*/ - -base_clause: - ':' base_specifier_list - ; - -base_specifier_list: - base_specifier - | base_specifier_list ',' base_specifier - ; - -base_specifier: - COLONCOLON_opt nested_name_specifier_opt class_name - | VIRTUAL access_specifier_opt COLONCOLON_opt nested_name_specifier_opt class_name - | access_specifier VIRTUAL_opt COLONCOLON_opt nested_name_specifier_opt class_name - ; - -access_specifier: - PRIVATE - | PROTECTED - | PUBLIC - ; - -/*---------------------------------------------------------------------- - * Special member functions. - *----------------------------------------------------------------------*/ - -conversion_function_id: - OPERATOR conversion_type_id - ; - -conversion_type_id: - type_specifier_seq conversion_declarator_opt - ; - -conversion_declarator: - ptr_operator conversion_declarator_opt - ; - -ctor_initializer: - ':' mem_initializer_list - ; - -mem_initializer_list: - mem_initializer - | mem_initializer ',' mem_initializer_list - ; - -mem_initializer: - mem_initializer_id '(' expression_list_opt ')' - ; - -mem_initializer_id: - COLONCOLON_opt nested_name_specifier_opt class_name - | identifier - ; - -/*---------------------------------------------------------------------- - * Overloading. - *----------------------------------------------------------------------*/ - -operator_function_id: - OPERATOR operator - ; - -operator: - NEW - | DELETE - | NEW '[' ']' - | DELETE '[' ']' - | '+' - | '_' - | '*' - | '/' - | '%' - | '^' - | '&' - | '|' - | '~' - | '!' - | '=' - | '<' - | '>' - | ADDEQ - | SUBEQ - | MULEQ - | DIVEQ - | MODEQ - | XOREQ - | ANDEQ - | OREQ - | SL - | SR - | SREQ - | SLEQ - | EQ - | NOTEQ - | LTEQ - | GTEQ - | ANDAND - | OROR - | PLUSPLUS - | MINUSMINUS - | ',' - | ARROWSTAR - | ARROW - | '(' ')' - | '[' ']' - ; - -/*---------------------------------------------------------------------- - * Templates. - *----------------------------------------------------------------------*/ - -template_declaration: - EXPORT_opt TEMPLATE '<' template_parameter_list '>' declaration - ; - -template_parameter_list: - template_parameter - | template_parameter_list ',' template_parameter - ; - -template_parameter: - type_parameter - | parameter_declaration - ; - -type_parameter: - CLASS identifier_opt - | CLASS identifier_opt '=' type_id - | TYPENAME identifier_opt - | TYPENAME identifier_opt '=' type_id - | TEMPLATE '<' template_parameter_list '>' CLASS identifier_opt - | TEMPLATE '<' template_parameter_list '>' CLASS identifier_opt '=' template_name - ; - -template_id: - template_name '<' template_argument_list '>' - ; - -template_name: - identifier - ; - -template_argument_list: - template_argument - | template_argument_list ',' template_argument - ; - -template_argument: - assignment_expression - | type_id - | template_name - ; - -explicit_instantiation: - TEMPLATE declaration - ; - -explicit_specialization: - TEMPLATE '<' '>' declaration - ; - -/*---------------------------------------------------------------------- - * Exception handling. - *----------------------------------------------------------------------*/ - -try_block: - TRY compound_statement handler_seq - ; - -function_try_block: - TRY ctor_initializer_opt function_body handler_seq - ; - -handler_seq: - handler handler_seq_opt - ; - -handler: - CATCH '(' exception_declaration ')' compound_statement - ; - -exception_declaration: - type_specifier_seq declarator - | type_specifier_seq abstract_declarator - | type_specifier_seq - | ELLIPSIS - ; - -throw_expression: - THROW assignment_expression_opt - ; - -exception_specification: - THROW '(' type_id_list_opt ')' - ; - -type_id_list: - type_id - | type_id_list ',' type_id - ; - -/*---------------------------------------------------------------------- - * Epsilon (optional) definitions. - *----------------------------------------------------------------------*/ - -declaration_seq_opt: - { $$ = EMPTY; } - | declaration_seq - ; - -TEMPLATE_opt: - { $$ = EMPTY; } - | TEMPLATE - ; - -nested_name_specifier_opt: - { $$ = EMPTY; } - | nested_name_specifier - ; - -expression_list_opt: - { $$ = EMPTY; } - | expression_list - ; - -COLONCOLON_opt: - { $$ = EMPTY; } - | COLONCOLON { $$ = strdup("::"); } - ; - -new_placement_opt: - { $$ = EMPTY; } - | new_placement - ; - -new_initializer_opt: - { $$ = EMPTY; } - | new_initializer - ; - -new_declarator_opt: - { $$ = EMPTY; } - | new_declarator - ; - -expression_opt: - { $$ = EMPTY; } - | expression - ; - -statement_seq_opt: - { $$ = EMPTY; } - | statement_seq - ; - -condition_opt: - { $$ = EMPTY; } - | condition - ; - -decl_specifier_seq_opt: - { $$ = EMPTY; } - | decl_specifier_seq - ; - -init_declarator_list_opt: - { $$ = EMPTY; } - | init_declarator_list - ; - -identifier_opt: - { $$ = EMPTY; } - | identifier - ; - -enumerator_list_opt: - { $$ = EMPTY; } - | enumerator_list - ; - -TYPENAME_opt: - { $$ = EMPTY; } - | TYPENAME - ; - -initializer_opt: - { $$ = EMPTY; } - | initializer - ; - -cv_qualifier_seq_opt: - { $$ = EMPTY; } - | cv_qualifier_seq - ; - -exception_specification_opt: - { $$ = EMPTY; } - | exception_specification - ; - -constant_expression_opt: - { $$ = EMPTY; } - | constant_expression - ; - -abstract_declarator_opt: - { $$ = EMPTY; } - | abstract_declarator - ; - -type_specifier_seq_opt: - { $$ = EMPTY; } - | type_specifier_seq - ; - -direct_abstract_declarator_opt: - { $$ = EMPTY; } - | direct_abstract_declarator - ; - -parameter_declaration_list_opt: - { $$ = EMPTY; } - | parameter_declaration_list - ; - -ELLIPSIS_opt: - { $$ = EMPTY; } - | ELLIPSIS - ; - -ctor_initializer_opt: - { $$ = EMPTY; } - | ctor_initializer - ; - -COMMA_opt: - { $$ = EMPTY; } - | ',' - ; - -member_specification_opt: - { $$ = EMPTY; } - | member_specification - ; - -base_clause_opt: - { $$ = EMPTY; } - | base_clause - ; - -member_declarator_list_opt: - { $$ = EMPTY; } - | member_declarator_list - ; - -SEMICOLON_opt: - { $$ = EMPTY; } - | ';' - ; - -pure_specifier_opt: - { $$ = EMPTY; } - | pure_specifier - ; - -constant_initializer_opt: - { $$ = EMPTY; } - | constant_initializer - ; - -access_specifier_opt: - { $$ = EMPTY; } - | access_specifier - ; - -VIRTUAL_opt: - { $$ = EMPTY; } - | VIRTUAL - ; - -conversion_declarator_opt: - { $$ = EMPTY; } - | conversion_declarator - ; - -EXPORT_opt: - { $$ = EMPTY; } - | EXPORT - ; - -handler_seq_opt: - { $$ = EMPTY; } - | handler_seq - ; - -assignment_expression_opt: - { $$ = EMPTY; } - | assignment_expression - ; - -type_id_list_opt: - { $$ = EMPTY; } - | type_id_list - ; - - -%% - -int yyerror(char *s) { - printf("error, %s\n", s); - return 1; -} - -void yyprint (FILE *file, - int type, - YYSTYPE value) -{ - if (type == IDENTIFIER) - fprintf (file, "%s", value.sval); - if (type == COLONCOLON) - fprintf (file, "%s", value.sval); - -} - -int main(void) { -/* yydebug = 1;*/ - yyparse(); -} diff --git a/src/utils/moc/sample.cpp b/src/utils/moc/sample.cpp deleted file mode 100644 index 8f8f2ff..0000000 --- a/src/utils/moc/sample.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*////////////////////////////////////////////////////////////////////////////// -// CMT Cosmic Muon Tomography project ////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - - Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova - All rights reserved - - Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > - - ------------------------------------------------------------------ - 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 3.0 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. - -//////////////////////////////////////////////////////////////////////////////*/ - - - - -typedef int TestInt; - -class DerivedObject { - - -public: - - ULIB_OBJECT_PARAMETERS(test) - { - Bubu *a; - }; - -}; - -int main() { - - ULIB_OBJECT_PARAMETERS(prova) { - int a,b; - char *c; - }; - - return 0; -} diff --git a/src/utils/moc/scan.l b/src/utils/moc/scan.l deleted file mode 100644 index b5ff2d7..0000000 --- a/src/utils/moc/scan.l +++ /dev/null @@ -1,252 +0,0 @@ -%option stack -%{ -/* preamble */ -#include -#include -#include "y.tab.h" - -#define PRINT(str) { printf("%s",str); } -#define ENSTATE(st) { yy_push_state(YY_START); BEGIN(st); /*printf("ST[%i]",YY_START);*/ } -#define EXSTATE { BEGIN(yy_top_state()); yy_pop_state(); /*printf("ST[%i]",YY_START);*/ } - -#define SCANTEXT { fill_sval(); } -#define MATCH(name) { ECHO; SCANTEXT; return name; } - -int lineno; -int moc_level = 0; - -static int yywrap(void); -static void skip_until_eol(void); -static void skip_comment(void); -static int check_identifier(const char *); -static int fill_sval(); -%} - -blank [\t\f\v\r ]+ -anyunch <*>. - -intsuffix ([uU][lL]?)|([lL][uU]?) -fracconst ([0-9]*\.[0-9]+)|([0-9]+\.) -exppart [eE][-+]?[0-9]+ -floatsuffix [fFlL] -chartext ([^'])|(\\.) -stringtext ([^"])|(\\.) - -digit [0-9] -hex [0-9A-Fa-f] -letter [A-Z_a-z] -simple_escape_sequence (\\\'|\\\"|\\\?|\\\\|\\a|\\b|\\f|\\n|\\r|\\t|\\v) -octal_escape_sequence (\\[0-7]|\\[0-7][0-7]|\\[0-7][0-7][0-7]) -hexadecimal_escape_sequence (\\x{hex}+) -escape_sequence ({simple_escape_sequence}|{octal_escape_sequence}|{hexadecimal_escape_sequence}) -universal_character_name (\\u{hex}{hex}{hex}{hex}|\\U{hex}{hex}{hex}{hex}{hex}{hex}{hex}{hex}) -non_digit ({letter}|{universal_character_name}) -identifier ({non_digit}({non_digit}|{digit})*) - -begin_comment "/*" -end_comment "*/" -begin_inline_comment "//" -end_inline_comment "\n" - - -%s moc -%x cmt -%x inlcmt - -%% - -"\n" { ++lineno; ECHO; } -{blank} ECHO; - -{begin_comment} { ENSTATE(cmt); ECHO; } -{end_comment} { EXSTATE; ECHO; } - -{begin_inline_comment} { ENSTATE(inlcmt); ECHO; } -{end_inline_comment} { EXSTATE; ECHO; } - - -property { ECHO; ENSTATE(moc); return MOC_PROPERTY; } -ULIB_OBJECT_PARAMETERS { ECHO; ENSTATE(moc); return MOC_OBJECT_PARAMETERS; } -{ - "{" { moc_level++; MATCH('{'); } - "}" { if(!--moc_level)EXSTATE; MATCH('}'); } - - "<%" { MATCH('{'); } - "%>" { MATCH('}'); } - "[" { MATCH('['); } - "<:" { MATCH('['); } - "]" { MATCH(']'); } - ":>" { MATCH(']'); } - "(" { MATCH('('); } - ")" { MATCH(')'); } - ";" { MATCH(';'); } - "::" { MATCH(COLONCOLON); } - ":" { MATCH(':'); } - "..." { MATCH(ELLIPSIS); } - "?" { MATCH('?'); } - "." { MATCH('.'); } - ".*" { MATCH(DOTSTAR); } - "+" { MATCH('+'); } - "-" { MATCH('-'); } - "*" { MATCH('*'); } - "/" { MATCH('/'); } - "%" { MATCH('%'); } - "^" { MATCH('^'); } - "xor" { MATCH('^'); } - "&" { MATCH('&'); } - "bitand" { MATCH('&'); } - "|" { MATCH('|'); } - "bitor" { MATCH('|'); } - "~" { MATCH('~'); } - "compl" { MATCH('~'); } - "!" { MATCH('!'); } - "not" { MATCH('!'); } - "=" { MATCH('='); } - "<" { MATCH('<'); } - ">" { MATCH('>'); } - "+=" { MATCH(ADDEQ); } - "-=" { MATCH(SUBEQ); } - "*=" { MATCH(MULEQ); } - "/=" { MATCH(DIVEQ); } - "%=" { MATCH(MODEQ); } - "^=" { MATCH(XOREQ); } - "xor_eq" { MATCH(XOREQ); } - "&=" { MATCH(ANDEQ); } - "and_eq" { MATCH(ANDEQ); } - "|=" { MATCH(OREQ); } - "or_eq" { MATCH(OREQ); } - "<<" { MATCH(SL); } - ">>" { MATCH(SR); } - "<<=" { MATCH(SLEQ); } - ">>=" { MATCH(SREQ); } - "==" { MATCH(EQ); } - "!=" { MATCH(NOTEQ); } - "not_eq" { MATCH(NOTEQ); } - "<=" { MATCH(LTEQ); } - ">=" { MATCH(GTEQ); } - "&&" { MATCH(ANDAND); } - "and" { MATCH(ANDAND); } - "||" { MATCH(OROR); } - "or" { MATCH(OROR); } - "++" { MATCH(PLUSPLUS); } - "--" { MATCH(MINUSMINUS); } - "," { MATCH(','); } - "->*" { MATCH(ARROWSTAR); } - "->" { MATCH(ARROW); } - - "asm" { MATCH(ASM); } - "auto" { MATCH(AUTO); } - "bool" { MATCH(BOOL); } - "break" { MATCH(BREAK); } - "case" { MATCH(CASE); } - "catch" { MATCH(CATCH); } - "char" { MATCH(CHAR); } - "class" { MATCH(CLASS); } - "const" { MATCH(CONST); } - "const_cast" { MATCH(CONST_CAST); } - "continue" { MATCH(CONTINUE); } - "default" { MATCH(DEFAULT); } - "delete" { MATCH(DELETE); } - "do" { MATCH(DO); } - "double" { MATCH(DOUBLE); } - "dynamic_cast" { MATCH(DYNAMIC_CAST); } - "else" { MATCH(ELSE); } - "enum" { MATCH(ENUM); } - "explicit" { MATCH(EXPLICIT); } - "export" { MATCH(EXPORT); } - "extern" { MATCH(EXTERN); } - "false" { MATCH(FALSE); } - "float" { MATCH(FLOAT); } - "for" { MATCH(FOR); } - "friend" { MATCH(FRIEND); } - "goto" { MATCH(GOTO); } - "if" { MATCH(IF); } - "inline" { MATCH(INLINE); } - "int" { MATCH(INT); } - "long" { MATCH(LONG); } - "mutable" { MATCH(MUTABLE); } - "namespace" { MATCH(NAMESPACE); } - "new" { MATCH(NEW); } - "operator" { MATCH(OPERATOR); } - "private" { MATCH(PRIVATE); } - "protected" { MATCH(PROTECTED); } - "public" { MATCH(PUBLIC); } - "register" { MATCH(REGISTER); } - "reinterpret_cast" { MATCH(REINTERPRET_CAST); } - "return" { MATCH(RETURN); } - "short" { MATCH(SHORT); } - "signed" { MATCH(SIGNED); } - "sizeof" { MATCH(SIZEOF); } - "static" { MATCH(STATIC); } - "static_cast" { MATCH(STATIC_CAST); } - "struct" { MATCH(STRUCT); } - "switch" { MATCH(SWITCH); } - "template" { MATCH(TEMPLATE); } - "this" { MATCH(THIS); } - "throw" { MATCH(THROW); } - "true" { MATCH(TRUE); } - "try" { MATCH(TRY); } - "typedef" { MATCH(TYPEDEF); } - "typeid" { MATCH(TYPEID); } - "typename" { MATCH(TYPENAME); } - "union" { MATCH(UNION); } - "unsigned" { MATCH(UNSIGNED); } - "using" { MATCH(USING); } - "virtual" { MATCH(VIRTUAL); } - "void" { MATCH(VOID); } - "volatile" { MATCH(VOLATILE); } - "wchar_t" { MATCH(WCHAR_T); } - "while" { MATCH(WHILE); } - [a-zA-Z_][a-zA-Z_0-9]* { ECHO; return check_identifier(yytext); } - - "0"[xX][0-9a-fA-F]+{intsuffix}? { ECHO; return INTEGER; } - "0"[0-7]+{intsuffix}? { ECHO; return INTEGER; } - [0-9]+{intsuffix}? { ECHO; return INTEGER; } - - {fracconst}{exppart}?{floatsuffix}? { ECHO; return FLOATING; } - [0-9]+{exppart}{floatsuffix}? { ECHO; return FLOATING; } - - "'"{chartext}*"'" { ECHO; return CHARACTER; } - "L'"{chartext}*"'" { ECHO; return CHARACTER; } - "\""{stringtext}*"\"" { ECHO; return STRING; } - "L\""{stringtext}*"\"" { ECHO; return STRING; } - -} - -%% - -static int yywrap(void) -{ - return 1; -} - - -static int fill_sval() { - int len = strlen(yytext); - if(len) { - yylval.sval = malloc(len); - strncpy(yylval.sval, yytext, len); - } - else { - yylval.sval = strdup(""); - } - return len; -} - -static int check_identifier(const char *s) -{ -/* - switch (s[0]) { - case 'D': return TYPEDEF_NAME; - case 'N': return NAMESPACE_NAME; - case 'C': return CLASS_NAME; - case 'E': return ENUM_NAME; - case 'T': return TEMPLATE_NAME; - } -*/ - - yylval.sval = malloc(strlen(yytext)); - strncpy(yylval.sval, yytext, strlen(yytext)); - return IDENTIFIER; -} -