diff options
Diffstat (limited to 'gruel/src')
27 files changed, 732 insertions, 231 deletions
diff --git a/gruel/src/include/gruel/CMakeLists.txt b/gruel/src/include/gruel/CMakeLists.txt new file mode 100644 index 000000000..811856b98 --- /dev/null +++ b/gruel/src/include/gruel/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Generate inet.h header file +######################################################################## +include(TestBigEndian) +enable_language(C) +TEST_BIG_ENDIAN(GR_ARCH_BIGENDIAN) + +include(CheckIncludeFileCXX) +CHECK_INCLUDE_FILE_CXX(byteswap.h GR_HAVE_BYTESWAP) +CHECK_INCLUDE_FILE_CXX(arpa/inet.h GR_HAVE_ARPA_INET) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/inet.h.in + ${CMAKE_CURRENT_BINARY_DIR}/inet.h +@ONLY) + +######################################################################## +# Install the headers +######################################################################## +install(FILES + api.h + attributes.h + high_res_timer.h + ${CMAKE_CURRENT_BINARY_DIR}/inet.h + msg_accepter.h + msg_accepter_msgq.h + msg_queue.h + msg_passing.h + pmt.h + pmt_pool.h + pmt_sugar.h + realtime.h + sys_pri.h + thread_body_wrapper.h + thread_group.h + thread.h +DESTINATION ${GR_INCLUDE_DIR}/gruel COMPONENT "gruel_devel") diff --git a/gruel/src/include/gruel/Makefile.am b/gruel/src/include/gruel/Makefile.am index 96aed326e..fce739f08 100644 --- a/gruel/src/include/gruel/Makefile.am +++ b/gruel/src/include/gruel/Makefile.am @@ -26,6 +26,7 @@ EXTRA_DIST += inet.h.in gruelincludedir = $(prefix)/include/gruel gruelinclude_HEADERS = \ + api.h \ attributes.h \ high_res_timer.h \ inet.h \ diff --git a/gruel/src/include/gruel/api.h b/gruel/src/include/gruel/api.h new file mode 100644 index 000000000..945814d43 --- /dev/null +++ b/gruel/src/include/gruel/api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2010 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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 3, or (at your option) + * any later version. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GRUEL_API_H +#define INCLUDED_GRUEL_API_H + +#include <gruel/attributes.h> + +#ifdef gruel_EXPORTS +# define GRUEL_API __GR_ATTR_EXPORT +#else +# define GRUEL_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_GRUEL_API_H */ diff --git a/gruel/src/include/gruel/attributes.h b/gruel/src/include/gruel/attributes.h index fdf48c977..baa5521c8 100644 --- a/gruel/src/include/gruel/attributes.h +++ b/gruel/src/include/gruel/attributes.h @@ -53,4 +53,22 @@ # define __GR_ATTR_IMPORT #endif +//////////////////////////////////////////////////////////////////////// +// define inline when building C +//////////////////////////////////////////////////////////////////////// +#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline) +# define inline __inline +#endif + +//////////////////////////////////////////////////////////////////////// +// suppress warnings +//////////////////////////////////////////////////////////////////////// +#ifdef _MSC_VER +# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... +# pragma warning(disable: 4244) // conversion from 'double' to 'float', possible loss of data +# pragma warning(disable: 4305) // 'initializing' : truncation from 'double' to 'float' +# pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#endif + #endif /* INCLUDED_GRUEL_ATTRIBUTES_H */ diff --git a/gruel/src/include/gruel/inet.h.in b/gruel/src/include/gruel/inet.h.in index 7ac01eb56..8545aeea9 100644 --- a/gruel/src/include/gruel/inet.h.in +++ b/gruel/src/include/gruel/inet.h.in @@ -19,6 +19,7 @@ #ifndef INCLUDED_INET_H #define INCLUDED_INET_H +#include <gruel/api.h> #include <stdint.h> #if 1 /* missing htonll or ntohll */ diff --git a/gruel/src/include/gruel/msg_accepter.h b/gruel/src/include/gruel/msg_accepter.h index 70ac846f5..3dfc8bcf8 100644 --- a/gruel/src/include/gruel/msg_accepter.h +++ b/gruel/src/include/gruel/msg_accepter.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_GRUEL_MSG_ACCEPTER_H #define INCLUDED_GRUEL_MSG_ACCEPTER_H +#include <gruel/api.h> #include <gruel/pmt.h> #include <boost/shared_ptr.hpp> @@ -29,7 +30,7 @@ namespace gruel { /*! * \brief Virtual base class that accepts messages */ - class msg_accepter + class GRUEL_API msg_accepter { public: msg_accepter() {}; diff --git a/gruel/src/include/gruel/msg_accepter_msgq.h b/gruel/src/include/gruel/msg_accepter_msgq.h index bf1762e92..22a1855cf 100644 --- a/gruel/src/include/gruel/msg_accepter_msgq.h +++ b/gruel/src/include/gruel/msg_accepter_msgq.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_MSG_ACCEPTER_MSGQ_H #define INCLUDED_MSG_ACCEPTER_MSGQ_H +#include <gruel/api.h> #include <gruel/msg_accepter.h> #include <gruel/msg_queue.h> @@ -30,7 +31,7 @@ namespace gruel { /*! * \brief Concrete class that accepts messages and inserts them into a message queue. */ - class msg_accepter_msgq : public msg_accepter + class GRUEL_API msg_accepter_msgq : public msg_accepter { protected: msg_queue_sptr d_msg_queue; diff --git a/gruel/src/include/gruel/msg_passing.h b/gruel/src/include/gruel/msg_passing.h index ebbeca815..51268967a 100644 --- a/gruel/src/include/gruel/msg_passing.h +++ b/gruel/src/include/gruel/msg_passing.h @@ -25,6 +25,7 @@ * \brief Include this header to use the message passing features */ +#include <gruel/api.h> #include <gruel/pmt.h> #include <gruel/msg_accepter.h> diff --git a/gruel/src/include/gruel/msg_queue.h b/gruel/src/include/gruel/msg_queue.h index c24313df6..8608842da 100644 --- a/gruel/src/include/gruel/msg_queue.h +++ b/gruel/src/include/gruel/msg_queue.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_MSG_QUEUE_H #define INCLUDED_MSG_QUEUE_H +#include <gruel/api.h> #include <gruel/thread.h> #include <gruel/pmt.h> #include <deque> @@ -36,7 +37,7 @@ namespace gruel { /*! * \brief thread-safe message queue */ - class msg_queue { + class GRUEL_API msg_queue { gruel::mutex d_mutex; gruel::condition_variable d_not_empty; diff --git a/gruel/src/include/gruel/pmt.h b/gruel/src/include/gruel/pmt.h index 2948abb39..58533e54e 100644 --- a/gruel/src/include/gruel/pmt.h +++ b/gruel/src/include/gruel/pmt.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_PMT_H #define INCLUDED_PMT_H +#include <gruel/api.h> #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> #include <boost/any.hpp> @@ -57,28 +58,28 @@ class pmt_base; */ typedef boost::intrusive_ptr<pmt_base> pmt_t; -extern void intrusive_ptr_add_ref(pmt_base*); -extern void intrusive_ptr_release(pmt_base*); +extern GRUEL_API void intrusive_ptr_add_ref(pmt_base*); +extern GRUEL_API void intrusive_ptr_release(pmt_base*); -class pmt_exception : public std::logic_error +class GRUEL_API pmt_exception : public std::logic_error { public: pmt_exception(const std::string &msg, pmt_t obj); }; -class pmt_wrong_type : public pmt_exception +class GRUEL_API pmt_wrong_type : public pmt_exception { public: pmt_wrong_type(const std::string &msg, pmt_t obj); }; -class pmt_out_of_range : public pmt_exception +class GRUEL_API pmt_out_of_range : public pmt_exception { public: pmt_out_of_range(const std::string &msg, pmt_t obj); }; -class pmt_notimplemented : public pmt_exception +class GRUEL_API pmt_notimplemented : public pmt_exception { public: pmt_notimplemented(const std::string &msg, pmt_t obj); @@ -92,24 +93,24 @@ public: * I.e., there is a single false value, #f. * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_T; //< \#t : boolean true constant -extern const pmt_t PMT_F; //< \#f : boolean false constant +extern GRUEL_API const pmt_t PMT_T; //< \#t : boolean true constant +extern GRUEL_API const pmt_t PMT_F; //< \#f : boolean false constant //! Return true if obj is \#t or \#f, else return false. -bool pmt_is_bool(pmt_t obj); +GRUEL_API bool pmt_is_bool(pmt_t obj); //! Return false if obj is \#f, else return true. -bool pmt_is_true(pmt_t obj); +GRUEL_API bool pmt_is_true(pmt_t obj); //! Return true if obj is \#f, else return true. -bool pmt_is_false(pmt_t obj); +GRUEL_API bool pmt_is_false(pmt_t obj); //! Return \#f is val is false, else return \#t. -pmt_t pmt_from_bool(bool val); +GRUEL_API pmt_t pmt_from_bool(bool val); //! Return true if val is PMT_T, return false when val is PMT_F, // else raise wrong_type exception. -bool pmt_to_bool(pmt_t val); +GRUEL_API bool pmt_to_bool(pmt_t val); /* * ------------------------------------------------------------------------ @@ -118,20 +119,20 @@ bool pmt_to_bool(pmt_t val); */ //! Return true if obj is a symbol, else false. -bool pmt_is_symbol(const pmt_t& obj); +GRUEL_API bool pmt_is_symbol(const pmt_t& obj); //! Return the symbol whose name is \p s. -pmt_t pmt_string_to_symbol(const std::string &s); +GRUEL_API pmt_t pmt_string_to_symbol(const std::string &s); //! Alias for pmt_string_to_symbol -pmt_t pmt_intern(const std::string &s); +GRUEL_API pmt_t pmt_intern(const std::string &s); /*! * If \p is a symbol, return the name of the symbol as a string. * Otherwise, raise the wrong_type exception. */ -const std::string pmt_symbol_to_string(const pmt_t& sym); +GRUEL_API const std::string pmt_symbol_to_string(const pmt_t& sym); /* * ------------------------------------------------------------------------ @@ -140,7 +141,7 @@ const std::string pmt_symbol_to_string(const pmt_t& sym); */ //! Return true if obj is any kind of number, else false. -bool pmt_is_number(pmt_t obj); +GRUEL_API bool pmt_is_number(pmt_t obj); /* * ------------------------------------------------------------------------ @@ -149,10 +150,10 @@ bool pmt_is_number(pmt_t obj); */ //! Return true if \p x is an integer number, else false -bool pmt_is_integer(pmt_t x); +GRUEL_API bool pmt_is_integer(pmt_t x); //! Return the pmt value that represents the integer \p x. -pmt_t pmt_from_long(long x); +GRUEL_API pmt_t pmt_from_long(long x); /*! * \brief Convert pmt to long if possible. @@ -161,7 +162,7 @@ pmt_t pmt_from_long(long x); * return that integer. Else raise an exception, either wrong_type * when x is not an exact integer, or out_of_range when it doesn't fit. */ -long pmt_to_long(pmt_t x); +GRUEL_API long pmt_to_long(pmt_t x); /* * ------------------------------------------------------------------------ @@ -170,10 +171,10 @@ long pmt_to_long(pmt_t x); */ //! Return true if \p x is an uint64 number, else false -bool pmt_is_uint64(pmt_t x); +GRUEL_API bool pmt_is_uint64(pmt_t x); //! Return the pmt value that represents the uint64 \p x. -pmt_t pmt_from_uint64(uint64_t x); +GRUEL_API pmt_t pmt_from_uint64(uint64_t x); /*! * \brief Convert pmt to uint64 if possible. @@ -182,7 +183,7 @@ pmt_t pmt_from_uint64(uint64_t x); * return that uint64. Else raise an exception, either wrong_type * when x is not an exact uint64, or out_of_range when it doesn't fit. */ -uint64_t pmt_to_uint64(pmt_t x); +GRUEL_API uint64_t pmt_to_uint64(pmt_t x); /* * ------------------------------------------------------------------------ @@ -193,10 +194,10 @@ uint64_t pmt_to_uint64(pmt_t x); /* * \brief Return true if \p obj is a real number, else false. */ -bool pmt_is_real(pmt_t obj); +GRUEL_API bool pmt_is_real(pmt_t obj); //! Return the pmt value that represents double \p x. -pmt_t pmt_from_double(double x); +GRUEL_API pmt_t pmt_from_double(double x); /*! * \brief Convert pmt to double if possible. @@ -205,7 +206,7 @@ pmt_t pmt_from_double(double x); * as a double. The argument \p val must be a real or integer, otherwise * a wrong_type exception is raised. */ -double pmt_to_double(pmt_t x); +GRUEL_API double pmt_to_double(pmt_t x); /* * ------------------------------------------------------------------------ @@ -216,16 +217,16 @@ double pmt_to_double(pmt_t x); /*! * \brief return true if \p obj is a complex number, false otherwise. */ -bool pmt_is_complex(pmt_t obj); +GRUEL_API bool pmt_is_complex(pmt_t obj); //! Return a complex number constructed of the given real and imaginary parts. -pmt_t pmt_make_rectangular(double re, double im); +GRUEL_API pmt_t pmt_make_rectangular(double re, double im); /*! * If \p z is complex, real or integer, return the closest complex<double>. * Otherwise, raise the wrong_type exception. */ -std::complex<double> pmt_to_complex(pmt_t z); +GRUEL_API std::complex<double> pmt_to_complex(pmt_t z); /* * ------------------------------------------------------------------------ @@ -233,35 +234,35 @@ std::complex<double> pmt_to_complex(pmt_t z); * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_NIL; //< the empty list +extern GRUEL_API const pmt_t PMT_NIL; //< the empty list //! Return true if \p x is the empty list, otherwise return false. -bool pmt_is_null(const pmt_t& x); +GRUEL_API bool pmt_is_null(const pmt_t& x); //! Return true if \p obj is a pair, else false. -bool pmt_is_pair(const pmt_t& obj); +GRUEL_API bool pmt_is_pair(const pmt_t& obj); //! Return a newly allocated pair whose car is \p x and whose cdr is \p y. -pmt_t pmt_cons(const pmt_t& x, const pmt_t& y); +GRUEL_API pmt_t pmt_cons(const pmt_t& x, const pmt_t& y); //! If \p pair is a pair, return the car of the \p pair, otherwise raise wrong_type. -pmt_t pmt_car(const pmt_t& pair); +GRUEL_API pmt_t pmt_car(const pmt_t& pair); //! If \p pair is a pair, return the cdr of the \p pair, otherwise raise wrong_type. -pmt_t pmt_cdr(const pmt_t& pair); +GRUEL_API pmt_t pmt_cdr(const pmt_t& pair); //! Stores \p value in the car field of \p pair. -void pmt_set_car(pmt_t pair, pmt_t value); +GRUEL_API void pmt_set_car(pmt_t pair, pmt_t value); //! Stores \p value in the cdr field of \p pair. -void pmt_set_cdr(pmt_t pair, pmt_t value); +GRUEL_API void pmt_set_cdr(pmt_t pair, pmt_t value); -pmt_t pmt_caar(pmt_t pair); -pmt_t pmt_cadr(pmt_t pair); -pmt_t pmt_cdar(pmt_t pair); -pmt_t pmt_cddr(pmt_t pair); -pmt_t pmt_caddr(pmt_t pair); -pmt_t pmt_cadddr(pmt_t pair); +GRUEL_API pmt_t pmt_caar(pmt_t pair); +GRUEL_API pmt_t pmt_cadr(pmt_t pair); +GRUEL_API pmt_t pmt_cdar(pmt_t pair); +GRUEL_API pmt_t pmt_cddr(pmt_t pair); +GRUEL_API pmt_t pmt_caddr(pmt_t pair); +GRUEL_API pmt_t pmt_cadddr(pmt_t pair); /* * ------------------------------------------------------------------------ @@ -274,30 +275,30 @@ pmt_t pmt_cadddr(pmt_t pair); */ //! Return true if \p x is a tuple, othewise false. -bool pmt_is_tuple(pmt_t x); +GRUEL_API bool pmt_is_tuple(pmt_t x); -pmt_t pmt_make_tuple(); -pmt_t pmt_make_tuple(const pmt_t &e0); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8); -pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9); +GRUEL_API pmt_t pmt_make_tuple(); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8); +GRUEL_API pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9); /*! * If \p x is a vector or proper list, return a tuple containing the elements of x */ -pmt_t pmt_to_tuple(const pmt_t &x); +GRUEL_API pmt_t pmt_to_tuple(const pmt_t &x); /*! * Return the contents of position \p k of \p tuple. * \p k must be a valid index of \p tuple. */ -pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); +GRUEL_API pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); /* * ------------------------------------------------------------------------ @@ -308,22 +309,22 @@ pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k); */ //! Return true if \p x is a vector, othewise false. -bool pmt_is_vector(pmt_t x); +GRUEL_API bool pmt_is_vector(pmt_t x); //! Make a vector of length \p k, with initial values set to \p fill -pmt_t pmt_make_vector(size_t k, pmt_t fill); +GRUEL_API pmt_t pmt_make_vector(size_t k, pmt_t fill); /*! * Return the contents of position \p k of \p vector. * \p k must be a valid index of \p vector. */ -pmt_t pmt_vector_ref(pmt_t vector, size_t k); +GRUEL_API pmt_t pmt_vector_ref(pmt_t vector, size_t k); //! Store \p obj in position \p k. -void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj); +GRUEL_API void pmt_vector_set(pmt_t vector, size_t k, pmt_t obj); //! Store \p fill in every position of \p vector -void pmt_vector_fill(pmt_t vector, pmt_t fill); +GRUEL_API void pmt_vector_fill(pmt_t vector, pmt_t fill); /* * ------------------------------------------------------------------------ @@ -334,7 +335,7 @@ void pmt_vector_fill(pmt_t vector, pmt_t fill); */ //! Return true if \p x is a blob, othewise false. -bool pmt_is_blob(pmt_t x); +GRUEL_API bool pmt_is_blob(pmt_t x); /*! * \brief Make a blob given a pointer and length in bytes @@ -344,13 +345,13 @@ bool pmt_is_blob(pmt_t x); * * The data is copied into the blob. */ -pmt_t pmt_make_blob(const void *buf, size_t len); +GRUEL_API pmt_t pmt_make_blob(const void *buf, size_t len); //! Return a pointer to the blob's data -const void *pmt_blob_data(pmt_t blob); +GRUEL_API const void *pmt_blob_data(pmt_t blob); //! Return the blob's length in bytes -size_t pmt_blob_length(pmt_t blob); +GRUEL_API size_t pmt_blob_length(pmt_t blob); /*! * <pre> @@ -382,106 +383,106 @@ size_t pmt_blob_length(pmt_t blob); */ //! true if \p x is any kind of uniform numeric vector -bool pmt_is_uniform_vector(pmt_t x); - -bool pmt_is_u8vector(pmt_t x); -bool pmt_is_s8vector(pmt_t x); -bool pmt_is_u16vector(pmt_t x); -bool pmt_is_s16vector(pmt_t x); -bool pmt_is_u32vector(pmt_t x); -bool pmt_is_s32vector(pmt_t x); -bool pmt_is_u64vector(pmt_t x); -bool pmt_is_s64vector(pmt_t x); -bool pmt_is_f32vector(pmt_t x); -bool pmt_is_f64vector(pmt_t x); -bool pmt_is_c32vector(pmt_t x); -bool pmt_is_c64vector(pmt_t x); - -pmt_t pmt_make_u8vector(size_t k, uint8_t fill); -pmt_t pmt_make_s8vector(size_t k, int8_t fill); -pmt_t pmt_make_u16vector(size_t k, uint16_t fill); -pmt_t pmt_make_s16vector(size_t k, int16_t fill); -pmt_t pmt_make_u32vector(size_t k, uint32_t fill); -pmt_t pmt_make_s32vector(size_t k, int32_t fill); -pmt_t pmt_make_u64vector(size_t k, uint64_t fill); -pmt_t pmt_make_s64vector(size_t k, int64_t fill); -pmt_t pmt_make_f32vector(size_t k, float fill); -pmt_t pmt_make_f64vector(size_t k, double fill); -pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill); -pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill); - -pmt_t pmt_init_u8vector(size_t k, const uint8_t *data); -pmt_t pmt_init_s8vector(size_t k, const int8_t *data); -pmt_t pmt_init_u16vector(size_t k, const uint16_t *data); -pmt_t pmt_init_s16vector(size_t k, const int16_t *data); -pmt_t pmt_init_u32vector(size_t k, const uint32_t *data); -pmt_t pmt_init_s32vector(size_t k, const int32_t *data); -pmt_t pmt_init_u64vector(size_t k, const uint64_t *data); -pmt_t pmt_init_s64vector(size_t k, const int64_t *data); -pmt_t pmt_init_f32vector(size_t k, const float *data); -pmt_t pmt_init_f64vector(size_t k, const double *data); -pmt_t pmt_init_c32vector(size_t k, const std::complex<float> *data); -pmt_t pmt_init_c64vector(size_t k, const std::complex<double> *data); - -uint8_t pmt_u8vector_ref(pmt_t v, size_t k); -int8_t pmt_s8vector_ref(pmt_t v, size_t k); -uint16_t pmt_u16vector_ref(pmt_t v, size_t k); -int16_t pmt_s16vector_ref(pmt_t v, size_t k); -uint32_t pmt_u32vector_ref(pmt_t v, size_t k); -int32_t pmt_s32vector_ref(pmt_t v, size_t k); -uint64_t pmt_u64vector_ref(pmt_t v, size_t k); -int64_t pmt_s64vector_ref(pmt_t v, size_t k); -float pmt_f32vector_ref(pmt_t v, size_t k); -double pmt_f64vector_ref(pmt_t v, size_t k); -std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k); -std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k); - -void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x -void pmt_s8vector_set(pmt_t v, size_t k, int8_t x); -void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x); -void pmt_s16vector_set(pmt_t v, size_t k, int16_t x); -void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x); -void pmt_s32vector_set(pmt_t v, size_t k, int32_t x); -void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x); -void pmt_s64vector_set(pmt_t v, size_t k, int64_t x); -void pmt_f32vector_set(pmt_t v, size_t k, float x); -void pmt_f64vector_set(pmt_t v, size_t k, double x); -void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x); -void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x); +GRUEL_API bool pmt_is_uniform_vector(pmt_t x); + +GRUEL_API bool pmt_is_u8vector(pmt_t x); +GRUEL_API bool pmt_is_s8vector(pmt_t x); +GRUEL_API bool pmt_is_u16vector(pmt_t x); +GRUEL_API bool pmt_is_s16vector(pmt_t x); +GRUEL_API bool pmt_is_u32vector(pmt_t x); +GRUEL_API bool pmt_is_s32vector(pmt_t x); +GRUEL_API bool pmt_is_u64vector(pmt_t x); +GRUEL_API bool pmt_is_s64vector(pmt_t x); +GRUEL_API bool pmt_is_f32vector(pmt_t x); +GRUEL_API bool pmt_is_f64vector(pmt_t x); +GRUEL_API bool pmt_is_c32vector(pmt_t x); +GRUEL_API bool pmt_is_c64vector(pmt_t x); + +GRUEL_API pmt_t pmt_make_u8vector(size_t k, uint8_t fill); +GRUEL_API pmt_t pmt_make_s8vector(size_t k, int8_t fill); +GRUEL_API pmt_t pmt_make_u16vector(size_t k, uint16_t fill); +GRUEL_API pmt_t pmt_make_s16vector(size_t k, int16_t fill); +GRUEL_API pmt_t pmt_make_u32vector(size_t k, uint32_t fill); +GRUEL_API pmt_t pmt_make_s32vector(size_t k, int32_t fill); +GRUEL_API pmt_t pmt_make_u64vector(size_t k, uint64_t fill); +GRUEL_API pmt_t pmt_make_s64vector(size_t k, int64_t fill); +GRUEL_API pmt_t pmt_make_f32vector(size_t k, float fill); +GRUEL_API pmt_t pmt_make_f64vector(size_t k, double fill); +GRUEL_API pmt_t pmt_make_c32vector(size_t k, std::complex<float> fill); +GRUEL_API pmt_t pmt_make_c64vector(size_t k, std::complex<double> fill); + +GRUEL_API pmt_t pmt_init_u8vector(size_t k, const uint8_t *data); +GRUEL_API pmt_t pmt_init_s8vector(size_t k, const int8_t *data); +GRUEL_API pmt_t pmt_init_u16vector(size_t k, const uint16_t *data); +GRUEL_API pmt_t pmt_init_s16vector(size_t k, const int16_t *data); +GRUEL_API pmt_t pmt_init_u32vector(size_t k, const uint32_t *data); +GRUEL_API pmt_t pmt_init_s32vector(size_t k, const int32_t *data); +GRUEL_API pmt_t pmt_init_u64vector(size_t k, const uint64_t *data); +GRUEL_API pmt_t pmt_init_s64vector(size_t k, const int64_t *data); +GRUEL_API pmt_t pmt_init_f32vector(size_t k, const float *data); +GRUEL_API pmt_t pmt_init_f64vector(size_t k, const double *data); +GRUEL_API pmt_t pmt_init_c32vector(size_t k, const std::complex<float> *data); +GRUEL_API pmt_t pmt_init_c64vector(size_t k, const std::complex<double> *data); + +GRUEL_API uint8_t pmt_u8vector_ref(pmt_t v, size_t k); +GRUEL_API int8_t pmt_s8vector_ref(pmt_t v, size_t k); +GRUEL_API uint16_t pmt_u16vector_ref(pmt_t v, size_t k); +GRUEL_API int16_t pmt_s16vector_ref(pmt_t v, size_t k); +GRUEL_API uint32_t pmt_u32vector_ref(pmt_t v, size_t k); +GRUEL_API int32_t pmt_s32vector_ref(pmt_t v, size_t k); +GRUEL_API uint64_t pmt_u64vector_ref(pmt_t v, size_t k); +GRUEL_API int64_t pmt_s64vector_ref(pmt_t v, size_t k); +GRUEL_API float pmt_f32vector_ref(pmt_t v, size_t k); +GRUEL_API double pmt_f64vector_ref(pmt_t v, size_t k); +GRUEL_API std::complex<float> pmt_c32vector_ref(pmt_t v, size_t k); +GRUEL_API std::complex<double> pmt_c64vector_ref(pmt_t v, size_t k); + +GRUEL_API void pmt_u8vector_set(pmt_t v, size_t k, uint8_t x); //< v[k] = x +GRUEL_API void pmt_s8vector_set(pmt_t v, size_t k, int8_t x); +GRUEL_API void pmt_u16vector_set(pmt_t v, size_t k, uint16_t x); +GRUEL_API void pmt_s16vector_set(pmt_t v, size_t k, int16_t x); +GRUEL_API void pmt_u32vector_set(pmt_t v, size_t k, uint32_t x); +GRUEL_API void pmt_s32vector_set(pmt_t v, size_t k, int32_t x); +GRUEL_API void pmt_u64vector_set(pmt_t v, size_t k, uint64_t x); +GRUEL_API void pmt_s64vector_set(pmt_t v, size_t k, int64_t x); +GRUEL_API void pmt_f32vector_set(pmt_t v, size_t k, float x); +GRUEL_API void pmt_f64vector_set(pmt_t v, size_t k, double x); +GRUEL_API void pmt_c32vector_set(pmt_t v, size_t k, std::complex<float> x); +GRUEL_API void pmt_c64vector_set(pmt_t v, size_t k, std::complex<double> x); // Return const pointers to the elements -const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements -const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements -const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements -const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements -const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements -const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements -const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements -const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements -const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const void *pmt_uniform_vector_elements(pmt_t v, size_t &len); //< works with any; len is in bytes + +GRUEL_API const uint8_t *pmt_u8vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int8_t *pmt_s8vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint16_t *pmt_u16vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int16_t *pmt_s16vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint32_t *pmt_u32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int32_t *pmt_s32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const uint64_t *pmt_u64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const int64_t *pmt_s64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const float *pmt_f32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const double *pmt_f64vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const std::complex<float> *pmt_c32vector_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API const std::complex<double> *pmt_c64vector_elements(pmt_t v, size_t &len); //< len is in elements // Return non-const pointers to the elements -void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes - -uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements -std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API void *pmt_uniform_vector_writable_elements(pmt_t v, size_t &len); //< works with any; len is in bytes + +GRUEL_API uint8_t *pmt_u8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int8_t *pmt_s8vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint16_t *pmt_u16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int16_t *pmt_s16vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint32_t *pmt_u32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int32_t *pmt_s32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API uint64_t *pmt_u64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API int64_t *pmt_s64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API float *pmt_f32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API double *pmt_f64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API std::complex<float> *pmt_c32vector_writable_elements(pmt_t v, size_t &len); //< len is in elements +GRUEL_API std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< len is in elements /* * ------------------------------------------------------------------------ @@ -494,31 +495,31 @@ std::complex<double> *pmt_c64vector_writable_elements(pmt_t v, size_t &len); //< */ //! Return true if \p obj is a dictionary -bool pmt_is_dict(const pmt_t &obj); +GRUEL_API bool pmt_is_dict(const pmt_t &obj); //! Make an empty dictionary -pmt_t pmt_make_dict(); +GRUEL_API pmt_t pmt_make_dict(); //! Return a new dictionary with \p key associated with \p value. -pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value); +GRUEL_API pmt_t pmt_dict_add(const pmt_t &dict, const pmt_t &key, const pmt_t &value); //! Return a new dictionary with \p key removed. -pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key); +GRUEL_API pmt_t pmt_dict_delete(const pmt_t &dict, const pmt_t &key); //! Return true if \p key exists in \p dict -bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key); +GRUEL_API bool pmt_dict_has_key(const pmt_t &dict, const pmt_t &key); //! If \p key exists in \p dict, return associated value; otherwise return \p not_found. -pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found); +GRUEL_API pmt_t pmt_dict_ref(const pmt_t &dict, const pmt_t &key, const pmt_t ¬_found); //! Return list of (key . value) pairs -pmt_t pmt_dict_items(pmt_t dict); +GRUEL_API pmt_t pmt_dict_items(pmt_t dict); //! Return list of keys -pmt_t pmt_dict_keys(pmt_t dict); +GRUEL_API pmt_t pmt_dict_keys(pmt_t dict); //! Return list of values -pmt_t pmt_dict_values(pmt_t dict); +GRUEL_API pmt_t pmt_dict_values(pmt_t dict); /* * ------------------------------------------------------------------------ @@ -530,16 +531,16 @@ pmt_t pmt_dict_values(pmt_t dict); */ //! Return true if \p obj is an any -bool pmt_is_any(pmt_t obj); +GRUEL_API bool pmt_is_any(pmt_t obj); //! make an any -pmt_t pmt_make_any(const boost::any &any); +GRUEL_API pmt_t pmt_make_any(const boost::any &any); //! Return underlying boost::any -boost::any pmt_any_ref(pmt_t obj); +GRUEL_API boost::any pmt_any_ref(pmt_t obj); //! Store \p any in \p obj -void pmt_any_set(pmt_t obj, const boost::any &any); +GRUEL_API void pmt_any_set(pmt_t obj, const boost::any &any); /* @@ -548,13 +549,13 @@ void pmt_any_set(pmt_t obj, const boost::any &any); * ------------------------------------------------------------------------ */ //! Return true if \p obj is a msg_accepter -bool pmt_is_msg_accepter(const pmt_t &obj); +GRUEL_API bool pmt_is_msg_accepter(const pmt_t &obj); //! make a msg_accepter -pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma); +GRUEL_API pmt_t pmt_make_msg_accepter(boost::shared_ptr<gruel::msg_accepter> ma); //! Return underlying msg_accepter -boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); +GRUEL_API boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); /* * ------------------------------------------------------------------------ @@ -563,7 +564,7 @@ boost::shared_ptr<gruel::msg_accepter> pmt_msg_accepter_ref(const pmt_t &obj); */ //! Return true if x and y are the same object; otherwise return false. -bool pmt_eq(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_eq(const pmt_t& x, const pmt_t& y); /*! * \brief Return true if x and y should normally be regarded as the same object, else false. @@ -578,7 +579,7 @@ bool pmt_eq(const pmt_t& x, const pmt_t& y); * x and y are pairs or vectors that denote same location in store. * </pre> */ -bool pmt_eqv(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_eqv(const pmt_t& x, const pmt_t& y); /*! * pmt_equal recursively compares the contents of pairs and vectors, @@ -586,11 +587,11 @@ bool pmt_eqv(const pmt_t& x, const pmt_t& y); * pmt_equal may fail to terminate if its arguments are circular data * structures. */ -bool pmt_equal(const pmt_t& x, const pmt_t& y); +GRUEL_API bool pmt_equal(const pmt_t& x, const pmt_t& y); //! Return the number of elements in v -size_t pmt_length(const pmt_t& v); +GRUEL_API size_t pmt_length(const pmt_t& v); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -600,7 +601,7 @@ size_t pmt_length(const pmt_t& v); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_eq to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assq(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assq(pmt_t obj, pmt_t alist); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -610,7 +611,7 @@ pmt_t pmt_assq(pmt_t obj, pmt_t alist); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_eqv to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assv(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assv(pmt_t obj, pmt_t alist); /*! * \brief Find the first pair in \p alist whose car field is \p obj @@ -620,7 +621,7 @@ pmt_t pmt_assv(pmt_t obj, pmt_t alist); * in \p alist has \p obj as its car then \#f is returned. * Uses pmt_equal to compare \p obj with car fields of the pairs in \p alist. */ -pmt_t pmt_assoc(pmt_t obj, pmt_t alist); +GRUEL_API pmt_t pmt_assoc(pmt_t obj, pmt_t alist); /*! * \brief Apply \p proc element-wise to the elements of list and returns @@ -629,21 +630,21 @@ pmt_t pmt_assoc(pmt_t obj, pmt_t alist); * \p list must be a list. The dynamic order in which \p proc is * applied to the elements of \p list is unspecified. */ -pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list); +GRUEL_API pmt_t pmt_map(pmt_t proc(const pmt_t&), pmt_t list); /*! * \brief reverse \p list. * * \p list must be a proper list. */ -pmt_t pmt_reverse(pmt_t list); +GRUEL_API pmt_t pmt_reverse(pmt_t list); /*! * \brief destructively reverse \p list. * * \p list must be a proper list. */ -pmt_t pmt_reverse_x(pmt_t list); +GRUEL_API pmt_t pmt_reverse_x(pmt_t list); /*! * \brief (acons x y a) == (cons (cons x y) a) @@ -657,76 +658,76 @@ pmt_acons(pmt_t x, pmt_t y, pmt_t a) /*! * \brief locates \p nth element of \n list where the car is the 'zeroth' element. */ -pmt_t pmt_nth(size_t n, pmt_t list); +GRUEL_API pmt_t pmt_nth(size_t n, pmt_t list); /*! * \brief returns the tail of \p list that would be obtained by calling * cdr \p n times in succession. */ -pmt_t pmt_nthcdr(size_t n, pmt_t list); +GRUEL_API pmt_t pmt_nthcdr(size_t n, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_memq use pmt_eq to compare \p obj with the elements of \p list. */ -pmt_t pmt_memq(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_memq(pmt_t obj, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_memv use pmt_eqv to compare \p obj with the elements of \p list. */ -pmt_t pmt_memv(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_memv(pmt_t obj, pmt_t list); /*! * \brief Return the first sublist of \p list whose car is \p obj. * If \p obj does not occur in \p list, then \#f is returned. * pmt_member use pmt_equal to compare \p obj with the elements of \p list. */ -pmt_t pmt_member(pmt_t obj, pmt_t list); +GRUEL_API pmt_t pmt_member(pmt_t obj, pmt_t list); /*! * \brief Return true if every element of \p list1 appears in \p list2, and false otherwise. * Comparisons are done with pmt_eqv. */ -bool pmt_subsetp(pmt_t list1, pmt_t list2); +GRUEL_API bool pmt_subsetp(pmt_t list1, pmt_t list2); /*! * \brief Return a list of length 1 containing \p x1 */ -pmt_t pmt_list1(const pmt_t& x1); +GRUEL_API pmt_t pmt_list1(const pmt_t& x1); /*! * \brief Return a list of length 2 containing \p x1, \p x2 */ -pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2); +GRUEL_API pmt_t pmt_list2(const pmt_t& x1, const pmt_t& x2); /*! * \brief Return a list of length 3 containing \p x1, \p x2, \p x3 */ -pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3); +GRUEL_API pmt_t pmt_list3(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3); /*! * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4 */ -pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4); +GRUEL_API pmt_t pmt_list4(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4); /*! * \brief Return a list of length 5 containing \p x1, \p x2, \p x3, \p x4, \p x5 */ -pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5); +GRUEL_API pmt_t pmt_list5(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5); /*! * \brief Return a list of length 6 containing \p x1, \p x2, \p x3, \p x4, \p * x5, \p x6 */ -pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6); +GRUEL_API pmt_t pmt_list6(const pmt_t& x1, const pmt_t& x2, const pmt_t& x3, const pmt_t& x4, const pmt_t& x5, const pmt_t& x6); /*! * \brief Return \p list with \p item added to it. */ -pmt_t pmt_list_add(pmt_t list, const pmt_t& item); +GRUEL_API pmt_t pmt_list_add(pmt_t list, const pmt_t& item); /* @@ -734,10 +735,10 @@ pmt_t pmt_list_add(pmt_t list, const pmt_t& item); * read / write * ------------------------------------------------------------------------ */ -extern const pmt_t PMT_EOF; //< The end of file object +extern GRUEL_API const pmt_t PMT_EOF; //< The end of file object //! return true if obj is the EOF object, otherwise return false. -bool pmt_is_eof_object(pmt_t obj); +GRUEL_API bool pmt_is_eof_object(pmt_t obj); /*! * read converts external representations of pmt objects into the @@ -754,26 +755,26 @@ bool pmt_is_eof_object(pmt_t obj); * representation, but the external representation is incomplete and * therefore not parsable, an error is signaled. */ -pmt_t pmt_read(std::istream &port); +GRUEL_API pmt_t pmt_read(std::istream &port); /*! * Write a written representation of \p obj to the given \p port. */ -void pmt_write(pmt_t obj, std::ostream &port); +GRUEL_API void pmt_write(pmt_t obj, std::ostream &port); /*! * Return a string representation of \p obj. * This is the same output as would be generated by pmt_write. */ -std::string pmt_write_string(pmt_t obj); +GRUEL_API std::string pmt_write_string(pmt_t obj); -std::ostream& operator<<(std::ostream &os, pmt_t obj); +GRUEL_API std::ostream& operator<<(std::ostream &os, pmt_t obj); /*! * \brief Write pmt string representation to stdout. */ -void pmt_print(pmt_t v); +GRUEL_API void pmt_print(pmt_t v); /* @@ -784,25 +785,25 @@ void pmt_print(pmt_t v); /*! * \brief Write portable byte-serial representation of \p obj to \p sink */ -bool pmt_serialize(pmt_t obj, std::streambuf &sink); +GRUEL_API bool pmt_serialize(pmt_t obj, std::streambuf &sink); /*! * \brief Create obj from portable byte-serial representation */ -pmt_t pmt_deserialize(std::streambuf &source); +GRUEL_API pmt_t pmt_deserialize(std::streambuf &source); -void pmt_dump_sizeof(); // debugging +GRUEL_API void pmt_dump_sizeof(); // debugging /*! * \brief Provide a simple string generating interface to pmt's serialize function */ -std::string pmt_serialize_str(pmt_t obj); +GRUEL_API std::string pmt_serialize_str(pmt_t obj); /*! * \brief Provide a simple string generating interface to pmt's deserialize function */ -pmt_t pmt_deserialize_str(std::string str); +GRUEL_API pmt_t pmt_deserialize_str(std::string str); } /* namespace pmt */ diff --git a/gruel/src/include/gruel/pmt_pool.h b/gruel/src/include/gruel/pmt_pool.h index b792523e0..2b227ce6a 100644 --- a/gruel/src/include/gruel/pmt_pool.h +++ b/gruel/src/include/gruel/pmt_pool.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_PMT_POOL_H #define INCLUDED_PMT_POOL_H +#include <gruel/api.h> #include <cstddef> #include <vector> #include <boost/thread.hpp> @@ -33,9 +34,9 @@ namespace pmt { * FIXME may want to go to global allocation with per-thread free list. * This would eliminate virtually all lock contention. */ -class pmt_pool { +class GRUEL_API pmt_pool { - struct item { + struct GRUEL_API item { struct item *d_next; }; diff --git a/gruel/src/include/gruel/realtime.h b/gruel/src/include/gruel/realtime.h index d110ec956..87f2b0f74 100644 --- a/gruel/src/include/gruel/realtime.h +++ b/gruel/src/include/gruel/realtime.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_GRUEL_REALTIME_H #define INCLUDED_GRUEL_REALTIME_H +#include <gruel/api.h> #include <stdexcept> /*! @@ -58,7 +59,7 @@ namespace gruel { static inline int rt_priority_max() { return 15; } static inline int rt_priority_default() { return 1; } - struct rt_sched_param { + struct GRUEL_API rt_sched_param { int priority; rt_sched_policy policy; @@ -88,7 +89,7 @@ namespace gruel { // NOTE: If you change this, you need to change the code in // gnuradio-core/src/lib/runtime/gr_realtime.i, see note there. rt_status_t - enable_realtime_scheduling(rt_sched_param = rt_sched_param()); + GRUEL_API enable_realtime_scheduling(rt_sched_param = rt_sched_param()); } // namespace gruel diff --git a/gruel/src/include/gruel/sys_pri.h b/gruel/src/include/gruel/sys_pri.h index b0fd83654..a29b051bf 100644 --- a/gruel/src/include/gruel/sys_pri.h +++ b/gruel/src/include/gruel/sys_pri.h @@ -22,6 +22,7 @@ #ifndef INCLUDED_GRUEL_SYS_PRI_H #define INCLUDED_GRUEL_SYS_PRI_H +#include <gruel/api.h> #include <gruel/realtime.h> /* @@ -29,7 +30,7 @@ */ namespace gruel { - struct sys_pri { + struct GRUEL_API sys_pri { static rt_sched_param python(); // python code static rt_sched_param normal(); // normal blocks static rt_sched_param gcell_event_handler(); diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h index 5a8ab1876..c6031d88d 100644 --- a/gruel/src/include/gruel/thread.h +++ b/gruel/src/include/gruel/thread.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_THREAD_H #define INCLUDED_THREAD_H +#include <gruel/api.h> #include <boost/thread/thread.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/locks.hpp> diff --git a/gruel/src/include/gruel/thread_body_wrapper.h b/gruel/src/include/gruel/thread_body_wrapper.h index b024bfdaf..ae0feda08 100644 --- a/gruel/src/include/gruel/thread_body_wrapper.h +++ b/gruel/src/include/gruel/thread_body_wrapper.h @@ -21,6 +21,7 @@ #ifndef INCLUDED_THREAD_BODY_WRAPPER_H #define INCLUDED_THREAD_BODY_WRAPPER_H +#include <gruel/api.h> #include <gruel/thread.h> #include <exception> #include <iostream> @@ -28,7 +29,7 @@ namespace gruel { - void mask_signals(); + GRUEL_API void mask_signals(); template <class F> class thread_body_wrapper diff --git a/gruel/src/include/gruel/thread_group.h b/gruel/src/include/gruel/thread_group.h index 0270746e4..e1658dd1f 100644 --- a/gruel/src/include/gruel/thread_group.h +++ b/gruel/src/include/gruel/thread_group.h @@ -15,6 +15,7 @@ #ifndef INCLUDED_GRUEL_THREAD_GROUP_H #define INCLUDED_GRUEL_THREAD_GROUP_H +#include <gruel/api.h> #include <gruel/thread.h> #include <boost/utility.hpp> #include <boost/thread/shared_mutex.hpp> @@ -22,7 +23,7 @@ namespace gruel { - class thread_group : public boost::noncopyable + class GRUEL_API thread_group : public boost::noncopyable { public: thread_group(); diff --git a/gruel/src/lib/CMakeLists.txt b/gruel/src/lib/CMakeLists.txt new file mode 100644 index 000000000..b54e644bc --- /dev/null +++ b/gruel/src/lib/CMakeLists.txt @@ -0,0 +1,110 @@ +# Copyright 2010-2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +include(GrMiscUtils) +include(CheckCXXSourceCompiles) + +GR_CHECK_HDR_N_DEF(signal.h HAVE_SIGNAL_H) +GR_CHECK_HDR_N_DEF(sched.h HAVE_SCHED_H) + +set(CMAKE_REQUIRED_LIBRARIES -lpthread) +CHECK_CXX_SOURCE_COMPILES(" + #include <signal.h> + int main(){pthread_sigmask(0, 0, 0); return 0;} + " HAVE_PTHREAD_SIGMASK +) +GR_ADD_COND_DEF(HAVE_PTHREAD_SIGMASK) + +set(CMAKE_REQUIRED_LIBRARIES -lpthread) +CHECK_CXX_SOURCE_COMPILES(" + #include <pthread.h> + int main(){ + pthread_t pthread; + pthread_setschedparam(pthread, 0, 0); + return 0; + } " HAVE_PTHREAD_SETSCHEDPARAM +) +GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM) + +CHECK_CXX_SOURCE_COMPILES(" + #include <sched.h> + int main(){ + pid_t pid; + sched_setscheduler(pid, 0, 0); + return 0; + } " HAVE_SCHED_SETSCHEDULER +) +GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER) + +######################################################################## +# Include subdirs rather to populate to the sources lists. +######################################################################## +GR_INCLUDE_SUBDIRECTORY(msg) +GR_INCLUDE_SUBDIRECTORY(pmt) + +######################################################################## +# Setup the include and linker paths +######################################################################## +include_directories(${GRUEL_INCLUDE_DIRS}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories(${Boost_INCLUDE_DIRS}) +link_directories(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +list(APPEND gruel_sources + realtime.cc + sys_pri.cc + thread_body_wrapper.cc + thread_group.cc +) + +add_library(gruel SHARED ${gruel_sources}) +target_link_libraries(gruel ${Boost_LIBRARIES}) +set_target_properties(gruel PROPERTIES DEFINE_SYMBOL "gruel_EXPORTS") +set_target_properties(gruel PROPERTIES SOVERSION ${LIBVER}) + +install(TARGETS gruel + LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT "gruel_runtime" # .so/.dylib file + ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT "gruel_devel" # .lib file + RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT "gruel_runtime" # .dll file +) + +######################################################################## +# Setup tests +# Set the test environment so the build libs will be found under MSVC. +######################################################################## +if(ENABLE_TESTING) + +include_directories(${CPPUNIT_INCLUDE_DIRS}) +link_directories(${CPPUNIT_LIBRARY_DIRS}) + +include(GrTest) +set(GR_TEST_TARGET_DEPS gruel) +list(APPEND test_gruel_sources test_gruel.cc) +add_executable(test_gruel ${test_gruel_sources}) +target_link_libraries(test_gruel gruel ${CPPUNIT_LIBRARIES}) +GR_ADD_TEST(gruel-test test_gruel) + +endif(ENABLE_TESTING) diff --git a/gruel/src/lib/msg/CMakeLists.txt b/gruel/src/lib/msg/CMakeLists.txt new file mode 100644 index 000000000..116d2c67f --- /dev/null +++ b/gruel/src/lib/msg/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## + +list(APPEND gruel_sources + ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/msg_accepter_msgq.cc + ${CMAKE_CURRENT_SOURCE_DIR}/msg_queue.cc +) diff --git a/gruel/src/lib/pmt/CMakeLists.txt b/gruel/src/lib/pmt/CMakeLists.txt new file mode 100644 index 000000000..a708fa7ad --- /dev/null +++ b/gruel/src/lib/pmt/CMakeLists.txt @@ -0,0 +1,90 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# This file included, use CMake directory variables +######################################################################## +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +######################################################################## +# Generate serial tags header file +######################################################################## +get_filename_component(SCHEME_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../scheme/gnuradio ABSOLUTE +) + +get_filename_component(PMT_SERIAL_TAGS_H + ${CMAKE_CURRENT_BINARY_DIR}/../../include/gruel/pmt_serial_tags.h ABSOLUTE +) + +add_custom_command( + OUTPUT ${PMT_SERIAL_TAGS_H} + DEPENDS ${SCHEME_DIR}/gen-serial-tags.py + DEPENDS ${SCHEME_DIR}/pmt-serial-tags.scm + COMMAND ${PYTHON_EXECUTABLE} + ${SCHEME_DIR}/gen-serial-tags.py + ${SCHEME_DIR}/pmt-serial-tags.scm + ${PMT_SERIAL_TAGS_H} +) + +install( + FILES ${PMT_SERIAL_TAGS_H} + DESTINATION ${GR_INCLUDE_DIR}/gruel + COMPONENT "gruel_devel" +) + +include(AddFileDependencies) +ADD_FILE_DEPENDENCIES( + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc + ${PMT_SERIAL_TAGS_H} +) + +######################################################################## +# Generate other pmt stuff +######################################################################## +add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.h + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/generate_unv.py + ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t + ${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t + ${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t + COMMAND ${PYTHON_EXECUTABLE} -B -c + \"import os,sys\;srcdir='${CMAKE_CURRENT_SOURCE_DIR}'\;sys.path.append(srcdir)\;os.environ['srcdir']=srcdir\;from generate_unv import main\;main()\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +list(APPEND gruel_sources + ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_pool.cc + ${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc +) + +list(APPEND test_gruel_sources + ${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt_prims.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_pmt.cc +) diff --git a/gruel/src/lib/pmt/pmt_int.h b/gruel/src/lib/pmt/pmt_int.h index ea28e37b4..3a5cd382b 100644 --- a/gruel/src/lib/pmt/pmt_int.h +++ b/gruel/src/lib/pmt/pmt_int.h @@ -35,7 +35,7 @@ #define PMT_LOCAL_ALLOCATOR 0 // define to 0 or 1 namespace pmt { -class pmt_base : boost::noncopyable { +class GRUEL_API pmt_base : boost::noncopyable { mutable boost::detail::atomic_count count_; protected: diff --git a/gruel/src/lib/pmt/qa_pmt.h b/gruel/src/lib/pmt/qa_pmt.h index 43a6dbf67..424c1065b 100644 --- a/gruel/src/lib/pmt/qa_pmt.h +++ b/gruel/src/lib/pmt/qa_pmt.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_QA_PMT_H #define INCLUDED_QA_PMT_H +#include <gruel/attributes.h> #include <cppunit/TestSuite.h> //! collect all the tests for pmt -class qa_pmt { +class __GR_ATTR_EXPORT qa_pmt { public: //! return suite of tests for all of pmt static CppUnit::TestSuite *suite (); diff --git a/gruel/src/lib/pmt/qa_pmt_prims.cc b/gruel/src/lib/pmt/qa_pmt_prims.cc index 985361f13..7dec30d56 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.cc +++ b/gruel/src/lib/pmt/qa_pmt_prims.cc @@ -23,6 +23,7 @@ #include <qa_pmt_prims.h> #include <cppunit/TestAssert.h> #include <gruel/msg_passing.h> +#include <boost/format.hpp> #include <cstdio> #include <cstring> #include <sstream> @@ -54,9 +55,8 @@ qa_pmt_prims::test_symbols() // generate a bunch of symbols for (int i = 0; i < N; i++){ - char buf[100]; - snprintf(buf, sizeof(buf), "test-%d", i); - v1[i] = mp(buf); + std::string buf = str(boost::format("test-%d") % i); + v1[i] = mp(buf.c_str()); } // confirm that they are all unique @@ -66,9 +66,8 @@ qa_pmt_prims::test_symbols() // generate the same symbols again for (int i = 0; i < N; i++){ - char buf[100]; - snprintf(buf, sizeof(buf), "test-%d", i); - v2[i] = mp(buf); + std::string buf = str(boost::format("test-%d") % i); + v2[i] = mp(buf.c_str()); } // confirm that we get the same ones back diff --git a/gruel/src/lib/pmt/qa_pmt_prims.h b/gruel/src/lib/pmt/qa_pmt_prims.h index efc5c6050..cc1409ee6 100644 --- a/gruel/src/lib/pmt/qa_pmt_prims.h +++ b/gruel/src/lib/pmt/qa_pmt_prims.h @@ -22,10 +22,12 @@ #ifndef INCLUDED_QA_PMT_PRIMS_H #define INCLUDED_QA_PMT_PRIMS_H +#include <gruel/attributes.h> +#include <gruel/api.h> //reason: suppress warnings #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_pmt_prims : public CppUnit::TestCase { +class __GR_ATTR_EXPORT qa_pmt_prims : public CppUnit::TestCase { CPPUNIT_TEST_SUITE(qa_pmt_prims); CPPUNIT_TEST(test_symbols); diff --git a/gruel/src/lib/realtime.cc b/gruel/src/lib/realtime.cc index 7397cf3d3..96351f812 100644 --- a/gruel/src/lib/realtime.cc +++ b/gruel/src/lib/realtime.cc @@ -132,6 +132,38 @@ namespace gruel { } // namespace gruel +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) + +#include <windows.h> + +namespace gruel { + + rt_status_t enable_realtime_scheduling(rt_sched_param p){ + + //set the priority class on the process + int pri_class = (true)? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS; + if (SetPriorityClass(GetCurrentProcess(), pri_class) == 0) + return RT_OTHER_ERROR; + + //scale the priority value to the constants + int priorities[] = { + THREAD_PRIORITY_IDLE, THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST, THREAD_PRIORITY_TIME_CRITICAL + }; + const double priority = double(p.priority)/(rt_priority_max() - rt_priority_min()); + size_t pri_index = size_t((priority+1.0)*6/2.0); // -1 -> 0, +1 -> 6 + pri_index %= sizeof(priorities)/sizeof(*priorities); //range check + + //set the thread priority on the thread + if (SetThreadPriority(GetCurrentThread(), priorities[pri_index]) == 0) + return RT_OTHER_ERROR; + + //printf("SetPriorityClass + SetThreadPriority\n"); + return RT_OK; + } + +} // namespace gruel + #else namespace gruel { diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/CMakeLists.txt new file mode 100644 index 000000000..be5ac956e --- /dev/null +++ b/gruel/src/python/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +include(GrPython) + +######################################################################## +# Install python files +######################################################################## +GR_PYTHON_INSTALL( + FILES __init__.py + DESTINATION ${GR_PYTHON_DIR}/gruel + COMPONENT "gruel_python" +) + +GR_PYTHON_INSTALL( + FILES pmt/__init__.py + DESTINATION ${GR_PYTHON_DIR}/gruel/pmt + COMPONENT "gruel_python" +) + +######################################################################## +# Setup unit tests +######################################################################## +if(ENABLE_TESTING) +include(GrTest) +file(GLOB py_qa_test_files "qa_*.py") +foreach(py_qa_test_file ${py_qa_test_files}) + get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) + set(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gruel/src/python + ${CMAKE_BINARY_DIR}/gruel/src/swig + ) + set(GR_TEST_TARGET_DEPS gruel gnuradio-core) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) +endforeach(py_qa_test_file) +endif(ENABLE_TESTING) diff --git a/gruel/src/scheme/gnuradio/CMakeLists.txt b/gruel/src/scheme/gnuradio/CMakeLists.txt new file mode 100644 index 000000000..4ff4f7feb --- /dev/null +++ b/gruel/src/scheme/gnuradio/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## + +install(FILES + pmt-serial-tags.scm + pmt-serialize.scm + macros-etc.scm +DESTINATION ${GR_PKG_DATA_DIR} COMPONENT "gruel_swig") diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt new file mode 100644 index 000000000..c2769ae27 --- /dev/null +++ b/gruel/src/swig/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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 3, or (at your option) +# any later version. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Setup swig generation +######################################################################## +include(GrPython) +include(GrSwig) + +set(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS}) +set(GR_SWIG_LIBRARIES gruel) + +GR_SWIG_MAKE(pmt_swig pmt_swig.i) + +GR_SWIG_INSTALL( + TARGETS pmt_swig + DESTINATION ${GR_PYTHON_DIR}/gruel/pmt + COMPONENT "gruel_python" +) + +install( + FILES gr_intrusive_ptr.i pmt_swig.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "gruel_swig" +) |