summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-05-02 11:49:26 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-05-02 11:49:26 -0700
commit91e61ae08085ead9ec41e6c94c54751b9813abb9 (patch)
tree6d259bdc6c4549317d5ddf5967906c171b5f9cd8
parent2b741e5394c357a67399d39c648173b3cedc580d (diff)
runtime: remove dead error_handler.h
-rw-r--r--gnuradio-runtime/include/gnuradio/error_handler.h125
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/lib/error_handler.cc249
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/swig/error_handler.i69
-rw-r--r--gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h1
-rw-r--r--gnuradio-runtime/swig/runtime_swig.i2
7 files changed, 0 insertions, 448 deletions
diff --git a/gnuradio-runtime/include/gnuradio/error_handler.h b/gnuradio-runtime/include/gnuradio/error_handler.h
deleted file mode 100644
index 2d6a8c3883..0000000000
--- a/gnuradio-runtime/include/gnuradio/error_handler.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 code is based on error.hh from the "Click Modular Router".
- * Original copyright follows:
- */
-/*
- * error.{cc,hh} -- flexible classes for error reporting
- * Eddie Kohler
- *
- * Copyright (c) 1999-2000 Massachusetts Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, subject to the conditions
- * listed in the Click LICENSE file. These conditions include: you must
- * preserve this copyright notice, and you cannot mention the copyright
- * holders in advertising related to the Software without their permission.
- * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
- * notice is a summary of the Click LICENSE file; the license in that file is
- * legally binding.
- */
-
-#ifndef INCLUDED_GR_ERROR_HANDLER_H
-#define INCLUDED_GR_ERROR_HANDLER_H
-
-#include <gnuradio/api.h>
-#include <stdarg.h>
-#include <string>
-#include <cstdio> // for FILE
-
-namespace gr {
-
- /*!
- * \brief abstract error handler
- * \ingroup base
- */
- class GR_RUNTIME_API error_handler
- {
- public:
- enum seriousness {
- ERR_DEBUG = 0x00000000,
- ERR_MESSAGE = 0x00010000,
- ERR_WARNING = 0x00020000,
- ERR_ERROR = 0x00030000,
- ERR_FATAL = 0x00040000
- };
-
- error_handler() {}
- virtual ~error_handler();
-
- static error_handler *default_handler();
- static error_handler *silent_handler();
-
- static bool has_default_handler();
- static void set_default_handler(error_handler *errh);
-
- void debug(const char *format, ...);
- void message(const char *format, ...);
- void warning(const char *format, ...);
- void error(const char *format, ...);
- void fatal(const char *format, ...);
-
- virtual int nwarnings() const = 0;
- virtual int nerrors() const = 0;
- virtual void reset_counts() = 0;
-
- void verror(seriousness s, const char *format, va_list);
- void verror_text(seriousness s, const std::string &text);
-
- protected:
- virtual void count_error(seriousness s) = 0;
- virtual void handle_text(seriousness s, const std::string &str) = 0;
- std::string make_text(seriousness s, const char *format, va_list);
- };
-
-
- class GR_RUNTIME_API base_error_handler : public error_handler
- {
- int d_nwarnings;
- int d_nerrors;
-
- public:
- base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
- int nwarnings() const { return d_nwarnings; }
- int nerrors() const { return d_nerrors; }
- void reset_counts() { d_nwarnings = d_nerrors = 0; }
- void count_error(seriousness s);
- };
-
- class GR_RUNTIME_API file_error_handler : public base_error_handler
- {
- FILE *d_file;
- int d_fd;
-
- public:
- file_error_handler(FILE *file);
- file_error_handler(int file_descriptor);
- ~file_error_handler();
-
- void handle_text(seriousness s, const std::string &str);
- };
-
-} /* namespace gr */
-
-#endif /* INCLUDED_GR_ERROR_HANDLER_H */
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index ba5efc545c..88ac589cb3 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -80,7 +80,6 @@ list(APPEND gnuradio_runtime_sources
buffer.cc
circular_file.cc
dispatcher.cc
- error_handler.cc
feval.cc
flat_flowgraph.cc
flowgraph.cc
diff --git a/gnuradio-runtime/lib/error_handler.cc b/gnuradio-runtime/lib/error_handler.cc
deleted file mode 100644
index 50db15d049..0000000000
--- a/gnuradio-runtime/lib/error_handler.cc
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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 code is based on error.cc from the "Click Modular Router".
- * Original copyright follows:
- */
-/*
- * error.{cc,hh} -- flexible classes for error reporting
- * Eddie Kohler
- *
- * Copyright (c) 1999-2000 Massachusetts Institute of Technology
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, subject to the conditions
- * listed in the Click LICENSE file. These conditions include: you must
- * preserve this copyright notice, and you cannot mention the copyright
- * holders in advertising related to the Software without their permission.
- * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
- * notice is a summary of the Click LICENSE file; the license in that file is
- * legally binding.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gnuradio/error_handler.h>
-#include <assert.h>
-#include <stdexcept>
-#include <unistd.h>
-
-#ifdef HAVE_IO_H
-#include <io.h>
-#endif
-
-namespace gr {
-
- static error_handler *s_default_handler = 0;
- static error_handler *s_silent_handler = 0;
-
- bool
- error_handler::has_default_handler()
- {
- return s_default_handler != 0;
- }
-
- void
- error_handler::set_default_handler(error_handler *errh)
- {
- s_default_handler = errh;
- }
-
- error_handler *
- error_handler::default_handler()
- {
- assert(s_default_handler != 0);
- return s_default_handler;
- }
-
- error_handler *
- error_handler::silent_handler()
- {
- assert(s_silent_handler != 0);
- return s_silent_handler;
- }
-
- // ----------------------------------------------------------------
-
- error_handler::~error_handler()
- {
- // nop
- }
-
- void
- error_handler::debug(const char *format, ...)
- {
- va_list val;
- va_start(val, format);
- verror(ERR_DEBUG, format, val);
- va_end(val);
- }
-
- void
- error_handler::message(const char *format, ...)
- {
- va_list val;
- va_start(val, format);
- verror(ERR_MESSAGE, format, val);
- va_end(val);
- }
-
- void
- error_handler::warning(const char *format, ...)
- {
- va_list val;
- va_start(val, format);
- verror(ERR_WARNING, format, val);
- va_end(val);
- }
-
- void
- error_handler::error(const char *format, ...)
- {
- va_list val;
- va_start(val, format);
- verror(ERR_ERROR, format, val);
- va_end(val);
- }
-
- void
- error_handler::fatal(const char *format, ...)
- {
- va_list val;
- va_start(val, format);
- verror(ERR_FATAL, format, val);
- va_end(val);
- }
-
- void
- error_handler::verror(seriousness s, const char *format, va_list val)
- {
- std::string text = make_text(s, format, val);
- handle_text(s, text);
- count_error(s);
- }
-
- void
- error_handler::verror_text(seriousness s, const std::string &text)
- {
- // text is already made
- handle_text(s, text);
- count_error(s);
- }
-
- std::string
- error_handler::make_text(seriousness s, const char *format, va_list val)
- {
- char text_buf[4096];
- vsnprintf(text_buf, sizeof(text_buf), format, val);
- text_buf[sizeof(text_buf)-1] = 0;
- return text_buf;
- }
-
- // ----------------------------------------------------------------
-
- void
- base_error_handler::count_error(seriousness s)
- {
- if(s < ERR_WARNING)
- /* do nothing */;
- else if(s < ERR_ERROR)
- d_nwarnings++;
- else
- d_nerrors++;
- }
-
- // ----------------------------------------------------------------
-
- file_error_handler::file_error_handler(FILE *file)
- : d_file(file), d_fd(-1)
- {
- }
-
- file_error_handler::file_error_handler(int file_descriptor)
- {
- d_fd = dup(file_descriptor); // so we can fclose it
- if(d_fd == -1){
- perror("gr::file_error_handler:dup");
- throw std::invalid_argument("gr::file_error_handler:dup");
- }
- d_file = fdopen(d_fd, "w");
- if(d_file == 0){
- perror("gr::file_error_handler:fdopen");
- throw std::invalid_argument("gr::file_error_handler:fdopen");
- }
- }
-
- file_error_handler::~file_error_handler()
- {
- if(d_fd != -1){
- fclose(d_file);
- }
- }
-
- void
- file_error_handler::handle_text(seriousness s, const std::string &text)
- {
- if(text.length() <= 0)
- return;
-
- fwrite(text.data(), 1, text.length(), d_file);
- if(text[text.length()-1] != '\n')
- fwrite("\n", 1, 1, d_file);
-
- if(d_fd != -1)
- fflush(d_file); // keep synced with any other users of fd
- }
-
-
- // ----------------------------------------------------------------
- // static error handlers
- //
-
- class silent_error_handler : public base_error_handler
- {
- public:
- silent_error_handler() {}
- void handle_text(seriousness s, const std::string &str);
- };
-
- void
- silent_error_handler::handle_text(seriousness s, const std::string &str)
- {
- // nop
- }
-
- class force_init
- {
- public:
- force_init()
- {
- s_default_handler = new file_error_handler(stdout);
- s_silent_handler = new silent_error_handler();
- }
- };
-
- static force_init kludge;
-
-} /* namespace gr */
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index 64350c0f21..1900f4094e 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -100,7 +100,6 @@ install(
complex_vec_test.i
constants.i
dispatcher.i
- error_handler.i
feval.i
gnuradio.i
gr_ctrlport.i
diff --git a/gnuradio-runtime/swig/error_handler.i b/gnuradio-runtime/swig/error_handler.i
deleted file mode 100644
index 8174128fa2..0000000000
--- a/gnuradio-runtime/swig/error_handler.i
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,2013 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.
- */
-
-%rename(error_handler) gr::error_handler;
-%rename(file_error_handler) gr::file_error_handler;
-
-class gr::error_handler {
-public:
- enum seriousness {
- ERR_DEBUG = 0x00000000,
- ERR_MESSAGE = 0x00010000,
- ERR_WARNING = 0x00020000,
- ERR_ERROR = 0x00030000,
- ERR_FATAL = 0x00040000
- };
-
- error_handler() {}
- virtual ~error_handler();
-
- static gr::error_handler *default_handler();
- static gr::error_handler *silent_handler();
-
- static bool has_default_handler();
- static void set_default_handler(gr::error_handler *errh);
-
- virtual int nwarnings() const = 0;
- virtual int nerrors() const = 0;
- virtual void reset_counts() = 0;
-
- void verror_text(seriousness s, const std::string &text);
-};
-
-%ignore gr::base_error_handler;
-class gr::base_error_handler : public gr::error_handler {
- int d_nwarnings;
- int d_nerrors;
-
-public:
- base_error_handler() : d_nwarnings(0), d_nerrors(0) {}
- int nwarnings() const { return d_nwarnings; }
- int nerrors() const { return d_nerrors; }
- void reset_counts() { d_nwarnings = d_nerrors = 0; }
- void count_error(seriousness s);
-};
-
-class gr::file_error_handler : public gr::base_error_handler {
-public:
- file_error_handler(int file_descriptor);
- ~file_error_handler();
-};
diff --git a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
index ad9168ce9e..1fc3755707 100644
--- a/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
+++ b/gnuradio-runtime/swig/gnuradio_swig_bug_workaround.h
@@ -32,7 +32,6 @@
class base_error_handler;
class basic_block;
class block;
-class error_handler;
class file_error_handler;
class hier_block2;
class msg_handler;
diff --git a/gnuradio-runtime/swig/runtime_swig.i b/gnuradio-runtime/swig/runtime_swig.i
index 368fb4249a..1e32c086a2 100644
--- a/gnuradio-runtime/swig/runtime_swig.i
+++ b/gnuradio-runtime/swig/runtime_swig.i
@@ -45,7 +45,6 @@
#include <gnuradio/constants.h>
#include <gnuradio/dispatcher.h>
#include <gnuradio/endianness.h>
-#include <gnuradio/error_handler.h>
#include <gnuradio/feval.h>
#include <gnuradio/hier_block2.h>
#include <gnuradio/io_signature.h>
@@ -78,7 +77,6 @@
%include "constants.i"
%include "dispatcher.i"
%include "feval.i"
-%include "error_handler.i"
%include "hier_block2.i"
%include "io_signature.i"
%include "message.i"