Skip to content

Commit

Permalink
Merge branch 'fix-core-namespace'
Browse files Browse the repository at this point in the history
* Remove defines fro const.h andconstants.h, usestatic const` instead

* Use std:: for min and max functions

* Rename kelvin, degree, deg, rad to celcius2kelvin, kelvin2celsius, rad2deg, deg2rad

* Move some functions to real.h and complex.h, create overloads in vector, matrix, matvec

* Major cleanup of warnings on qucs-core.
  • Loading branch information
guitorri committed Jan 20, 2015
2 parents 6c1fb1e + bcdfc33 commit 1a85689
Show file tree
Hide file tree
Showing 119 changed files with 990 additions and 809 deletions.
15 changes: 5 additions & 10 deletions qucs-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,6 @@ ENDIF()
#http://stackoverflow.com/questions/10984442/how-to-detect-c11-support-of-a-compiler-with-cmake/20165220#20165220

# Initialize CXXFLAGS.
IF(UNIX AND NOT APPLE)
SET(CMAKE_CXX_FLAGS "-std=c++11")
ENDIF()
# CMake defaults to clang++, use proper library
IF(APPLE)
SET(CMAKE_CXX_FLAGS "-stdlib=libc++")
ENDIF()

# \todo fix headers and use standard C++ methods
# * strdup is not C or C++ standart, it is POSIX
Expand All @@ -255,13 +248,12 @@ ENDIF()
# -U__STRICT_ANSI__. Could use -std=gnu++0x
IF(WIN32)
SET(CMAKE_CXX_FLAGS "-Wall -std=c++0x -fpermissive -U__STRICT_ANSI__")
ELSE()
SET(CMAKE_CXX_FLAGS "-Wall -std=c++11")
ENDIF()

# indiscriminate copy/paste from:
#http://stackoverflow.com/questions/10984442/how-to-detect-c11-support-of-a-compiler-with-cmake/20165220#20165220

# Initialize CXXFLAGS.
set(CMAKE_CXX_FLAGS "-Wall -std=c++0x -fpermissive -U__STRICT_ANSI__")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG")
Expand Down Expand Up @@ -324,3 +316,6 @@ SET(CPACK_GENERATOR "TGZ")
SET (CPACK_PACKAGE_VERSION_MAJOR 0)
SET (CPACK_PACKAGE_VERSION_MINOR 18)
include (CPack)



37 changes: 37 additions & 0 deletions qucs-core/cmake/erase_iterator_type.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

/*
* Check compiler implementation of std::vector::erase iterator type
* - type = [const_iterator | iterator]
*
* Adapted from:
* http://www.gnu.org/software/autoconf-archive/ax_cxx_erase_iterator_type.html
*
* Copyright (c) 2015 Bastien ROUCARIES
*
* Copying and distribution of this file, with or without modification, are
* permitted in any medium without royalty provided the copyright notice
* and this notice are preserved. This file is offered as-is, without any
* warranty.
*
*/

#include <vector>

typedef std::vector<int> intvector;

struct myvector {
myvector() { v.push_back(1); }
typedef intvector::const_iterator const_iterator;
typedef intvector::iterator iterator;
iterator erase (const_iterator position) { return v.erase(position); };
iterator erase (const_iterator first, const_iterator last) { return v.erase(first,last); };
intvector v;
};

int main()
{
myvector v;
v.erase(v.v.begin(),v.v.end());
return 1;
}

3 changes: 3 additions & 0 deletions qucs-core/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
/* Define to 1 if the compiler has complex<T>. */
#cmakedefine HAVE_COMPLEX 1

/* Define to 1 if the compiler has std::vector::erase [const_iterator|iterator] */
#cmakedefine HAVE_ERASE_CONSTANT_ITERATOR 1

/* Define to 1 if you have the `cos' function. */
#cmakedefine HAVE_COS 1

Expand Down
23 changes: 19 additions & 4 deletions qucs-core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,22 @@ IF(NOT HAVE_COMPLEX)
MESSAGE(SEND_ERROR "HAVE_COMPLEX failed")# ${TRY_OUT}")
ENDIF()


#
# Check std::vector::erase iterator type [const_iterator | iterator]
#
MESSAGE(STATUS "Checking HAVE_ERASE_CONSTANT_ITERATOR")
TRY_COMPILE( HAVE_ERASE_CONSTANT_ITERATOR
${CMAKE_BINARY_DIR}
${qucs-core_SOURCE_DIR}/cmake/erase_iterator_type.cpp
OUTPUT_VARIABLE TRY_OUT)
IF(HAVE_ERASE_CONSTANT_ITERATOR)
MESSAGE(STATUS "Using std::vector:erase iterator type : const_iterator")
ELSE()
MESSAGE(STATUS "Using std::vector:erase iterator type : iterator")
ENDIF()


#
# Check for list of complex functions.
#
Expand Down Expand Up @@ -358,7 +374,7 @@ SET(TEMPLATES tmatrix.h tvector.h eqnsys.h nasolver.h states.h tvector.h
#
# Include headers to be installed
#
SET(HEADERS
SET(PUBLIC_HEADERS
${qucs-core_BINARY_DIR}/config.h
${qucs-core_BINARY_DIR}/qucs_typedefs.h
circuit.h
Expand All @@ -371,7 +387,6 @@ SET(HEADERS
netdefs.h
node.h
object.h
states.cpp
states.h
valuelist.h
vector.h
Expand Down Expand Up @@ -460,7 +475,7 @@ ADD_SUBDIRECTORY( converter )
#
# Create qucsator
#
ADD_EXECUTABLE( qucsator ucs.cpp )
ADD_EXECUTABLE( qucsator ucs.cpp ${PUBLIC_HEADERS} ${TEMPLATES})

#
# Build libqucs as SHARED, dynamic library
Expand Down Expand Up @@ -509,4 +524,4 @@ INSTALL(TARGETS libqucs
ARCHIVE DESTINATION lib COMPONENT devel
LIBRARY DESTINATION lib COMPONENT library)

INSTALL(FILES ${HEADERS} DESTINATION include/qucs-core)
INSTALL(FILES ${PUBLIC_HEADERS} DESTINATION include/qucs-core)
16 changes: 8 additions & 8 deletions qucs-core/src/analysis.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* analysis.cpp - analysis class implementation
*
*
*
* Copyright (C) 2003-2008 Stefan Jahn <stefan@lkcc.org>
*
Expand All @@ -21,13 +21,13 @@
*
* $Id: analysis.cpp 1869 2013-03-06 12:50:21Z crobarcro $
*
*/

/*! \file analysis.cpp
*/

/*! \file analysis.cpp
* \brief Implementation of the analysis class.
*
* Contains the implementation of the analysis class.
*
*
* Contains the implementation of the analysis class.
*
*/

#if HAVE_CONFIG_H
Expand All @@ -48,7 +48,7 @@
#include "analysis.h"

namespace qucs {


//Constructor. Creates an unnamed instance of the analysis class.
analysis::analysis () : object () {
data = NULL;
Expand Down

0 comments on commit 1a85689

Please sign in to comment.