summaryrefslogtreecommitdiff
path: root/gruel/src/lib/pmt/pmt_io.cc
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-03-29 17:31:06 -0400
committerJohnathan Corgan <johnathan@corganlabs.com>2013-04-01 16:23:06 -0700
commitf74d3dae8f2ec423c61932b4ad0359f98b996a51 (patch)
tree1e16eb3537829248c177b04209acce3fe2bead96 /gruel/src/lib/pmt/pmt_io.cc
parenteea0e411411303ea94953c5cd8454c4139a474ff (diff)
gruel: moved gruel into subdirs of gnuradio-runtime.
PMTs are handled slightly different and are installed into their own module and include dir.
Diffstat (limited to 'gruel/src/lib/pmt/pmt_io.cc')
-rw-r--r--gruel/src/lib/pmt/pmt_io.cc168
1 files changed, 0 insertions, 168 deletions
diff --git a/gruel/src/lib/pmt/pmt_io.cc b/gruel/src/lib/pmt/pmt_io.cc
deleted file mode 100644
index 2e853b9147..0000000000
--- a/gruel/src/lib/pmt/pmt_io.cc
+++ /dev/null
@@ -1,168 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2009 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 this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <vector>
-#include <gruel/pmt.h>
-#include "pmt_int.h"
-#include <sstream>
-#include <iostream>
-
-namespace pmt {
-
-static void
-write_list_tail(pmt_t obj, std::ostream &port)
-{
- write(car(obj), port); // write the car
- obj = cdr(obj); // step to cdr
-
- if (is_null(obj)) // ()
- port << ")";
-
- else if (is_pair(obj)){ // normal list
- port << " ";
- write_list_tail(obj, port);
- }
- else { // dotted pair
- port << " . ";
- write(obj, port);
- port << ")";
- }
-}
-
-void
-write(pmt_t obj, std::ostream &port)
-{
- if (is_bool(obj)){
- if (is_true(obj))
- port << "#t";
- else
- port << "#f";
- }
- else if (is_symbol(obj)){
- port << symbol_to_string(obj);
- }
- else if (is_number(obj)){
- if (is_integer(obj))
- port << to_long(obj);
- else if (is_uint64(obj))
- port << to_uint64(obj);
- else if (is_real(obj))
- port << to_double(obj);
- else if (is_complex(obj)){
- std::complex<double> c = to_complex(obj);
- port << c.real() << '+' << c.imag() << 'i';
- }
- else
- goto error;
- }
- else if (is_null(obj)){
- port << "()";
- }
- else if (is_pair(obj)){
- port << "(";
- write_list_tail(obj, port);
- }
- else if (is_tuple(obj)){
- port << "{";
- size_t len = length(obj);
- if (len > 0){
- port << tuple_ref(obj, 0);
- for (size_t i = 1; i < len; i++)
- port << " " << tuple_ref(obj, i);
- }
- port << "}";
- }
- else if (is_vector(obj)){
- port << "#(";
- size_t len = length(obj);
- if (len > 0){
- port << vector_ref(obj, 0);
- for (size_t i = 1; i < len; i++)
- port << " " << vector_ref(obj, i);
- }
- port << ")";
- }
- else if (is_dict(obj)){
- // FIXME
- // port << "#<dict " << obj << ">";
- port << "#<dict>";
- }
- else if (is_uniform_vector(obj)){
- // FIXME
- // port << "#<uniform-vector " << obj << ">";
- port << "#<uniform-vector>";
- }
- else {
- error:
- // FIXME
- // port << "#<" << obj << ">";
- port << "#<unknown>";
- }
-}
-
-std::ostream& operator<<(std::ostream &os, pmt_t obj)
-{
- write(obj, os);
- return os;
-}
-
-std::string
-write_string(pmt_t obj)
-{
- std::ostringstream s;
- s << obj;
- return s.str();
-}
-
-pmt_t
-read(std::istream &port)
-{
- throw notimplemented("notimplemented: pmt::read", PMT_NIL);
-}
-
-void
-serialize(pmt_t obj, std::ostream &sink)
-{
- throw notimplemented("notimplemented: pmt::serialize", obj);
-}
-
-/*!
- * \brief Create obj from portable byte-serial representation
- */
-pmt_t
-deserialize(std::istream &source)
-{
- throw notimplemented("notimplemented: pmt::deserialize", PMT_NIL);
-}
-
-} /* namespace pmt */
-
-
-void
-pmt::print(pmt_t v)
-{
- std::cout << write_string(v) << std::endl;
-}
-
-