summaryrefslogtreecommitdiff
path: root/gruel/src/lib/pmt
diff options
context:
space:
mode:
Diffstat (limited to 'gruel/src/lib/pmt')
-rw-r--r--gruel/src/lib/pmt/.gitignore10
-rw-r--r--gruel/src/lib/pmt/CMakeLists.txt11
-rw-r--r--gruel/src/lib/pmt/Makefile.am105
-rw-r--r--gruel/src/lib/pmt/gen-serial-tags.py53
-rw-r--r--gruel/src/lib/pmt/pmt-serial-tags.scm75
5 files changed, 132 insertions, 122 deletions
diff --git a/gruel/src/lib/pmt/.gitignore b/gruel/src/lib/pmt/.gitignore
deleted file mode 100644
index 035c0316b..000000000
--- a/gruel/src/lib/pmt/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile
-/Makefile.in
-/.libs
-/.deps
-/test_pmt
-/qa_pmt_unv.cc
-/qa_pmt_unv.h
-/pmt_unv_int.h
-/pmt_unv.cc
-/stamp-sources-generate
diff --git a/gruel/src/lib/pmt/CMakeLists.txt b/gruel/src/lib/pmt/CMakeLists.txt
index a708fa7ad..a8e15cac6 100644
--- a/gruel/src/lib/pmt/CMakeLists.txt
+++ b/gruel/src/lib/pmt/CMakeLists.txt
@@ -26,9 +26,6 @@ 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
@@ -36,11 +33,11 @@ get_filename_component(PMT_SERIAL_TAGS_H
add_custom_command(
OUTPUT ${PMT_SERIAL_TAGS_H}
- DEPENDS ${SCHEME_DIR}/gen-serial-tags.py
- DEPENDS ${SCHEME_DIR}/pmt-serial-tags.scm
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
COMMAND ${PYTHON_EXECUTABLE}
- ${SCHEME_DIR}/gen-serial-tags.py
- ${SCHEME_DIR}/pmt-serial-tags.scm
+ ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
${PMT_SERIAL_TAGS_H}
)
diff --git a/gruel/src/lib/pmt/Makefile.am b/gruel/src/lib/pmt/Makefile.am
deleted file mode 100644
index 0c8e12dc3..000000000
--- a/gruel/src/lib/pmt/Makefile.am
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# Copyright 2008,2009,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 $(top_srcdir)/Makefile.common
-
-AM_CPPFLAGS = $(DEFINES) $(GRUEL_INCLUDES) $(BOOST_CPPFLAGS) \
- $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
-
-noinst_LTLIBRARIES = libpmt.la
-
-# ----------------------------------------------------------------
-# these scripts generate code
-
-code_generator = \
- generate_unv.py \
- unv_template.h.t \
- unv_template.cc.t \
- unv_qa_template.cc.t
-
-GENERATED_H = \
- pmt_unv_int.h \
- qa_pmt_unv.h
-
-GENERATED_CC = \
- pmt_unv.cc \
- qa_pmt_unv.cc
-
-python_built_sources = $(GENERATED_H) $(GENERATED_CC)
-
-PMT_SERIAL_TAGS_H = $(abs_top_builddir)/gruel/src/include/gruel/pmt_serial_tags.h
-BUILT_SOURCES = $(python_built_sources) $(PMT_SERIAL_TAGS_H)
-
-EXTRA_DIST += $(code_generator)
-
-# ----------------------------------------------------------------
-
-libpmt_la_SOURCES = \
- pmt.cc \
- pmt_io.cc \
- pmt_pool.cc \
- pmt_serialize.cc \
- pmt_unv.cc
-
-libpmt_la_LIBADD = \
- $(BOOST_THREAD_LIB) \
- -lstdc++
-
-libpmt_la_LDFLAGS = \
- $(BOOST_LDFLAGS)
-
-noinst_HEADERS = \
- $(GENERATED_H) \
- pmt_int.h \
- qa_pmt.h \
- qa_pmt_prims.h
-
-# Build the qa code into its own library
-
-noinst_LTLIBRARIES += libpmt-qa.la
-
-libpmt_qa_la_SOURCES = \
- qa_pmt.cc \
- qa_pmt_prims.cc \
- qa_pmt_unv.cc
-
-# magic flags
-libpmt_qa_la_LDFLAGS = $(NO_UNDEFINED) -avoid version
-
-libpmt_qa_la_LIBADD = \
- libpmt.la \
- $(CPPUNIT_LIBS) \
- -lstdc++
-
-
-# Do creation and inclusion of other Makefiles last
-
-# common way for generating sources from templates when using
-# BUILT_SOURCES, using parallel build protection.
-gen_sources = $(python_built_sources)
-gen_sources_deps = $(core_generator)
-par_gen_command = PYTHONPATH=$(top_srcdir)/gruel/src/lib/pmt srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_unv.py
-include $(top_srcdir)/Makefile.par.gen
-
-# Rule to create the build header file using python
-# Doesn't need parallel protections because there is a single target
-$(PMT_SERIAL_TAGS_H): $(top_srcdir)/gruel/src/scheme/gnuradio/gen-serial-tags.py $(top_srcdir)/gruel/src/scheme/gnuradio/pmt-serial-tags.scm
- $(PYTHON) $^ $@
diff --git a/gruel/src/lib/pmt/gen-serial-tags.py b/gruel/src/lib/pmt/gen-serial-tags.py
new file mode 100644
index 000000000..18e927beb
--- /dev/null
+++ b/gruel/src/lib/pmt/gen-serial-tags.py
@@ -0,0 +1,53 @@
+"""
+//
+// 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 this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+//
+// THIS FILE IS MACHINE GENERATED FROM %s. DO NOT EDIT BY HAND.
+// See %s for additional commentary.
+//
+
+#ifndef INCLUDED_PMT_SERIAL_TAGS_H
+#define INCLUDED_PMT_SERIAL_TAGS_H
+
+enum pst_tags {
+%s
+};
+#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
+"""
+
+import sys, os, re
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ print "Usage %s <input_scm_file> <output_hdr_file>"%__file__
+ exit()
+ input_scm_file, output_hdr_file = sys.argv[1:]
+ enums = list()
+ for line in open(input_scm_file).readlines():
+ match = re.match('^\s*\(define\s+([\w|-]+)\s+#x([0-9a-fA-F]+)\)', line)
+ if not match: continue
+ name, value = match.groups()
+ name = name.upper().replace('-', '_')
+ enums.append(' %s = 0x%s'%(name, value))
+ open(output_hdr_file, 'w').write(__doc__%(
+ os.path.basename(__file__),
+ os.path.basename(input_scm_file),
+ ',\n'.join(enums),
+ ))
diff --git a/gruel/src/lib/pmt/pmt-serial-tags.scm b/gruel/src/lib/pmt/pmt-serial-tags.scm
new file mode 100644
index 000000000..646a751ea
--- /dev/null
+++ b/gruel/src/lib/pmt/pmt-serial-tags.scm
@@ -0,0 +1,75 @@
+;;; -*-scheme-*-
+;;;
+;;; Copyright 2007 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 (define 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.
+;;;
+
+;;; definitions of tag values used for marshalling pmt data
+
+(define pst-true #x00)
+(define pst-false #x01)
+(define pst-symbol #x02) ; untagged-int16 n; followed by n bytes of symbol name
+(define pst-int32 #x03)
+(define pst-double #x04)
+(define pst-complex #x05) ; complex<double>: real, imag
+(define pst-null #x06)
+(define pst-pair #x07) ; followed by two objects
+(define pst-vector #x08) ; untagged-int32 n; followed by n objects
+(define pst-dict #x09) ; untagged-int32 n; followed by n key/value tuples
+
+(define pst-uniform-vector #x0a)
+
+;; u8, s8, u16, s16, u32, s32, u64, s64, f32, f64, c32, c64
+;;
+;; untagged-uint8 tag
+;; untagged-uint8 uvi (define uniform vector info, see below)
+;; untagged-int32 n-items
+;; untagged-uint8 npad
+;; npad bytes of zeros to align binary data
+;; n-items binary numeric items
+;;
+;; uvi:
+;; +-+-+-+-+-+-+-+-+
+;; |B| subtype |
+;; +-+-+-+-+-+-+-+-+
+;;
+;; B == 0, numeric data is little-endian.
+;; B == 1, numeric data is big-endian.
+
+ (define uvi-endian-mask #x80)
+ (define uvi-subtype-mask #x7f)
+
+ (define uvi-little-endian #x00)
+ (define uvi-big-endian #x80)
+
+ (define uvi-u8 #x00)
+ (define uvi-s8 #x01)
+ (define uvi-u16 #x02)
+ (define uvi-s16 #x03)
+ (define uvi-u32 #x04)
+ (define uvi-s32 #x05)
+ (define uvi-u64 #x06)
+ (define uvi-s64 #x07)
+ (define uvi-f32 #x08)
+ (define uvi-f64 #x09)
+ (define uvi-c32 #x0a)
+ (define uvi-c64 #x0b)
+
+
+(define pst-comment #x3b) ; ascii ';'
+(define pst-comment-end #x0a) ; ascii '\n'