aboutsummaryrefslogtreecommitdiffstats
path: root/op25/gr-op25_repeater
diff options
context:
space:
mode:
authorroot <root@op25.osmocom.org>2013-12-10 01:47:21 +0100
committerroot <root@op25.osmocom.org>2013-12-10 01:47:21 +0100
commite9aa1ab5fe03026957b2a11a6a48b5b83f275f08 (patch)
tree5f402d240c5f5b9d923eb4ad44aaa0ea0e6e5f03 /op25/gr-op25_repeater
Initial check-in.
Diffstat (limited to 'op25/gr-op25_repeater')
-rw-r--r--op25/gr-op25_repeater/CMakeLists.txt148
-rw-r--r--op25/gr-op25_repeater/apps/CMakeLists.txt25
-rw-r--r--op25/gr-op25_repeater/apps/corr/1111131133113333131333331
-rw-r--r--op25/gr-op25_repeater/apps/corr/11131131111333133333-6k1
-rw-r--r--op25/gr-op25_repeater/apps/corr/1131313333313133311133111
-rw-r--r--op25/gr-op25_repeater/apps/corr/1311113331133133131133131
-rw-r--r--op25/gr-op25_repeater/apps/corr/131313331113113111331133113311331
-rw-r--r--op25/gr-op25_repeater/apps/corr/1313311113333333111111311
-rw-r--r--op25/gr-op25_repeater/apps/corr/1333133111313111133133311
-rw-r--r--op25/gr-op25_repeater/apps/corr/3111311333131333311311131
-rw-r--r--op25/gr-op25_repeater/apps/corr/311313113313311111331313113111331
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131133331111111333333131
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131313131331311133131111
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131331131311113131
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131331131311113331
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131331131311131131
-rw-r--r--op25/gr-op25_repeater/apps/corr/3131331131311131331
-rw-r--r--op25/gr-op25_repeater/apps/corr/3133331113311311313311311
-rw-r--r--op25/gr-op25_repeater/apps/corr/3313131111131311133311331
-rwxr-xr-xop25/gr-op25_repeater/apps/scope.py2765
-rw-r--r--op25/gr-op25_repeater/apps/tdma/bit_utils.py84
-rw-r--r--op25/gr-op25_repeater/apps/tdma/duid.py53
-rw-r--r--op25/gr-op25_repeater/apps/tdma/isch.py56
-rw-r--r--op25/gr-op25_repeater/apps/tdma/lfsr.py87
-rw-r--r--op25/gr-op25_repeater/apps/tdma/rs.py154
-rwxr-xr-xop25/gr-op25_repeater/apps/tdma/tdma-decode.py114
-rw-r--r--op25/gr-op25_repeater/apps/tdma/vf.py153
-rw-r--r--op25/gr-op25_repeater/apps/trunking.py569
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/CMakeParseArgumentsCopy.cmake138
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/FindCppUnit.cmake36
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/FindGnuradioRuntime.cmake36
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/GrMiscUtils.cmake210
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/GrPlatform.cmake46
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/GrPython.cmake227
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/GrSwig.cmake229
-rw-r--r--op25/gr-op25_repeater/cmake/Modules/GrTest.cmake133
-rw-r--r--op25/gr-op25_repeater/cmake/cmake_uninstall.cmake.in32
-rw-r--r--op25/gr-op25_repeater/docs/CMakeLists.txt35
-rw-r--r--op25/gr-op25_repeater/docs/README.op25_repeater11
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/CMakeLists.txt52
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/Doxyfile.in1504
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/Doxyfile.swig_doc.in1514
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/__init__.py82
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/base.py219
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/doxyindex.py237
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/__init__.py7
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compound.py503
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compoundsuper.py8342
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/index.py77
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/indexsuper.py523
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/doxyxml/text.py56
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/other/group_defs.dox7
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/other/main_page.dox10
-rw-r--r--op25/gr-op25_repeater/docs/doxygen/swig_doc.py255
-rw-r--r--op25/gr-op25_repeater/grc/CMakeLists.txt24
-rw-r--r--op25/gr-op25_repeater/grc/op25_repeater_fsk4_slicer_fb.xml38
-rw-r--r--op25/gr-op25_repeater/grc/op25_repeater_gardner_costas_cc.xml68
-rw-r--r--op25/gr-op25_repeater/grc/op25_repeater_p25_frame_assembler.xml38
-rw-r--r--op25/gr-op25_repeater/grc/op25_repeater_vocoder.xml38
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt29
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/api.h33
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/fsk4_slicer_fb.h56
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/gardner_costas_cc.h56
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/p25_frame_assembler.h57
-rw-r--r--op25/gr-op25_repeater/include/op25_repeater/vocoder.h56
-rw-r--r--op25/gr-op25_repeater/lib/CMakeLists.txt80
-rw-r--r--op25/gr-op25_repeater/lib/bch.cc162
-rw-r--r--op25/gr-op25_repeater/lib/bch.h4
-rw-r--r--op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.cc108
-rw-r--r--op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.h48
-rw-r--r--op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc250
-rw-r--r--op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h106
-rw-r--r--op25/gr-op25_repeater/lib/imbe_decoder.cc16
-rw-r--r--op25/gr-op25_repeater/lib/imbe_decoder.h90
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/CMakeLists.txt31
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.cc182
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.h133
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/basic_op.h85
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/basicop2.cc2157
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.cc185
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.h32
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.cc110
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.h32
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.cc66
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.h46
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/decode.cc69
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/decode.h30
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.cc278
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.h81
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/encode.cc99
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/encode.h32
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/globals.h62
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/imbe.h69
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.cc54
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.h89
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.cc355
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.h130
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.cc74
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.h47
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.cc350
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.h29
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.cc167
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.h28
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.cc144
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.h86
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.cc61
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.h44
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.cc200
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.h64
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.cc296
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.h30
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.cc202
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.h50
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/tbls.cc368
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/tbls.h99
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/typedef.h74
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/typedefs.h201
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.cc147
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.h29
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.cc248
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.h30
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.cc373
-rw-r--r--op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.h28
l---------op25/gr-op25_repeater/lib/op25_golay.h1
l---------op25/gr-op25_repeater/lib/op25_hamming.h1
l---------op25/gr-op25_repeater/lib/op25_imbe_frame.h1
l---------op25/gr-op25_repeater/lib/op25_p25_frame.h1
l---------op25/gr-op25_repeater/lib/op25_yank.h1
-rw-r--r--op25/gr-op25_repeater/lib/p25_frame.h63
-rw-r--r--op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc451
-rw-r--r--op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h86
-rw-r--r--op25/gr-op25_repeater/lib/p25_framer.cc161
-rw-r--r--op25/gr-op25_repeater/lib/p25_framer.h46
-rw-r--r--op25/gr-op25_repeater/lib/qa_op25_repeater.cc36
-rw-r--r--op25/gr-op25_repeater/lib/qa_op25_repeater.h38
-rw-r--r--op25/gr-op25_repeater/lib/rs.cc567
-rw-r--r--op25/gr-op25_repeater/lib/rs.h15
-rw-r--r--op25/gr-op25_repeater/lib/software_imbe_decoder.cc1436
-rw-r--r--op25/gr-op25_repeater/lib/software_imbe_decoder.h103
-rw-r--r--op25/gr-op25_repeater/lib/test_op25_repeater.cc47
-rw-r--r--op25/gr-op25_repeater/lib/vocoder_impl.cc523
-rw-r--r--op25/gr-op25_repeater/lib/vocoder_impl.h114
-rw-r--r--op25/gr-op25_repeater/python/CMakeLists.txt47
-rw-r--r--op25/gr-op25_repeater/python/__init__.py54
-rw-r--r--op25/gr-op25_repeater/python/build_utils.py226
-rw-r--r--op25/gr-op25_repeater/python/build_utils_codes.py52
-rwxr-xr-xop25/gr-op25_repeater/python/qa_fsk4_slicer_fb.py40
-rwxr-xr-xop25/gr-op25_repeater/python/qa_gardner_costas_cc.py40
-rwxr-xr-xop25/gr-op25_repeater/python/qa_p25_frame_assembler.py40
-rwxr-xr-xop25/gr-op25_repeater/python/qa_vocoder.py40
-rw-r--r--op25/gr-op25_repeater/swig/CMakeLists.txt57
-rw-r--r--op25/gr-op25_repeater/swig/op25_repeater_swig.i26
152 files changed, 32292 insertions, 0 deletions
diff --git a/op25/gr-op25_repeater/CMakeLists.txt b/op25/gr-op25_repeater/CMakeLists.txt
new file mode 100644
index 0000000..0572775
--- /dev/null
+++ b/op25/gr-op25_repeater/CMakeLists.txt
@@ -0,0 +1,148 @@
+# Copyright 2011,2012 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.
+
+
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 2.6)
+project(gr-op25_repeater CXX C)
+enable_testing()
+
+#select the release build type by default to get optimization flags
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+ message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
+
+########################################################################
+# Compiler specific setup
+########################################################################
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+ #http://gcc.gnu.org/wiki/Visibility
+ add_definitions(-fvisibility=hidden)
+endif()
+
+########################################################################
+# Find boost
+########################################################################
+if(UNIX AND EXISTS "/usr/lib64")
+ list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
+endif(UNIX AND EXISTS "/usr/lib64")
+set(Boost_ADDITIONAL_VERSIONS
+ "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
+ "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
+ "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
+ "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
+ "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
+ "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
+ "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
+)
+find_package(Boost "1.35" COMPONENTS filesystem system)
+
+if(NOT Boost_FOUND)
+ message(FATAL_ERROR "Boost required to compile op25_repeater")
+endif()
+
+########################################################################
+# Install directories
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+set(GR_RUNTIME_DIR bin)
+set(GR_LIBRARY_DIR lib${LIB_SUFFIX})
+set(GR_INCLUDE_DIR include/op25_repeater)
+set(GR_DATA_DIR share)
+set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_DOC_DIR ${GR_DATA_DIR}/doc)
+set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
+set(GR_CONF_DIR etc)
+set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
+set(GR_LIBEXEC_DIR libexec)
+set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
+set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
+
+########################################################################
+# Find gnuradio build dependencies
+########################################################################
+find_package(GnuradioRuntime)
+find_package(CppUnit)
+
+# To run a more advanced search for GNU Radio and it's components and
+# versions, use the following. Add any components required to the list
+# of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the
+# minimum API compatible version required.
+#
+# set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...)
+# find_package(Gnuradio "version")
+
+if(NOT GNURADIO_RUNTIME_FOUND)
+ message(FATAL_ERROR "GnuRadio Runtime required to compile op25_repeater")
+endif()
+if(NOT CPPUNIT_FOUND)
+ message(FATAL_ERROR "CppUnit required to compile op25_repeater")
+endif()
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${CMAKE_SOURCE_DIR}/lib
+ ${CMAKE_SOURCE_DIR}/include
+ ${CMAKE_BINARY_DIR}/lib
+ ${CMAKE_BINARY_DIR}/include
+ ${Boost_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS}
+ ${GNURADIO_RUNTIME_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${Boost_LIBRARY_DIRS}
+ ${CPPUNIT_LIBRARY_DIRS}
+ ${GNURADIO_RUNTIME_LIBRARY_DIRS}
+)
+
+# Set component parameters
+set(GR_OP25_REPEATER_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
+set(GR_OP25_REPEATER_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Create uninstall target
+########################################################################
+configure_file(
+ ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+@ONLY)
+
+add_custom_target(uninstall
+ ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include/op25_repeater)
+add_subdirectory(lib)
+add_subdirectory(swig)
+add_subdirectory(python)
+add_subdirectory(grc)
+add_subdirectory(apps)
+add_subdirectory(docs)
diff --git a/op25/gr-op25_repeater/apps/CMakeLists.txt b/op25/gr-op25_repeater/apps/CMakeLists.txt
new file mode 100644
index 0000000..c837d77
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/CMakeLists.txt
@@ -0,0 +1,25 @@
+# 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)
+
+GR_PYTHON_INSTALL(
+ PROGRAMS
+ DESTINATION bin
+)
diff --git a/op25/gr-op25_repeater/apps/corr/111113113311333313133333 b/op25/gr-op25_repeater/apps/corr/111113113311333313133333
new file mode 100644
index 0000000..b68b98d
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/111113113311333313133333
@@ -0,0 +1 @@
+P25P1
diff --git a/op25/gr-op25_repeater/apps/corr/11131131111333133333-6k b/op25/gr-op25_repeater/apps/corr/11131131111333133333-6k
new file mode 100644
index 0000000..ff5c8c4
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/11131131111333133333-6k
@@ -0,0 +1 @@
+P25 TDMA S-ISCH (6K)
diff --git a/op25/gr-op25_repeater/apps/corr/113131333331313331113311 b/op25/gr-op25_repeater/apps/corr/113131333331313331113311
new file mode 100644
index 0000000..01ce189
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/113131333331313331113311
@@ -0,0 +1 @@
+X2TDMA BS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/131111333113313313113313 b/op25/gr-op25_repeater/apps/corr/131111333113313313113313
new file mode 100644
index 0000000..72bea73
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/131111333113313313113313
@@ -0,0 +1 @@
+DMR BS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/13131333111311311133113311331133 b/op25/gr-op25_repeater/apps/corr/13131333111311311133113311331133
new file mode 100644
index 0000000..bcd7ce0
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/13131333111311311133113311331133
@@ -0,0 +1 @@
+Provoice
diff --git a/op25/gr-op25_repeater/apps/corr/131331111333333311111131 b/op25/gr-op25_repeater/apps/corr/131331111333333311111131
new file mode 100644
index 0000000..a2afa4b
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/131331111333333311111131
@@ -0,0 +1 @@
+X2TDMA MS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/133313311131311113313331 b/op25/gr-op25_repeater/apps/corr/133313311131311113313331
new file mode 100644
index 0000000..59645ab
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/133313311131311113313331
@@ -0,0 +1 @@
+DMR MS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/311131133313133331131113 b/op25/gr-op25_repeater/apps/corr/311131133313133331131113
new file mode 100644
index 0000000..5360c90
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/311131133313133331131113
@@ -0,0 +1 @@
+DMR MS Data
diff --git a/op25/gr-op25_repeater/apps/corr/31131311331331111133131311311133 b/op25/gr-op25_repeater/apps/corr/31131311331331111133131311311133
new file mode 100644
index 0000000..dcea8e7
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/31131311331331111133131311311133
@@ -0,0 +1 @@
+Provoice EA
diff --git a/op25/gr-op25_repeater/apps/corr/313113333111111133333313 b/op25/gr-op25_repeater/apps/corr/313113333111111133333313
new file mode 100644
index 0000000..8139d7b
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313113333111111133333313
@@ -0,0 +1 @@
+X2TDMA MS Data
diff --git a/op25/gr-op25_repeater/apps/corr/313131313133131113313111 b/op25/gr-op25_repeater/apps/corr/313131313133131113313111
new file mode 100644
index 0000000..46feb2a
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313131313133131113313111
@@ -0,0 +1 @@
+DSTAR
diff --git a/op25/gr-op25_repeater/apps/corr/313133113131111313 b/op25/gr-op25_repeater/apps/corr/313133113131111313
new file mode 100644
index 0000000..a882a13
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313133113131111313
@@ -0,0 +1 @@
+NXDN BS Data
diff --git a/op25/gr-op25_repeater/apps/corr/313133113131111333 b/op25/gr-op25_repeater/apps/corr/313133113131111333
new file mode 100644
index 0000000..647abe3
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313133113131111333
@@ -0,0 +1 @@
+NXDN MS Data
diff --git a/op25/gr-op25_repeater/apps/corr/313133113131113113 b/op25/gr-op25_repeater/apps/corr/313133113131113113
new file mode 100644
index 0000000..ff6ce82
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313133113131113113
@@ -0,0 +1 @@
+NXDN BS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/313133113131113133 b/op25/gr-op25_repeater/apps/corr/313133113131113133
new file mode 100644
index 0000000..3ac05e0
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313133113131113133
@@ -0,0 +1 @@
+NXDN MS Voice
diff --git a/op25/gr-op25_repeater/apps/corr/313333111331131131331131 b/op25/gr-op25_repeater/apps/corr/313333111331131131331131
new file mode 100644
index 0000000..8abe043
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/313333111331131131331131
@@ -0,0 +1 @@
+DMR BS Data
diff --git a/op25/gr-op25_repeater/apps/corr/331313111113131113331133 b/op25/gr-op25_repeater/apps/corr/331313111113131113331133
new file mode 100644
index 0000000..c8f32c0
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/corr/331313111113131113331133
@@ -0,0 +1 @@
+X2TDMA BS Data
diff --git a/op25/gr-op25_repeater/apps/scope.py b/op25/gr-op25_repeater/apps/scope.py
new file mode 100755
index 0000000..641afbf
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/scope.py
@@ -0,0 +1,2765 @@
+#!/usr/bin/env python
+
+# Copyright 2008-2011 Steve Glass
+#
+# Copyright 2011, 2012, 2013 KA1RBI
+#
+# Copyright 2003,2004,2005,2006 Free Software Foundation, Inc.
+# (from radiorausch)
+#
+# This file is part of OP25 and part of GNU Radio
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import os
+import pickle
+import sys
+import threading
+import wx
+import wx.html
+import wx.wizard
+import math
+import numpy
+import time
+import re
+try:
+ import Hamlib
+except:
+ pass
+
+try:
+ import Numeric
+except:
+ pass
+
+from gnuradio import audio, eng_notation, gr, gru, filter, blocks, fft, analog, digital
+from gnuradio.eng_option import eng_option
+from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, form
+from math import pi
+from optparse import OptionParser
+
+import op25
+import op25_repeater
+
+import gnuradio.wxgui.plot as plot
+
+import trunking
+
+#speeds = [300, 600, 900, 1200, 1440, 1800, 1920, 2400, 2880, 3200, 3600, 3840, 4000, 4800, 6000, 6400, 7200, 8000, 9600, 14400, 19200]
+speeds = [4800]
+
+os.environ['IMBE'] = 'soft'
+
+WIRESHARK_PORT = 23456
+
+msg_wxDATA_EVENT = wx.NewEventType()
+
+def msg_EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, msg_wxDATA_EVENT, func)
+
+class msg_DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (msg_wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+# The P25 receiver
+#
+class p25_rx_block (stdgui2.std_top_block):
+
+ # Initialize the P25 receiver
+ #
+ def __init__(self, frame, panel, vbox, argv):
+
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+
+ # command line argument parsing
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("--args", type="string", default="", help="device args")
+ parser.add_option("--antenna", type="string", default="", help="select antenna")
+ parser.add_option("-a", "--audio", action="store_true", default=False, help="use direct audio input")
+ parser.add_option("-A", "--audio-if", action="store_true", default=False, help="soundcard IF mode (use --calibration to set IF freq)")
+ parser.add_option("-I", "--audio-input", type="string", default="", help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
+ parser.add_option("-i", "--input", default=None, help="input file name")
+ parser.add_option("-b", "--excess-bw", type="eng_float", default=0.2, help="for RRC filter", metavar="Hz")
+ parser.add_option("-c", "--calibration", type="eng_float", default=0.0, help="USRP offset or audio IF frequency", metavar="Hz")
+ parser.add_option("-C", "--costas-alpha", type="eng_float", default=0.04, help="value of alpha for Costas loop", metavar="Hz")
+ parser.add_option("-f", "--frequency", type="eng_float", default=0.0, help="USRP center frequency", metavar="Hz")
+ parser.add_option("-F", "--ifile", type="string", default=None, help="read input from complex capture file")
+ parser.add_option("-H", "--hamlib-model", type="int", default=None, help="specify model for hamlib")
+ parser.add_option("-s", "--seek", type="int", default=0, help="ifile seek in K")
+ parser.add_option("-S", "--sample-rate", type="int", default=320e3, help="source samp rate")
+ parser.add_option("-t", "--tone-detect", action="store_true", default=False, help="use experimental tone detect algorithm")
+ parser.add_option("-T", "--trunk-conf-file", type="string", default=None, help="trunking config file name")
+ parser.add_option("-v", "--verbosity", type="int", default=10, help="message debug level")
+ parser.add_option("-V", "--vocoder", action="store_true", default=False, help="voice codec")
+ parser.add_option("-o", "--offset", type="eng_float", default=0.0, help="tuning offset frequency [to circumvent DC offset]", metavar="Hz")
+ parser.add_option("-p", "--pause", action="store_true", default=False, help="block on startup")
+ parser.add_option("-w", "--wireshark", action="store_true", default=False, help="output data to Wireshark")
+ parser.add_option("-W", "--wireshark-host", type="string", default="127.0.0.1", help="Wireshark host")
+ parser.add_option("-r", "--raw-symbols", type="string", default=None, help="dump decoded symbols to file")
+ parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0), help="select USRP Rx side A or B (default=A)")
+ parser.add_option("-g", "--gain", type="eng_float", default=None, help="set USRP gain in dB (default is midpoint) or set audio gain")
+ parser.add_option("-G", "--gain-mu", type="eng_float", default=0.025, help="gardner gain")
+ parser.add_option("-N", "--gains", type="string", default=None, help="gain settings")
+ parser.add_option("-O", "--audio-output", type="string", default="plughw:0,0", help="audio output device name")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ self.channel_rate = 0
+ self.baseband_input = False
+
+ # check if osmocom is accessible
+ try:
+ self.src = None
+ import osmosdr
+ self.src = osmosdr.source(options.args)
+ self.channel_rate = options.sample_rate
+ except Exception:
+ print "osmosdr source_c creation failure"
+ ignore = True
+
+ gain_names = self.src.get_gain_names()
+ for name in gain_names:
+ range = self.src.get_gain_range(name)
+ print "gain: name: %s range: start %d stop %d step %d" % (name, range[0].start(), range[0].stop(), range[0].step())
+ if options.gains:
+ for tuple in options.gains.split(","):
+ name, gain = tuple.split(":")
+ gain = int(gain)
+ print "setting gain %s to %d" % (name, gain)
+ self.src.set_gain(gain, name)
+
+ rates = self.src.get_sample_rates()
+ print 'supported sample rates %d-%d step %d' % (rates.start(), rates.stop(), rates.step())
+
+ if options.audio:
+ self.channel_rate = 48000
+ self.baseband_input = True
+
+ if options.audio_if:
+ self.channel_rate = 96000
+
+ if options.ifile:
+ self.channel_rate = 96000 # TODO: fixme
+
+ # setup (read-only) attributes
+ self.symbol_rate = 4800
+ self.symbol_deviation = 600.0
+ self.basic_rate = 48000
+ _default_speed = 4800
+
+ # keep track of flow graph connections
+ self.cnxns = []
+
+ self.datascope_raw_input = False
+ self.data_scope_connected = False
+
+ self.constellation_scope_connected = False
+
+ self.options = options
+
+ for i in xrange(len(speeds)):
+ if speeds[i] == _default_speed:
+ self.current_speed = i
+ self.default_speed_idx = i
+
+ if options.hamlib_model:
+ self.hamlib_attach(options.hamlib_model)
+
+ # initialize the UI
+ #
+ self.__init_gui(frame, panel, vbox)
+
+ # wait for gdb
+ if options.pause:
+ print 'Ready for GDB to attach (pid = %d)' % (os.getpid(),)
+ raw_input("Press 'Enter' to continue...")
+
+ # configure specified data source
+ if options.input:
+ self.open_file(options.input)
+ elif options.frequency:
+ self._set_state("CAPTURING")
+ self.open_usrp()
+ elif options.audio_if:
+ self._set_state("CAPTURING")
+ self.open_audio_c(self.channel_rate, options.gain, options.audio_input)
+ elif options.audio:
+ self._set_state("CAPTURING")
+ self.open_audio(self.channel_rate, options.gain, options.audio_input)
+ # skip past unused FFT spectrum plot
+ self.notebook.AdvanceSelection()
+ elif options.ifile:
+ self._set_state("CAPTURING")
+ self.open_ifile(self.channel_rate, options.gain, options.ifile, options.seek)
+ else:
+ self._set_state("STOPPED")
+
+ # setup common flow graph elements
+ #
+ def __build_graph(self, source, capture_rate):
+ global speeds
+ global WIRESHARK_PORT
+ # tell the scope the source rate
+ self.spectrum.set_sample_rate(capture_rate)
+ # channel filter
+ self.channel_offset = 0.0
+ channel_decim = int(capture_rate // self.channel_rate)
+ channel_rate = capture_rate // channel_decim
+ trans_width = 12.5e3 / 2;
+ trans_centre = trans_width + (trans_width / 2)
+ sps = int(self.basic_rate // self.symbol_rate)
+
+ symbol_decim = 1
+ ntaps = 11 * sps
+# rrc_coeffs = gr.firdes.root_raised_cosine(1.0, self.basic_rate, self.basic_rate * 0.1, 0.2, ntaps)
+ rrc_coeffs = (1.0/sps,)*sps
+ self.symbol_filter = filter.fir_filter_fff(symbol_decim, rrc_coeffs)
+
+ autotuneq = gr.msg_queue(2)
+ self.fsk4_demod = op25.fsk4_demod_ff(autotuneq, self.basic_rate, self.symbol_rate)
+
+ self.null_sym = blocks.null_sink(gr.sizeof_float)
+
+ levels = [ -2.0, 0.0, 2.0, 4.0 ]
+ self.slicer = op25_repeater.fsk4_slicer_fb(levels)
+
+ self.buffer = blocks.copy(gr.sizeof_float)
+
+ self.rx_q = gr.msg_queue(100)
+ msg_EVT_DATA_EVENT(self.frame, self.msg_data)
+ self.trunk_rx = trunking.rx_ctl(frequency_set = self.change_freq, debug = self.options.verbosity, conf_file = self.options.trunk_conf_file)
+ self.du_watcher = du_queue_watcher(self.rx_q, self.trunk_rx.process_qmsg)
+ udp_port = 0
+ if self.options.wireshark:
+ udp_port = WIRESHARK_PORT
+ if self.options.raw_symbols:
+ self.sink_sf = blocks.file_sink(gr.sizeof_char, self.options.raw_symbols)
+ do_imbe = 1
+ do_output = 1
+ do_msgq = 1
+ self.sink_s = op25_repeater.p25_frame_assembler(self.options.wireshark_host, udp_port, self.options.verbosity, do_imbe, do_output, do_msgq, self.rx_q)
+ if self.options.vocoder:
+ self.sink_imbe = op25_repeater.vocoder(0, 0, 0, '', 0, 0)
+ self.audio_s2f = blocks.short_to_float()
+ self.audio_scaler = blocks.multiply_const_ff(1 / 32768.0)
+ self.audio_output = audio.sink(8000, self.options.audio_output, True)
+ self.connect(self.sink_imbe, self.audio_s2f, self.audio_scaler, self.audio_output)
+ else:
+ self.sink_imbe = blocks.null_sink(gr.sizeof_char)
+ if self.baseband_input:
+ gain = self.options.gain
+ else:
+ gain = 1.0
+ self.baseband_amp = blocks.multiply_const_ff(gain)
+ self.real_amp = blocks.multiply_const_ff(0.2)
+
+# self.connect_data_scope(True)
+
+ self.fft_state = False
+ self.c4fm_state = False
+ self.fscope_state = False
+ self.corr_state = False
+ self.fac_state = False
+ self.fsk4_demod_connected = False
+ self.psk_demod_connected = False
+ self.fsk4_demod_mode = False
+ self.corr_i_chan = False
+
+ if self.baseband_input:
+ self.rescale = blocks.multiply_const_ff( 1.0 ) # dummy for compat
+ self.float_resamplers = []
+ for i in xrange(len(speeds)):
+ speed = speeds[i] * sps
+ lcm = gru.lcm(speed, capture_rate)
+ interp = int(lcm // capture_rate)
+ decim = int(lcm // speed)
+ resamp = filter.rational_resampler_fff(interp,decim)
+ self.float_resamplers.append(resamp)
+ self.set_connection(c4fm=1)
+ else: # complex input
+ coeffs = filter.firdes.low_pass(1.0, capture_rate, trans_centre, trans_width, filter.firdes.WIN_HANN)
+ self.channel_filter = filter.freq_xlating_fir_filter_ccf(channel_decim, coeffs, 0.0, capture_rate)
+ self.set_channel_offset(0.0, 0, "")
+ # local osc
+ self.lo_freq = self.options.offset
+ if self.options.audio_if or self.options.ifile:
+ self.lo_freq += self.options.calibration
+ self.lo = analog.sig_source_c (channel_rate, analog.GR_SIN_WAVE, self.lo_freq, 1.0, 0)
+ self.mixer = blocks.multiply_cc()
+ lpf_coeffs = filter.firdes.low_pass(1.0, self.channel_rate, 12000, 1200, filter.firdes.WIN_HANN)
+ self.lpf = filter.fir_filter_ccf(1, lpf_coeffs)
+
+ self.to_real = blocks.complex_to_real()
+
+ nphases = 64
+ frac_bw = 0.25
+ rs_taps = filter.firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)
+
+ self.arb_resampler = filter.pfb.arb_resampler_ccf(
+ float(self.basic_rate)/float(capture_rate))
+
+ fm_demod_gain = self.basic_rate / (2.0 * pi * self.symbol_deviation)
+ self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain)
+
+ rrc_taps = filter.firdes.root_raised_cosine(
+ 1.0, # gain (sps since we're interpolating by
+ sps, # sampling rate
+ 1.0, # symbol rate
+ self.options.excess_bw, # excess bandwidth (roll-off factor)
+ ntaps)
+
+ #self.symbol_filter_c = gr.interp_fir_filter_ccf(1, rrc_taps)
+ self.symbol_filter_c = blocks.multiply_const_cc(1.0)
+ self.resamplers = []
+
+ for speed in speeds:
+ resampler = filter.pfb.arb_resampler_ccf(
+ float(speed)/float(self.symbol_rate))
+ self.resamplers.append(resampler)
+
+ if self.options.tone_detect:
+ step_size = 7.5e-8
+ theta = -2
+ cic_length = 48
+ self.clock = repeater.tdetect_cc(sps, step_size, theta, cic_length)
+ else:
+ gain_mu= self.options.gain_mu
+ omega = float(sps)
+ gain_omega = 0.1 * gain_mu * gain_mu
+
+ alpha = self.options.costas_alpha
+ beta = 0.125 * alpha * alpha
+ fmax = 1200 # Hz
+ fmax = 2*pi * fmax / self.basic_rate
+
+ self.clock = op25_repeater.gardner_costas_cc(omega, gain_mu, gain_omega, alpha, beta, fmax, -fmax)
+
+ self.agc = analog.feedforward_agc_cc(16, 1.0)
+
+ # Perform Differential decoding on the constellation
+ self.diffdec = digital.diff_phasor_cc()
+
+ # take angle of the difference (in radians)
+ self.to_float = blocks.complex_to_arg()
+
+ # convert from radians such that signal is in -3/-1/+1/+3
+ self.rescale = blocks.multiply_const_ff( (1 / (pi / 4)) )
+
+ # connect it all up
+ self.__connect([[source, (self.mixer, 0)],
+ [self.lo, (self.mixer, 1)]])
+ self.set_connection(fft=1)
+ self.connect_demods()
+
+ # Connect up the flow graph
+ #
+ def __connect(self, cnxns):
+ for l in cnxns:
+ for b in l:
+ if b == l[0]:
+ p = l[0]
+ else:
+ self.connect(p, b)
+ p = b
+ self.cnxns.extend(cnxns)
+
+ # Disconnect the flow graph
+ #
+ def __disconnect(self):
+ for l in self.cnxns:
+ for b in l:
+ if b == l[0]:
+ p = l[0]
+ else:
+ self.disconnect(p, b)
+ p = b
+ self.cnxns = []
+
+ def msg_data(self, evt):
+ params = evt.data
+ freq = params['freq']
+ self.myform['freq'].set_value('%s' % (freq / 1000000.0))
+ talkgroup = params['tgid']
+ tag = params['tag']
+ if not talkgroup:
+ talkgroup = 0
+ if not tag:
+ tag = ''
+ tg = '%s (%d)' % (tag, talkgroup)
+ if talkgroup == 0 and tag == '':
+ tg = ''
+ self.myform['talkgroup'].set_value(tg)
+ nac = params['nac']
+ system = params['system']
+ self.myform['system'].set_value('%X:%s' % (nac, system))
+
+ def set_speed(self, new_speed):
+ # assumes that lock is held, or that we are in init
+ self.disconnect_demods()
+ self.current_speed = new_speed
+ self.connect_fsk4_demod()
+
+ def set_connection(self,
+ fscope=False,
+ fft=False,
+ corr=False,
+ fac=False,
+ c4fm=False):
+ # assumes that lock is held, or that we are in init
+ if fac != self.fac_state:
+ self.fac_state = fac
+ if fac:
+ self.connect(self.mixer, self.fac_scope)
+ else:
+ self.disconnect(self.mixer, self.fac_scope)
+ if corr != self.corr_state:
+ self.corr_state = corr
+ if corr:
+ if self.corr_i_chan:
+ self.connect(self.arb_resampler, self.to_real, self.real_amp, self.correlation_scope)
+ else:
+ self.connect(self.symbol_filter, self.correlation_scope)
+ else:
+ if self.corr_i_chan:
+ self.disconnect(self.arb_resampler, self.to_real, self.real_amp, self.correlation_scope)
+ else:
+ self.disconnect(self.symbol_filter, self.correlation_scope)
+
+ if fscope != self.fscope_state:
+ self.fscope_state = fscope
+ if fscope == 0:
+ self.disconnect(self.buffer, self.float_scope)
+ else:
+ self.connect(self.buffer, self.float_scope)
+
+ if fft != self.fft_state:
+ self.fft_state = fft
+ if fft == 0:
+ self.disconnect(self.mixer, self.spectrum)
+ else:
+ self.connect(self.mixer, self.spectrum)
+
+ if c4fm != self.c4fm_state:
+ self.c4fm_state = c4fm
+ if c4fm == 0:
+ self.disconnect(self.symbol_filter, self.signal_scope)
+ else:
+ self.connect(self.symbol_filter, self.signal_scope)
+
+ def notebook_changed(self, evt):
+ sel = self.notebook.GetSelection()
+ self.lock()
+ self.disconnect_data_scope()
+ self.disconnect_constellation_scope()
+ if sel == 0: # spectrum
+ if not self.baseband_input:
+ self.set_connection(fft=1)
+ self.connect_demods()
+ elif sel == 1: # c4fm
+ self.set_connection(c4fm=1)
+ self.connect_fsk4_demod()
+ elif sel == 2: # datascope
+ self.set_connection()
+ self.connect_fsk4_demod()
+ self.connect_data_scope()
+ elif sel == 3: # constellation (complex)
+ if not self.baseband_input:
+ self.set_connection()
+ self.connect_psk_demod()
+ self.connect_constellation_scope()
+ elif sel == 4: # demodulated symbols
+ self.connect_demods()
+ self.set_connection(fscope=1)
+ elif sel == 5: # traffic pane
+ self.connect_demods()
+ self.set_connection(fscope=1)
+ self.update_traffic(None)
+ elif sel == 6: # correlation
+ self.disconnect_demods()
+ self.current_speed = self.default_speed_idx # reset speed for corr
+ self.data_scope.win.radio_box_speed.SetSelection(self.current_speed)
+ self.connect_fsk4_demod()
+ self.set_connection(corr=1)
+ elif sel == 7: # fac - fast auto correlation
+ if not self.baseband_input:
+ self.set_connection(fac=1)
+ self.connect_demods()
+ self.unlock()
+
+ # initialize the UI
+ #
+ def __init_gui(self, frame, panel, vbox):
+
+ def _form_set_freq(kv):
+ return self.set_freq(kv['freq'])
+
+ self.frame = frame
+ self.frame.CreateStatusBar()
+ self.panel = panel
+ self.vbox = vbox
+
+ # setup the menu bar
+ menubar = self.frame.GetMenuBar()
+
+ # setup the "File" menu
+ file_menu = menubar.GetMenu(0)
+ self.file_new = file_menu.Insert(0, wx.ID_NEW)
+ self.frame.Bind(wx.EVT_MENU, self._on_file_new, self.file_new)
+ self.file_open = file_menu.Insert(1, wx.ID_OPEN)
+ self.frame.Bind(wx.EVT_MENU, self._on_file_open, self.file_open)
+ file_menu.InsertSeparator(2)
+ self.file_properties = file_menu.Insert(3, wx.ID_PROPERTIES)
+ self.frame.Bind(wx.EVT_MENU, self._on_file_properties, self.file_properties)
+ file_menu.InsertSeparator(4)
+ self.file_close = file_menu.Insert(5, wx.ID_CLOSE)
+ self.frame.Bind(wx.EVT_MENU, self._on_file_close, self.file_close)
+
+ # setup the "Edit" menu
+ edit_menu = wx.Menu()
+ self.edit_undo = edit_menu.Insert(0, wx.ID_UNDO)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_undo, self.edit_undo)
+ self.edit_redo = edit_menu.Insert(1, wx.ID_REDO)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_redo, self.edit_redo)
+ edit_menu.InsertSeparator(2)
+ self.edit_cut = edit_menu.Insert(3, wx.ID_CUT)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_cut, self.edit_cut)
+ self.edit_copy = edit_menu.Insert(4, wx.ID_COPY)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_copy, self.edit_copy)
+ self.edit_paste = edit_menu.Insert(5, wx.ID_PASTE)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_paste, self.edit_paste)
+ self.edit_delete = edit_menu.Insert(6, wx.ID_DELETE)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_delete, self.edit_delete)
+ edit_menu.InsertSeparator(7)
+ self.edit_select_all = edit_menu.Insert(8, wx.ID_SELECTALL)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_select_all, self.edit_select_all)
+ edit_menu.InsertSeparator(9)
+ self.edit_prefs = edit_menu.Insert(10, wx.ID_PREFERENCES)
+ self.frame.Bind(wx.EVT_MENU, self._on_edit_prefs, self.edit_prefs)
+ menubar.Append(edit_menu, "&Edit"); # ToDo use wx.ID_EDIT stuff
+
+ # setup the toolbar
+ if True:
+ self.toolbar = wx.ToolBar(frame, -1, style = wx.TB_DOCKABLE | wx.TB_HORIZONTAL)
+ frame.SetToolBar(self.toolbar)
+ icon_size = wx.Size(24, 24)
+# new_icon = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, icon_size)
+# toolbar_new = self.toolbar.AddSimpleTool(wx.ID_NEW, new_icon, "New Capture")
+# open_icon = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, icon_size)
+# toolbar_open = self.toolbar.AddSimpleTool(wx.ID_OPEN, open_icon, "Open")
+
+ self.toolbar.Realize()
+ else:
+ self.toolbar = None
+
+ # setup the notebook
+ self.notebook = wx.Notebook(self.panel)
+ self.vbox.Add(self.notebook, 1, wx.EXPAND)
+ # add spectrum scope
+ self.spectrum = fftsink2.fft_sink_c(self.notebook, sample_rate = self.channel_rate, fft_size=512, fft_rate=2, average=False, peak_hold=False)
+ try:
+ self.spectrum_plotter = self.spectrum.win.plotter
+ except:
+ self.spectrum_plotter = self.spectrum.win.plot
+ #self.spectrum_plotter.enable_point_label(False)
+ self.spectrum_plotter.Bind(wx.EVT_LEFT_DOWN, self._on_spectrum_left_click)
+ self.notebook.AddPage(self.spectrum.win, "Spectrum")
+ # add C4FM scope
+ self.signal_scope = scopesink2.scope_sink_f(self.notebook, sample_rate = self.basic_rate, v_scale=5, t_scale=0.001)
+ try:
+ self.signal_plotter = self.signal_scope.win.plotter
+ except:
+ self.signal_plotter = self.signal_scope.win.graph
+ self.notebook.AddPage(self.signal_scope.win, "C4FM")
+ # add datascope
+ self.data_scope = datascope_sink_f(self.notebook, samples_per_symbol = 10, num_plots = 100)
+ self.data_plotter = self.data_scope.win.graph
+ wx.EVT_RADIOBOX(self.data_scope.win.radio_box, 11103, self.filter_select)
+ wx.EVT_RADIOBOX(self.data_scope.win.radio_box_speed, 11104, self.speed_select)
+ self.data_scope.win.radio_box_speed.SetSelection(self.current_speed)
+ self.notebook.AddPage(self.data_scope.win, "Datascope")
+ # add complex scope
+ self.complex_scope = constellation_plot_c(self.notebook, title="Constellation", num_plots=250)
+ self.notebook.AddPage(self.complex_scope.win, "Constellation")
+ wx.EVT_RADIOBOX(self.complex_scope.win.radio_box_source, 11108, self.source_select)
+ # add float scope
+ self.float_scope = scopesink2.scope_sink_f(self.notebook, frame_decim=1, sample_rate=self.symbol_rate, v_scale=1, t_scale=0.05)
+ try: #gl
+ self.float_plotter = self.float_scope.win.plotter
+ self.float_scope.win['marker_1'] = 3.0 # set type = large dots
+ except: #nongl
+ self.float_plotter = self.float_scope.win.graph
+ self.float_scope.win.set_format_plus()
+ self.notebook.AddPage(self.float_scope.win, "Symbols")
+ # Traffic snapshot
+ self.traffic = TrafficPane(self.notebook, trunk_traffic=True)
+ self.notebook.AddPage(self.traffic, "Traffic")
+ wx.EVT_BUTTON (self.traffic, 11109, self.update_traffic)
+ # add corr scope
+ self.correlation_scope = correlation_plot_f(self.notebook, frame_decim=4, sps=10, v_scale=1, t_scale=0.05)
+ # self.correlation_plotter = self.correlation_scope.win.plotter
+ wx.EVT_RADIOBOX(self.correlation_scope.win.radio_box_corr, 11105, self.corr_select)
+ self.notebook.AddPage(self.correlation_scope.win, "Correlation")
+ # add fac scope
+ self.fac_scope = fac_sink_c(self.notebook, fac_size=32768, sample_rate=self.channel_rate, title="Auto Correlation")
+ self.notebook.AddPage(self.fac_scope.win, "FAC")
+ # Setup the decoder and report the TUN/TAP device name
+ msgq = gr.msg_queue(2)
+ # self.decode_watcher = decode_watcher(msgq, self.traffic)
+ # self.p25_decoder = op25.decoder_ff(msgq)
+ # self.frame.SetStatusText("TUN/TAP: " + self.p25_decoder.device_name())
+
+ self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.notebook_changed)
+
+ self.myform = myform = form.form()
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+
+ vbox_form = wx.BoxSizer(wx.VERTICAL)
+ myform['system'] = form.static_text_field(
+ parent=self.panel, sizer=vbox_form, label="System", weight=0)
+ myform['system'].set_value("........................................")
+ myform['talkgroup'] = form.static_text_field(
+ parent=self.panel, sizer=vbox_form, label="Talkgroup", weight=0)
+ myform['talkgroup'].set_value("........................................")
+
+ if not self.baseband_input:
+ if self.options.trunk_conf_file:
+ myform['freq'] = form.static_text_field(
+ parent=self.panel, sizer=vbox_form, label="Frequency", weight=0)
+ myform['freq'].set_value('%s' % self.options.frequency)
+ else:
+ myform['freq'] = form.float_field(
+ parent=self.panel, sizer=vbox_form, label="Frequency", weight=0,
+ callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg))
+ myform['freq'].set_value(self.options.frequency)
+ if self.baseband_input:
+ min_gain = 0
+ max_gain = 200
+ initial_val = 50
+ else:
+ min_gain = 0
+ max_gain = 25
+ initial_val = 10
+
+ hbox.Add(vbox_form, 0, 0)
+
+ vbox_buttons = wx.BoxSizer(wx.VERTICAL)
+# skip_button = form.button_with_callback(
+# parent=self.panel, label="Skip",
+# callback=self.form_skip)
+# vbox_buttons.Add(skip_button, 0, 0)
+ lockout_button = form.button_with_callback(
+ parent=self.panel, label="Lockout",
+ callback=self.form_lockout)
+ vbox_buttons.Add(lockout_button, 0, 0)
+ myform['hold'] = form.checkbox_field(
+ parent=self.panel, sizer=vbox_buttons, label="Hold", weight=0,
+ callback=myform.check_input_and_call(self.form_hold))
+ hbox.Add(vbox_buttons, 0, 0)
+
+ vbox_sliders = wx.BoxSizer(wx.VERTICAL)
+ myform['signal_gain'] = form.slider_field(parent=self.panel, sizer=vbox_sliders, label="Signal Gain",
+ weight=0,
+ min=min_gain, max=max_gain,
+ callback=self.set_gain)
+ self.myform['signal_gain'].set_value(initial_val)
+ if not self.baseband_input:
+ myform['freq_tune'] = form.slider_field(parent=self.panel, sizer=vbox_sliders, label="Fine Tune",
+ weight=0,
+ min=-3000, max=3000,
+ callback=self.set_freq_tune)
+ if not self.options.trunk_conf_file:
+ myform['demod_type'] = form.radiobox_field(parent=self.panel, sizer=hbox, label="Demod",
+ weight=0, choices=['FSK4','PSK'], specify_rows=True,
+ callback=self.demod_type_chg)
+
+ hbox.Add(vbox_sliders, 0, 0)
+
+ vbox.Add(hbox, 0, 0)
+
+ def change_freq(self, params):
+ freq = params['freq']
+ offset = params['offset']
+
+ if self.options.hamlib_model:
+ self.hamlib.set_freq(freq)
+ else:
+ self.set_freq(freq + offset)
+
+ # send msg as event to avoid thread safety problems updating form
+ evt = msg_DataEvent(params)
+ wx.PostEvent(self.frame, evt)
+
+ def hamlib_attach(self, model):
+ Hamlib.rig_set_debug (Hamlib.RIG_DEBUG_NONE) # RIG_DEBUG_TRACE
+
+ self.hamlib = Hamlib.Rig (model)
+ self.hamlib.set_conf ("serial_speed","9600")
+ self.hamlib.set_conf ("retry","5")
+
+ self.hamlib.open ()
+
+ def q_action(self, action):
+ msg = gr.message().make_from_string(action, -2, 0, 0)
+ self.rx_q.insert_tail(msg)
+
+ def form_hold(self, kv):
+ if kv['hold']:
+ cmd = 'set_hold'
+ else:
+ cmd = 'unset_hold'
+ self.q_action(cmd)
+
+ def form_skip(self):
+ self.q_action('skip')
+
+ def form_lockout(self):
+ self.q_action('lockout')
+
+ def update_traffic(self, evt):
+ s = self.trunk_rx.to_string()
+ t = {}
+ t['string'] = s
+ self.traffic.update(t)
+
+ def set_gain(self, gain):
+ if self.baseband_input:
+ f = 1.0
+ else:
+ f = 0.1
+ self.baseband_amp.set_k(float(gain) * f)
+
+ def set_freq_tune(self, val):
+ self.myform['freq_tune'].set_value(val)
+ self.lo.set_frequency(val + self.lo_freq)
+
+ def set_freq(self, target_freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @rypte: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital down converter.
+ """
+ r = self.src.set_center_freq(target_freq + self.options.calibration + self.options.offset)
+
+ if r:
+ #self.myform['freq'].set_value(target_freq) # update displayed va
+ #if self.show_debug_info:
+ # self.myform['baseband'].set_value(r.baseband_freq)
+ # self.myform['ddc'].set_value(r.dxc_freq)
+ return True
+
+ return False
+
+ def demod_type_chg(self, val):
+ if val == 'FSK4':
+ self.fsk4_demod_mode = True
+ else:
+ self.fsk4_demod_mode = False
+ self.lock()
+ self.disconnect_demods()
+ notebook_sel = self.notebook.GetSelection()
+ if notebook_sel == 4: # demod symbols
+ self.connect_demods()
+ elif notebook_sel == 1 or notebook_sel == 2 or notebook_sel == 5:
+ self.connect_fsk4_demod()
+ elif notebook_sel == 3: # constellation
+ self.connect_psk_demod()
+
+ self.unlock()
+
+ def _set_status_msg(self, msg):
+ self.frame.GetStatusBar().SetStatusText(msg, 0)
+
+ # read capture file properties (decimation etc.)
+ #
+ def __read_file_properties(self, filename):
+ f = open(filename, "r")
+ self.info = pickle.load(f)
+ ToDo = True
+ f.close()
+
+ # setup to rx from file
+ #
+ def __set_rx_from_file(self, filename, capture_rate):
+ file = blocks.file_source(gr.sizeof_gr_complex, filename, True)
+ throttle = gr.throttle(gr.sizeof_gr_complex, capture_rate)
+ self.__connect([[file, throttle]])
+ self.__build_graph(throttle, capture_rate)
+
+ # setup to rx from Audio
+ #
+ def __set_rx_from_audio(self, capture_rate):
+ self.__build_graph(self.source, capture_rate)
+
+ # setup to rx from USRP
+ #
+ def __set_rx_from_osmosdr(self):
+ # setup osmosdr
+ capture_rate = self.src.set_sample_rate(self.options.sample_rate)
+ if self.options.antenna:
+ self.src.set_antenna(self.options.antenna)
+ self.info["capture-rate"] = capture_rate
+ self.src.set_bandwidth(capture_rate)
+ r = self.src.set_center_freq(self.options.frequency + self.options.calibration+ self.options.offset)
+ print 'set_center_freq: %d' % r
+ if not r:
+ raise RuntimeError("failed to set USRP frequency")
+ # capture file
+ # if preserve:
+ if 0:
+ try:
+ self.capture_filename = os.tmpnam()
+ except RuntimeWarning:
+ ignore = True
+ capture_file = blocks.file_sink(gr.sizeof_gr_complex, self.capture_filename)
+ self.__connect([[self.usrp, capture_file]])
+ else:
+ self.capture_filename = None
+ # everything else
+ self.__build_graph(self.src, capture_rate)
+
+ # Change the UI state
+ #
+ def _set_state(self, new_state):
+ self.state = new_state
+ if "STOPPED" == self.state:
+ # menu items
+ can_capture = self.usrp is not None
+ self.file_new.Enable(can_capture)
+ self.file_open.Enable(True)
+ self.file_properties.Enable(False)
+ self.file_close.Enable(False)
+ # toolbar
+ if self.toolbar:
+ self.toolbar.EnableTool(wx.ID_NEW, can_capture)
+ self.toolbar.EnableTool(wx.ID_OPEN, True)
+ # Visually reflect "no file"
+ self.frame.SetStatusText("", 1)
+ self.frame.SetStatusText("", 2)
+ self.spectrum_plotter.ClearBackground()
+ self.signal_plotter.ClearBackground()
+ # self.symbol_plotter.ClearBackground()
+ # self.traffic.clear()
+ elif "RUNNING" == self.state:
+ # menu items
+ self.file_new.Enable(False)
+ self.file_open.Enable(False)
+ self.file_properties.Enable(True)
+ self.file_close.Enable(True)
+ # toolbar
+ if self.toolbar:
+ self.toolbar.EnableTool(wx.ID_NEW, False)
+ self.toolbar.EnableTool(wx.ID_OPEN, False)
+ elif "CAPTURING" == self.state:
+ # menu items
+ self.file_new.Enable(False)
+ self.file_open.Enable(False)
+ self.file_properties.Enable(True)
+ self.file_close.Enable(True)
+ # toolbar
+ if self.toolbar:
+ self.toolbar.EnableTool(wx.ID_NEW, False)
+ self.toolbar.EnableTool(wx.ID_OPEN, False)
+
+
+ # Append filename to default title bar
+ #
+ def _set_titlebar(self, filename):
+ ToDo = True
+
+ # Write capture file properties
+ #
+ def __write_file_properties(self, filename):
+ f = open(filename, "w")
+ pickle.dump(self.info, f)
+ f.close()
+
+ # Adjust the channel offset
+ #
+ def adjust_channel_offset(self, delta_hz):
+ max_delta_hz = 12000.0
+ delta_hz *= self.symbol_deviation
+ delta_hz = max(delta_hz, -max_delta_hz)
+ delta_hz = min(delta_hz, max_delta_hz)
+ self.channel_filter.set_center_freq(self.channel_offset - delta_hz+ self.options.offset)
+
+ # Close an open file
+ #
+ def _on_file_close(self, event):
+ self.stop()
+ self.wait()
+ self.__disconnect()
+ if "CAPTURING" == self.state and self.capture_filename:
+ dialog = wx.MessageDialog(self.frame, "Save capture file before closing?", style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+ if wx.ID_YES == dialog.ShowModal():
+ save_dialog = wx.FileDialog(self.frame, "Save capture file as:", wildcard="*.dat", style=wx.SAVE|wx.OVERWRITE_PROMPT)
+ if save_dialog.ShowModal() == wx.ID_OK:
+ path = str(save_dialog.GetPath())
+ save_dialog.Destroy()
+ os.rename(self.capture_filename, path)
+ self.__write_file_properties(path + ".info")
+ else:
+ os.remove(self.capture_filename)
+ self.capture_filename = None
+ self._set_state("STOPPED")
+
+ # New capture from USRP
+ #
+ def _on_file_new(self, event):
+# wizard = wx.wizard.Wizard(self.frame, -1, "New Capture from USRP")
+# page1 = wizard_intro_page(wizard)
+# page2 = wizard_details_page(wizard)
+# page3 = wizard_preserve_page(wizard)
+# page4 = wizard_finish_page(wizard)
+# wx.wizard.WizardPageSimple_Chain(page1, page2)
+# wx.wizard.WizardPageSimple_Chain(page2, page3)
+# wx.wizard.WizardPageSimple_Chain(page3, page4)
+# wizard.FitToPage(page1)
+# if wizard.RunWizard(page1):
+ self.stop()
+ self.wait()
+ # ToDo: get open_usrp() arguments from wizard
+ self.open_usrp((0,0), 200, None, 434.08e06, True) # Test freq
+ self.start()
+
+ # Open an existing capture
+ #
+ def _on_file_open(self, event):
+ dialog = wx.FileDialog(self.frame, "Choose a capture file:", wildcard="*.dat", style=wx.OPEN)
+ if dialog.ShowModal() == wx.ID_OK:
+ file = str(dialog.GetPath())
+ dialog.Destroy()
+ self.stop()
+ self.wait()
+ self.open_file(file)
+ self.start()
+
+ # Present file properties dialog
+ #
+ def _on_file_properties(self, event):
+ # ToDo: show what info we have about the capture file (name,
+ # capture source, capture rate, date(?), size(?),)
+ todo = True
+
+ # Undo the last edit
+ #
+ def _on_edit_undo(self, event):
+ todo = True
+
+ # Redo the edit
+ #
+ def _on_edit_redo(self, event):
+ todo = True
+
+ # Cut the current selection
+ #
+ def _on_edit_cut(self, event):
+ todo = True
+
+ # Copy the current selection
+ #
+ def _on_edit_copy(self, event):
+ todo = True
+
+ # Paste into the current sample
+ #
+ def _on_edit_paste(self, event):
+ todo = True
+
+ # Delete the current selection
+ #
+ def _on_edit_delete(self, event):
+ todo = True
+
+ # Select all
+ #
+ def _on_edit_select_all(self, event):
+ todo = True
+
+ # Open the preferences dialog
+ #
+ def _on_edit_prefs(self, event):
+ todo = True
+
+
+ # Set channel offset and RF squelch threshold
+ #
+ def _on_spectrum_left_click(self, event):
+ if "STOPPED" != self.state:
+ # set frequency
+ x,y = self.spectrum_plotter.GetXY(event)
+ xmin, xmax = self.spectrum_plotter.GetXCurrentRange()
+ x = min(x, xmax)
+ x = max(x, xmin)
+ scale_factor = self.spectrum.win._scale_factor
+ chan_width = 6.25e3
+ x /= scale_factor
+ x += chan_width / 2
+ x = (x // chan_width) * chan_width
+ self.set_channel_offset(x, scale_factor, self.spectrum.win._units)
+ # set squelch threshold
+ ymin, ymax = self.spectrum_plotter.GetYCurrentRange()
+ y = min(y, ymax)
+ y = max(y, ymin)
+ squelch_increment = 5
+ y += squelch_increment / 2
+ y = (y // squelch_increment) * squelch_increment
+ self.set_squelch_threshold(int(y))
+
+ # Open an existing capture file
+ #
+ def open_file(self, capture_file):
+ try:
+ self.__read_file_properties(capture_file + ".info")
+ capture_rate = self.info["capture-rate"]
+ self.__set_rx_from_file(capture_file, capture_rate)
+ self._set_titlebar(capture_file)
+ self._set_state("RUNNING")
+ except Exception, x:
+ wx.MessageBox("Cannot open capture file: " + x.message, "File Error", wx.CANCEL | wx.ICON_EXCLAMATION)
+
+ def open_ifile(self, capture_rate, gain, input_filename, file_seek):
+ speed = 96000 # TODO: fixme
+ ifile = blocks.file_source(gr.sizeof_gr_complex, input_filename, 1)
+ if file_seek > 0:
+ rc = ifile.seek(file_seek*1024, gr.SEEK_SET)
+ assert rc == True
+ #print "seek: %d, rc = %d" % (file_seek, rc)
+ throttle = gr.throttle(gr.sizeof_gr_complex, speed)
+ self.source = gr.multiply_const_cc(gain)
+ self.connect(ifile, throttle, self.source)
+ self.__set_rx_from_audio(speed)
+ self._set_titlebar("Playing")
+ self._set_state("PLAYING")
+
+ def open_audio_c(self, capture_rate, gain, audio_input_filename):
+ self.info = {
+ "capture-rate": capture_rate,
+ "center-freq": 0,
+ "source-dev": "AUDIO",
+ "source-decim": 1 }
+ self.audio_source = audio.source(capture_rate, audio_input_filename)
+ self.audio_cvt = gr.float_to_complex()
+ self.connect((self.audio_source, 0), (self.audio_cvt, 0))
+ self.connect((self.audio_source, 1), (self.audio_cvt, 1))
+ self.source = gr.multiply_const_cc(gain)
+ self.connect(self.audio_cvt, self.source)
+ self.__set_rx_from_audio(capture_rate)
+ self._set_titlebar("Capturing")
+ self._set_state("CAPTURING")
+
+ def open_audio(self, capture_rate, gain, audio_input_filename):
+ self.info = {
+ "capture-rate": capture_rate,
+ "center-freq": 0,
+ "source-dev": "AUDIO",
+ "source-decim": 1 }
+ self.source = audio.source(capture_rate, audio_input_filename)
+ self.__set_rx_from_audio(capture_rate)
+ self._set_titlebar("Capturing")
+ self._set_state("CAPTURING")
+
+ # Open the USRP
+ #
+ def open_usrp(self):
+ # try:
+ self.info = {
+ "capture-rate": "unknown",
+ "center-freq": self.options.frequency,
+ "source-dev": "USRP",
+ "source-decim": 1 }
+ self.__set_rx_from_osmosdr()
+ self._set_titlebar("Capturing")
+ self._set_state("CAPTURING")
+ # except Exception, x:
+ # wx.MessageBox("Cannot open USRP: " + x.message, "USRP Error", wx.CANCEL | wx.ICON_EXCLAMATION)
+
+ # Set the channel offset
+ #
+ def set_channel_offset(self, offset_hz, scale, units):
+ self.channel_offset = -offset_hz
+ self.channel_filter.set_center_freq(self.channel_offset+ self.options.offset)
+ self.frame.SetStatusText("Channel offset: " + str(offset_hz * scale) + units, 1)
+
+ # Set the RF squelch threshold level
+ #
+ def set_squelch_threshold(self, squelch_db):
+ self.squelch.set_threshold(squelch_db)
+ self.frame.SetStatusText("Squelch: " + str(squelch_db) + "dB", 2)
+
+ def disconnect_demods(self):
+# assumes lock held or init
+ idx = self.current_speed
+ if self.fsk4_demod_connected:
+# self.disconnect(self.mixer, self.lpf, self.arb_resampler, self.resamplers[idx], self.fm_demod, self.baseband_amp, self.symbol_filter, self.fsk4_demod, self.buffer, self.slicer, self.sink_s)
+ if self.baseband_input:
+ self.disconnect(self.source, self.baseband_amp, self.float_resamplers[self.current_speed], self.symbol_filter)
+ else:
+ self.disconnect(self.mixer, self.lpf, self.arb_resampler, self.resamplers[idx], self.fm_demod, self.baseband_amp, self.symbol_filter)
+ self.disconnect(self.symbol_filter, self.fsk4_demod, self.buffer, self.slicer, self.sink_s, self.sink_imbe)
+ if self.options.raw_symbols:
+ self.disconnect(self.slicer, self.sink_sf)
+ self.fsk4_demod_connected = False
+ if self.psk_demod_connected:
+ self.disconnect(self.mixer, self.lpf, self.arb_resampler, self.resamplers[idx], self.agc, self.symbol_filter_c, self.clock, self.diffdec, self.to_float, self.rescale, self.buffer, self.slicer, self.sink_s, self.sink_imbe)
+ if self.options.raw_symbols:
+ self.disconnect(self.slicer, self.sink_sf)
+ self.psk_demod_connected = False
+
+ def connect_psk_demod(self):
+# assumes lock held or init
+ self.disconnect_demods()
+ idx = self.current_speed
+ self.connect(self.mixer, self.lpf, self.arb_resampler, self.resamplers[idx], self.agc, self.symbol_filter_c, self.clock, self.diffdec, self.to_float, self.rescale, self.buffer, self.slicer, self.sink_s, self.sink_imbe)
+ if self.options.raw_symbols:
+ self.connect(self.slicer, self.sink_sf)
+ self.psk_demod_connected = True
+
+ def connect_fsk4_demod(self):
+# assumes lock held or init
+ self.disconnect_demods()
+ idx = self.current_speed
+ if self.baseband_input:
+ self.connect(self.source, self.baseband_amp, self.float_resamplers[self.current_speed], self.symbol_filter)
+ else:
+ self.connect(self.mixer, self.lpf, self.arb_resampler, self.resamplers[idx], self.fm_demod, self.baseband_amp, self.symbol_filter)
+ self.connect(self.symbol_filter, self.fsk4_demod, self.buffer, self.slicer, self.sink_s, self.sink_imbe)
+ if self.options.raw_symbols:
+ self.connect(self.slicer, self.sink_sf)
+ self.fsk4_demod_connected = True
+
+ def connect_demods(self):
+ if self.baseband_input:
+ self.connect_fsk4_demod()
+ else:
+ if self.fsk4_demod_mode:
+ self.connect_fsk4_demod()
+ else:
+ self.connect_psk_demod()
+
+ def disconnect_constellation_scope(self):
+ if self.constellation_scope_connected:
+ self.disconnect(self.constellation_scope_input, self.complex_scope)
+ self.constellation_scope_connected = False
+ self.constellation_scope_input = None
+
+ def connect_constellation_scope(self):
+ self.disconnect_constellation_scope()
+ sel = self.complex_scope.win.radio_box_source.GetSelection()
+ if sel:
+ self.constellation_scope_input = self.diffdec
+ else:
+ self.constellation_scope_input = self.clock
+ self.constellation_scope_connected = True
+ self.connect(self.constellation_scope_input, self.complex_scope)
+
+ def disconnect_data_scope(self):
+ if self.data_scope_connected:
+ self.disconnect(self.data_scope_input, self.data_scope)
+ self.data_scope_connected = False
+ self.data_scope_input = None
+
+ def connect_data_scope(self):
+ self.disconnect_data_scope()
+ sel = self.data_scope.win.radio_box.GetSelection()
+ if sel:
+ self.data_scope_input = self.symbol_filter
+ else:
+ self.data_scope_input = self.baseband_amp
+ self.data_scope_connected = True
+ self.connect(self.data_scope_input, self.data_scope)
+
+ # for datascope, choose monitor viewpoint
+ def filter_select(self, evt):
+ self.lock()
+ self.connect_data_scope()
+ self.unlock()
+
+ def corr_select(self, evt):
+ new_corr = self.correlation_scope.win.radio_box_corr.GetSelection()
+ self.correlation_scope.win.correlation = self.correlation_scope.win.signatures[new_corr]
+ if self.baseband_input:
+ return
+ self.lock()
+ self.set_connection()
+ if new_corr == len(self.correlation_scope.win.signatures) - 1:
+ # special iden mode
+ self.corr_i_chan = True
+ else:
+ self.corr_i_chan = False
+ self.set_connection(corr=True)
+ self.unlock()
+
+ def source_select(self, evt):
+ self.lock()
+ self.connect_constellation_scope()
+ self.unlock()
+
+ def speed_select(self, evt):
+ new_speed = self.data_scope.win.radio_box_speed.GetSelection()
+ self.lock()
+ self.set_speed(new_speed)
+ self.unlock()
+
+class window_with_ctlbox(wx.Panel):
+ def __init__(self, parent, id = -1):
+ wx.Panel.__init__(self, parent, id)
+
+ def make_control_box (self):
+ global speeds
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0)
+
+ run_stop = wx.Button (self, 11102, "Run/Stop")
+ run_stop.SetToolTipString ("Toggle Run/Stop mode")
+ wx.EVT_BUTTON (self, 11102, self.run_stop)
+ ctrlbox.Add (run_stop, 0, wx.EXPAND)
+
+ self.radio_box = wx.RadioBox(self, 11103, "Viewpoint", style=wx.RA_SPECIFY_ROWS,
+ choices = ["Raw", "Filtered"] )
+ self.radio_box.SetToolTipString("Viewpoint Before Or After Symbol Filter")
+ self.radio_box.SetSelection(1)
+ ctrlbox.Add (self.radio_box, 0, wx.EXPAND)
+
+ ctrlbox.Add ((5, 0) ,0) # stretchy space
+
+ speed_str = []
+ for speed in speeds:
+ speed_str.append("%d" % speed)
+
+ self.radio_box_speed = wx.RadioBox(self, 11104, "Symbol Rate", style=wx.RA_SPECIFY_ROWS, majorDimension=2, choices = speed_str)
+ self.radio_box_speed.SetToolTipString("Symbol Rate")
+ ctrlbox.Add (self.radio_box_speed, 0, wx.EXPAND)
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ return ctrlbox
+
+# A snapshot of important fields in current traffic
+#
+class TrafficPane(wx.Panel):
+
+ # Initializer
+ #
+ def __init__(self, parent, trunk_traffic=False, voice_traffic=False, update_callback=None):
+
+ wx.Panel.__init__(self, parent)
+ sizer = wx.GridBagSizer(hgap=10, vgap=10)
+ self.fields = {}
+
+ if trunk_traffic:
+ #label = wx.StaticText(self, -1, "DUID:")
+ #sizer.Add(label, pos=(1,1))
+ self.update_b = wx.Button (self, 11109, "Update")
+ sizer.Add(self.update_b, pos=(1,1))
+ field = wx.TextCtrl(self, -1, "", size=(500,400), style=wx.TE_MULTILINE+wx.TE_READONLY)
+ sizer.Add(field, pos=(1,2))
+ self.fields["string"] = field;
+
+ if voice_traffic:
+ label = wx.StaticText(self, -1, "DUID:")
+ sizer.Add(label, pos=(1,1))
+ field = wx.TextCtrl(self, -1, "", size=(72, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(1,2))
+ self.fields["duid"] = field;
+
+ label = wx.StaticText(self, -1, "NAC:")
+ sizer.Add(label, pos=(2,1))
+ field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(2,2))
+ self.fields["nac"] = field;
+
+ label = wx.StaticText(self, -1, "Source:")
+ sizer.Add(label, pos=(3,1))
+ field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(3,2))
+ self.fields["source"] = field;
+
+ label = wx.StaticText(self, -1, "Destination:")
+ sizer.Add(label, pos=(4,1))
+ field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(4,2))
+ self.fields["dest"] = field;
+
+# label = wx.StaticText(self, -1, "ToDo:")
+# sizer.Add(label, pos=(5,1))
+# field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+# sizer.Add(field, pos=(5,2))
+# self.fields["nid"] = field;
+
+ label = wx.StaticText(self, -1, "MFID:")
+ sizer.Add(label, pos=(1,4))
+ field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(1,5))
+ self.fields["mfid"] = field;
+
+ label = wx.StaticText(self, -1, "ALGID:")
+ sizer.Add(label, pos=(2,4))
+ field = wx.TextCtrl(self, -1, "", size=(175, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(2,5))
+ self.fields["algid"] = field;
+
+ label = wx.StaticText(self, -1, "KID:")
+ sizer.Add(label, pos=(3,4))
+ field = wx.TextCtrl(self, -1, "", size=(72, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(3,5))
+ self.fields["kid"] = field;
+
+ label = wx.StaticText(self, -1, "MI:")
+ sizer.Add(label, pos=(4,4))
+ field = wx.TextCtrl(self, -1, "", size=(216, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(4,5))
+ self.fields["mi"] = field;
+
+ label = wx.StaticText(self, -1, "TGID:")
+ sizer.Add(label, pos=(5,4))
+ field = wx.TextCtrl(self, -1, "", size=(72, -1), style=wx.TE_READONLY)
+ sizer.Add(field, pos=(5,5))
+ self.fields["tgid"] = field;
+
+ self.SetSizer(sizer)
+ self.Fit()
+
+ # Clear the field values
+ #
+ def clear(self):
+ for v in self.fields.values():
+ v.Clear()
+
+ # Update the field values
+ #
+ def update(self, field_values):
+ for k,v in self.fields.items():
+ f = field_values.get(k, None)
+ if f:
+ v.SetValue(f)
+ else:
+ v.SetValue("")
+
+
+# Introduction page for USRP capture wizard
+#
+class wizard_intro_page(wx.wizard.WizardPageSimple):
+
+ # Initializer
+ #
+ def __init__(self, parent):
+ wx.wizard.WizardPageSimple.__init__(self, parent)
+ html = wx.html.HtmlWindow(self)
+ html.SetPage('''
+ <html>
+ <body>
+ <h1>Capture from USRP</h1>
+ <p>
+ We will guide you through the process of capturing a sample from the USRP.
+ Please ensure that the USRP is switched on and connected to this computer.
+ </p>
+ </body>
+ </html>
+ ''')
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ self.SetSizer(sizer)
+ sizer.Add(html, 1, wx.ALIGN_CENTER | wx.EXPAND | wx.FIXED_MINSIZE)
+
+
+# USRP wizard details page
+#
+class wizard_details_page(wx.wizard.WizardPageSimple):
+
+ # Initializer
+ #
+ def __init__(self, parent):
+ wx.wizard.WizardPageSimple.__init__(self, parent)
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ self.SetSizer(sizer)
+
+ # Return a tuple containing the subdev_spec, gain, frequency, decimation factor
+ #
+ def get_details(self):
+ ToDo = True
+
+
+# data unit receive queue
+#
+class du_queue_watcher(threading.Thread):
+
+ def __init__(self, msgq, callback, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon(1)
+ self.msgq = msgq
+ self.callback = callback
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ while(self.keep_running):
+ msg = self.msgq.delete_head()
+ self.callback(msg)
+
+# Frequency tracker
+#
+class demod_watcher(threading.Thread):
+
+ def __init__(self, msgq, callback, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon(1)
+ self.msgq = msgq
+ self.callback = callback
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ while(self.keep_running):
+ msg = self.msgq.delete_head()
+ frequency_correction = msg.arg1()
+ self.callback(frequency_correction)
+
+
+# Decoder watcher
+#
+class decode_watcher(threading.Thread):
+
+ def __init__(self, msgq, traffic_pane, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon(1)
+ self.msgq = msgq
+ self.traffic_pane = traffic_pane
+ self.keep_running = True
+ self.start()
+
+ def run(self):
+ while(self.keep_running):
+ msg = self.msgq.delete_head()
+ pickled_dict = msg.to_string()
+ attrs = pickle.loads(pickled_dict)
+ self.traffic_pane.update(attrs)
+
+############################################################################
+# following code modified from GNURadio sources
+
+default_scopesink_size = (640, 240)
+default_v_scale = 1000
+default_frame_decim = gr.prefs().get_long('wxgui', 'frame_decim', 1)
+
+class datascope_sink_f(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ samples_per_symbol=10, num_plots=100,
+ v_scale=default_v_scale, t_scale=None, num_inputs=1, **kwargs):
+
+ gr.hier_block2.__init__(self, "datascope_sink_f",
+ gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
+ self.st = blocks.message_sink(gr.sizeof_float, msgq, 1)
+ self.connect((self, 0), self.st)
+
+ self.win = datascope_window(datascope_win_info (msgq, sample_rate, frame_decim,
+ v_scale, t_scale, None, title), parent, samples_per_symbol=samples_per_symbol, num_plots=num_plots)
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+# ========================================================================
+
+wxDATA_EVENT = wx.NewEventType()
+
+def EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, wxDATA_EVENT, func)
+
+class datascope_DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+class datascope_win_info (object):
+ __slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale',
+ 'scopesink', 'title',
+ 'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy',
+ 'autorange', 'running']
+
+ def __init__ (self, msgq, sample_rate, frame_decim, v_scale, t_scale,
+ scopesink, title = "Oscilloscope", xy=False):
+ self.msgq = msgq
+ self.sample_rate = sample_rate
+ self.frame_decim = frame_decim
+ self.scopesink = scopesink
+ self.title = title;
+
+ self.marker = 'line'
+ self.xy = xy
+ self.autorange = not v_scale
+ self.running = True
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+
+ def get_sample_rate (self):
+ return self.sample_rate
+
+ def get_decimation_rate (self):
+ return 1.0
+
+ def set_marker (self, s):
+ self.marker = s
+
+ def get_marker (self):
+ return self.marker
+
+
+class datascope_input_watcher (threading.Thread):
+ def __init__ (self, msgq, event_receiver, frame_decim, num_plots, samples_per_symbol, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.event_receiver = event_receiver
+ self.frame_decim = frame_decim
+ self.samples_per_symbol = samples_per_symbol
+ self.num_plots = num_plots
+ self.iscan = 0
+ self.keep_running = True
+ self.skip = 0
+ self.totsamp = 0
+ self.skip_samples = 0
+ self.start ()
+ self.msg_string = ""
+
+ def run (self):
+ # print "datascope_input_watcher: pid = ", os.getpid ()
+ while (self.keep_running):
+ msg = self.msgq.delete_head() # blocking read of message queue
+ nchan = int(msg.arg1()) # number of channels of data in msg
+ nsamples = int(msg.arg2()) # number of samples in each channel
+ self.totsamp += nsamples
+ if self.skip_samples >= nsamples:
+ self.skip_samples -= nsamples
+ continue
+
+ self.msg_string += msg.to_string() # body of the msg as a string
+
+ bytes_needed = (self.num_plots*self.samples_per_symbol) * gr.sizeof_float
+ if (len(self.msg_string) < bytes_needed):
+ continue
+
+ records = []
+ # start = self.skip * gr.sizeof_float
+ start = 0
+ chan_data = self.msg_string[start:start+bytes_needed]
+ rec = numpy.fromstring (chan_data, numpy.float32)
+ records.append (rec)
+ self.msg_string = ""
+
+ unused = nsamples - (self.num_plots*self.samples_per_symbol)
+ unused -= (start/gr.sizeof_float)
+ self.skip = self.samples_per_symbol - (unused % self.samples_per_symbol)
+ # print "reclen = %d totsamp %d appended %d skip %d start %d unused %d" % (nsamples, self.totsamp, len(rec), self.skip, start/gr.sizeof_float, unused)
+
+ de = datascope_DataEvent (records)
+ wx.PostEvent (self.event_receiver, de)
+ records = []
+ del de
+
+ # lower values = more frequent plots, but higher CPU usage
+ self.skip_samples = self.num_plots * self.samples_per_symbol * 20
+
+class datascope_window (window_with_ctlbox):
+
+ def __init__ (self, info, parent, id = -1,
+ samples_per_symbol=10, num_plots=100,
+ pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
+ window_with_ctlbox.__init__ (self, parent, -1)
+ self.info = info
+
+ vbox = wx.BoxSizer (wx.VERTICAL)
+
+ self.graph = datascope_graph_window (info, self, -1, samples_per_symbol=samples_per_symbol, num_plots=num_plots)
+
+ vbox.Add (self.graph, 1, wx.EXPAND)
+ vbox.Add (self.make_control_box(), 0, wx.EXPAND)
+ vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+
+ self.sizer = vbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+
+ return ctrlbox
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
+class datascope_graph_window (plot.PlotCanvas):
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = (140, 140),
+ samples_per_symbol=10, num_plots=100,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.SetXUseScopeTicks (True)
+ self.SetEnableGrid (False)
+ self.SetEnableZoom (True)
+ self.SetEnableLegend(True)
+ # self.SetBackgroundColour ('black')
+
+ self.info = info;
+
+ self.total_points = 0
+
+ self.samples_per_symbol = samples_per_symbol
+ self.num_plots = num_plots
+
+ EVT_DATA_EVENT (self, self.format_data)
+
+ self.input_watcher = datascope_input_watcher (info.msgq, self, info.frame_decim, self.samples_per_symbol, self.num_plots)
+
+ def format_data (self, evt):
+ if not self.info.running:
+ return
+
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+ self.total_points += npoints
+
+ x_vals = numpy.arange (0, self.samples_per_symbol)
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ objects = []
+ colors = ['red','orange','yellow','green','blue','violet','cyan','magenta','brown','black']
+
+ r = records[0] # input data
+ for i in range(self.num_plots):
+ points = []
+ for j in range(self.samples_per_symbol):
+ p = [ j, r[ i*self.samples_per_symbol + j ] ]
+ points.append(p)
+ objects.append (plot.PolyLine (points, colour=colors[i % len(colors)], legend=('')))
+
+ graphics = plot.PlotGraphics (objects,
+ title='Data Scope',
+ xLabel = 'Time', yLabel = 'Amplitude')
+
+ x_range = (0., 0. + (self.samples_per_symbol-1)) # ranges are tuples!
+ self.y_range = (-4., 4.) # for standard -3/-1/+1/+3
+ # self.y_range = (-10., 10.) # for standard -3/-1/+1/+3
+ self.Draw (graphics, xAxis=x_range, yAxis=self.y_range)
+############################################################################
+class constellation_plot_c(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ frame_decim=10,
+ num_plots=100,
+ num_inputs=1, **kwargs):
+
+ gr.hier_block2.__init__(self, "constellation_plot_c",
+ gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
+ self.st = blocks.message_sink(gr.sizeof_gr_complex, msgq, 1)
+ self.connect((self, 0), self.st)
+
+ self.win = constellation_plot_window(constellation_plot_win_info (msgq, sample_rate, frame_decim, None, title), parent, num_plots=num_plots)
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+# ========================================================================
+
+wxDATA_EVENT = wx.NewEventType()
+
+def EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, wxDATA_EVENT, func)
+
+class constellation_plot_DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+class constellation_plot_win_info (object):
+ __slots__ = ['msgq', 'sample_rate', 'frame_decim',
+ 'scopesink', 'title',
+ 'time_scale_cursor', 'marker', 'xy',
+ 'autorange', 'running']
+
+ def __init__ (self, msgq, sample_rate, frame_decim,
+ scopesink, title = "Oscilloscope", xy=True):
+ self.msgq = msgq
+ self.sample_rate = sample_rate
+ self.frame_decim = frame_decim
+ self.scopesink = scopesink
+ self.title = title;
+
+ self.marker = 'line'
+ self.xy = xy
+ self.autorange = False
+ self.running = True
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+
+ def get_sample_rate (self):
+ return self.sample_rate
+
+ def get_decimation_rate (self):
+ return 1.0
+
+ def set_marker (self, s):
+ self.marker = s
+
+ def get_marker (self):
+ return self.marker
+
+
+class constellation_plot_input_watcher (threading.Thread):
+ def __init__ (self, msgq, event_receiver, frame_decim, num_plots, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.event_receiver = event_receiver
+ self.frame_decim = frame_decim
+ self.num_plots = num_plots
+ self.iscan = 0
+ self.keep_running = True
+ self.skip = 0
+ self.totsamp = 0
+ self.skip_samples = 0
+ self.start ()
+ self.msg_string = ""
+ self.skip_mode = False
+
+ def run (self):
+ # print "constellation_plot_input_watcher: pid = ", os.getpid ()
+ time.sleep(1)
+ while (self.keep_running):
+ bytes_needed = self.num_plots * gr.sizeof_float * 2
+ if self.skip_mode:
+ bytes_needed = 500 * gr.sizeof_float * 2
+
+ if len(self.msg_string) < bytes_needed:
+ msg = self.msgq.delete_head() # blocking read of message queue
+ nchan = int(msg.arg1()) # number of channels of data in msg
+ nsamples = int(msg.arg2()) # number of samples in each channel
+ self.totsamp += nsamples
+
+ self.msg_string += msg.to_string() # body of the msg as a string
+ continue
+
+ chan_data = self.msg_string[:bytes_needed]
+ self.msg_string = self.msg_string[bytes_needed:]
+
+ if self.skip_mode:
+ self.skip_mode = False
+ continue
+
+ records = []
+ # start = self.skip * gr.sizeof_gr_complex
+ # start = 0
+ # chan_data = self.msg_string[start:start+bytes_needed]
+ rec = numpy.fromstring (chan_data, numpy.float32)
+ records.append (rec)
+ # self.msg_string = ""
+
+ # unused = nsamples - self.num_plots
+ # unused -= (start/gr.sizeof_gr_complex)
+ # print "reclen = %d totsamp %d appended %d skip %d start %d unused %d" % (nsamples, self.totsamp, len(rec), self.skip, start/gr.sizeof_float, unused)
+
+ de = constellation_plot_DataEvent (records)
+ wx.PostEvent (self.event_receiver, de)
+ records = []
+ del de
+
+ # lower values = more frequent plots, but higher CPU usage
+ # self.skip_samples = 5000
+ self.skip_mode = True
+
+class constellation_plot_window (wx.Panel):
+
+ constellation_window_size = wx.DefaultSize
+ def __init__ (self, info, parent, id = -1,
+ num_plots=100,
+ pos = wx.DefaultPosition, size = constellation_window_size, name = ""):
+ wx.Panel.__init__ (self, parent, -1)
+ self.info = info
+
+ hbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ self.graph = constellation_plot_graph_window (info, self, -1, num_plots=num_plots)
+
+ hbox.Add (self.graph, 1, wx.SHAPED)
+ hbox.Add (self.make_control_box(), 0, wx.EXPAND)
+ hbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+
+ self.sizer = hbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+
+ return ctrlbox
+
+ def make_control_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0)
+
+ run_stop = wx.Button (self, 11102, "Run/Stop")
+ run_stop.SetToolTipString ("Toggle Run/Stop mode")
+ wx.EVT_BUTTON (self, 11102, self.run_stop)
+ ctrlbox.Add (run_stop, 0, wx.EXPAND)
+
+ # self.radio_box.SetToolTipString("Viewpoint Before Or After Symbol Filter")
+
+ self.radio_box_mode = wx.RadioBox(self, 11106, "Mode", style=wx.RA_SPECIFY_ROWS,
+ choices = ["Standard", "Population"] )
+ ctrlbox.Add (self.radio_box_mode, 0, wx.EXPAND)
+
+ self.radio_box_color = wx.RadioBox(self, 11107, "Color", style=wx.RA_SPECIFY_ROWS,
+ choices = ["Mono", "2 Color"] )
+ ctrlbox.Add (self.radio_box_color, 0, wx.EXPAND)
+ wx.EVT_RADIOBOX(self.radio_box_color, 11107, self.color_select)
+
+ self.radio_box_source = wx.RadioBox(self, 11108, "Source", style=wx.RA_SPECIFY_ROWS,
+ choices = ["Direct", "Differential"] )
+ ctrlbox.Add (self.radio_box_source, 0, wx.EXPAND)
+
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ return ctrlbox
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
+ def color_select(self, evt):
+ sel = self.radio_box_color.GetSelection()
+ if sel:
+ self.graph.color1 = 'red'
+ self.graph.color2 = 'green'
+ else:
+ self.graph.color1 = 'blue'
+ self.graph.color2 = 'blue'
+
+class constellation_plot_graph_window (plot.PlotCanvas):
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = (140, 140),
+ num_plots=100,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.SetXUseScopeTicks (True)
+ self.SetEnableGrid (False)
+ self.SetEnableZoom (True)
+ self.SetEnableLegend(True)
+ # self.SetBackgroundColour ('black')
+
+ self.info = info;
+ self.plot_window = parent
+
+ self.total_points = 0
+
+ self.num_plots = num_plots
+
+ EVT_DATA_EVENT (self, self.format_data)
+
+ self.input_watcher = constellation_plot_input_watcher (info.msgq, self, info.frame_decim, self.num_plots)
+
+ self.flag = False
+
+ self.color1 = 'blue'
+ self.color2 = 'blue'
+
+ def format_data (self, evt):
+ if not self.info.running:
+ return
+ if self.plot_window.radio_box_mode.GetSelection():
+ self.format_data_pop(evt)
+ else:
+ self.format_data_std(evt)
+
+ def format_data_std (self, evt):
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+ self.total_points += npoints
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ objects = []
+
+ r = records[0] # input data
+ l = len(r) / 2
+ p0 = []
+ p1 = []
+ for i in range(l):
+ p = [ r[ i*2 ], r[ i*2+1 ] ]
+ if self.flag:
+ p1.append(p)
+ else:
+ p0.append(p)
+ self.flag = not self.flag
+
+ objects.append (plot.PolyMarker (p0, marker='plus', colour=self.color1))
+ objects.append (plot.PolyMarker (p1, marker='plus', colour=self.color2))
+
+ graphics = plot.PlotGraphics (objects,
+ title='Constellation',
+ xLabel = 'I', yLabel = 'Q')
+
+ x_range = (-1.0, 1.0)
+ y_range = (-1.0, 1.0)
+ self.Draw (graphics, xAxis=x_range, yAxis=y_range)
+
+ def format_data_pop (self, evt):
+ if not self.info.running:
+ return
+
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+ self.total_points += npoints
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ objects = []
+
+ r = records[0] # input data
+ l = len(r) / 2
+ b0 = []
+ b1 = []
+ max_buckets = 6.0
+ m = int(2 * pi * max_buckets)
+ for i in range(m+1):
+ b0.append(0)
+ b1.append(0)
+ for i in range(l):
+ # p = [ r[ i*2 ], r[ i*2+1 ] ]
+ # if self.flag:
+ # p1.append(p)
+ # else:
+ # p0.append(p)
+ theta = math.atan2 ( r[ i*2 ], r[ i*2+1 ] )
+ bucket = int((theta + pi) * max_buckets)
+ if 1:
+ if self.flag:
+ b0[bucket] += 1
+ else:
+ b1[bucket] += 1
+ self.flag = not self.flag
+
+ # determine avg. "power" - for later rescaling of the values
+ tot = ct = 0
+ for b in b0+b1:
+ tot += b
+ ct += 1
+ avg = float(tot) / float(ct)
+
+ p0 = []
+ p1 = []
+ r = len(b0)
+ for i in range(r):
+ theta = ((float(i)/ r) * 2 * pi) - pi
+ abs = 0.5 * b0[i] / avg
+ p = [ abs * math.cos(theta), abs * math.sin(theta) ]
+ if i == 0:
+ sp = p
+ p0.append(p)
+ p0.append(sp)
+ r = len(b1)
+ for i in range(r):
+ theta = ((float(i) / r) * 2 * pi) - pi
+ abs = 0.5 * b1[i] / avg
+ p = [ abs * math.cos(theta), abs * math.sin(theta) ]
+ if i == 0:
+ sp = p
+ p1.append(p)
+ p1.append(sp)
+ objects.append (plot.PolyLine (p0, colour=self.color1, legend=''))
+ objects.append (plot.PolyLine (p1, colour=self.color2, legend=''))
+
+ graphics = plot.PlotGraphics (objects,
+ title='Constellation',
+ xLabel = 'I', yLabel = 'Q')
+
+ x_range = (-2.5, 2.5)
+ y_range = (-2.5, 2.5)
+ self.Draw (graphics, xAxis=x_range, yAxis=y_range)
+############################################################################
+class correlation_plot_f(gr.hier_block2):
+ def __init__(self, parent, title='', sps=10,
+ frame_decim=4,
+ num_inputs=1, **kwargs):
+
+ gr.hier_block2.__init__(self, "correlation_plot_f",
+ gr.io_signature(num_inputs, num_inputs, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2 messages
+ self.st = blocks.message_sink(gr.sizeof_float, msgq, 1)
+ self.connect((self, 0), self.st)
+
+ self.win = correlation_plot_window(correlation_plot_win_info (msgq, sps, frame_decim, None, title), parent, sps=sps)
+
+# ========================================================================
+
+wxDATA_EVENT = wx.NewEventType()
+
+def EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, wxDATA_EVENT, func)
+
+class correlation_plot_DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+class correlation_plot_win_info (object):
+ __slots__ = ['msgq', 'sps', 'frame_decim',
+ 'scopesink', 'title',
+ 'time_scale_cursor', 'marker', 'xy',
+ 'autorange', 'running']
+
+ def __init__ (self, msgq, sps, frame_decim,
+ scopesink, title = "Oscilloscope", xy=True):
+ self.msgq = msgq
+ self.sps = sps
+ self.frame_decim = frame_decim
+ self.scopesink = scopesink
+ self.title = title;
+
+ self.marker = 'line'
+ self.xy = xy
+ self.autorange = False
+ self.running = True
+
+ def get_decimation_rate (self):
+ return 1.0
+
+ def set_marker (self, s):
+ self.marker = s
+
+ def get_marker (self):
+ return self.marker
+
+class correlation_plot_input_watcher (threading.Thread):
+ def __init__ (self, msgq, event_receiver, frame_decim, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.event_receiver = event_receiver
+ self.frame_decim = frame_decim
+ self.iscan = 0
+ self.keep_running = True
+ self.skip = 0
+ self.totsamp = 0
+ self.skip_samples = 0
+ self.start ()
+ self.msg_string = ""
+ self.skip_mode = False
+
+ def run (self):
+ # print "correlation_plot_input_watcher: pid = ", os.getpid ()
+ time.sleep(1)
+ while (self.keep_running):
+ bytes_needed = 24000 * gr.sizeof_float
+
+ if len(self.msg_string) < bytes_needed:
+ msg = self.msgq.delete_head() # blocking read of message queue
+ nchan = int(msg.arg1()) # number of channels of data in msg
+ nsamples = int(msg.arg2()) # number of samples in each channel
+ self.totsamp += nsamples
+
+ self.msg_string += msg.to_string() # body of the msg as a string
+ continue
+
+ chan_data = self.msg_string[:bytes_needed]
+ self.msg_string = self.msg_string[bytes_needed:]
+
+# if self.skip_mode:
+# self.skip_mode = False
+# continue
+
+ records = []
+ # start = self.skip * gr.sizeof_gr_complex
+ # start = 0
+ # chan_data = self.msg_string[start:start+bytes_needed]
+ rec = numpy.fromstring (chan_data, numpy.float32)
+ records.append (rec)
+ # self.msg_string = ""
+
+ # unused = nsamples - self.num_plots
+ # unused -= (start/gr.sizeof_gr_complex)
+ # print "reclen = %d totsamp %d appended %d skip %d start %d unused %d" % (nsamples, self.totsamp, len(rec), self.skip, start/gr.sizeof_float, unused)
+
+ de = correlation_plot_DataEvent (records)
+ wx.PostEvent (self.event_receiver, de)
+ records = []
+ del de
+
+ # lower values = more frequent plots, but higher CPU usage
+ # self.skip_samples = 5000
+# self.skip_mode = True
+
+class correlation_plot_window (wx.Panel):
+
+ def __init__ (self, info, parent, id = -1,
+ sps=10,
+ pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
+ wx.Panel.__init__ (self, parent, -1)
+ self.info = info
+
+ vbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ self.graph = correlation_plot_graph_window (info, self, -1, sps=sps)
+
+ vbox.Add (self.graph, 1, wx.EXPAND)
+ vbox.Add (self.make_control_box(), 0, wx.EXPAND)
+# vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+
+ self.sizer = vbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+
+ return ctrlbox
+
+ def make_control_box (self):
+ # 48k iden sync sig
+ iden_frame_sync = [0.131053, 0.762875, 0.985880, 0.692932, 0.021247, -0.509172, -0.436476, 0.121728, 0.574703, 0.545912, 0.008813, -0.676659, -0.920639, -0.490609, 0.182287, 0.632788, 0.737212, 0.681760, 0.737237, 0.937172, 1.009479, 0.794382, 0.339788, 0.026356, 0.178487, 0.627079, 0.902744, 0.742624, 0.165377, -0.442614, -0.691702, -0.454418, -0.135002]
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ ctrlbox.Add ((5,0) ,0)
+
+ # read directory of correlation signatures
+ ents = []
+ self.signatures = []
+ r = re.compile(r'^[13]+$')
+ path = "corr"
+ # another hack, add support for 6000 symbol rate in correlation sigs
+ sps_6k = int((self.info.sps * 4800) / 6000)
+ for fn in os.listdir(path):
+ sps = self.info.sps
+ fn_check = fn
+ if fn.endswith("-6k"):
+ sps = sps_6k
+ fn_check = fn_check.replace("-6k", "")
+ if not r.match(fn_check):
+ continue
+ f = open("%s/%s" % (path, fn))
+ line = f.readline()
+ f.close()
+ ents.append(line.strip())
+
+ frame_sync = []
+ for c in fn:
+ if c == '1':
+ frame_sync.append(1)
+ else: # 3
+ frame_sync.append(-1)
+ correlation = []
+ for symbol in frame_sync:
+ for i in xrange(sps):
+ correlation.append(symbol)
+ correlation.reverse() # reverse order for convolve()
+ self.signatures.append(correlation)
+
+ #special final entry for iden
+ ents.append('iDEN')
+ correlation = iden_frame_sync
+ correlation.reverse() # reverse order for convolve()
+ self.signatures.append(correlation)
+
+ self.radio_box_corr = wx.RadioBox(self, 11105, "Sync Signature", style=wx.RA_SPECIFY_COLS,
+ majorDimension=2, choices = ents )
+ self.radio_box_corr.SetToolTipString("Signatures of Known Signal Types")
+
+ ctrlbox.Add (self.radio_box_corr, 0, wx.EXPAND)
+
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ return ctrlbox
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
+class correlation_plot_graph_window (plot.PlotCanvas):
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = (140, 140),
+ sps=10,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.SetXUseScopeTicks (True)
+ self.SetEnableGrid (False)
+ self.SetEnableZoom (True)
+ self.SetEnableLegend(True)
+ # self.SetBackgroundColour ('black')
+# self.Zoom([0, 0], [1.0, 1.0])
+
+ self.info = info;
+ self.parent = parent;
+
+ self.total_points = 0
+
+ EVT_DATA_EVENT (self, self.format_data)
+
+ self.input_watcher = correlation_plot_input_watcher (info.msgq, self, info.frame_decim)
+
+ def format_data (self, evt):
+ if not self.info.running:
+ return
+
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+ self.total_points += npoints
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ objects = []
+
+ r = records[0] # input data
+
+ sig = self.parent.signatures[self.parent.radio_box_corr.GetSelection()]
+ res = numpy.convolve(r, sig, mode='valid')
+ p0 = []
+ i = 0
+ for p in res:
+ p0.append([i, p])
+ i += 1
+
+ objects.append (plot.PolyLine (p0, colour='blue'))
+
+ graphics = plot.PlotGraphics (objects,
+ title='Correlation',
+ xLabel = '', yLabel = '')
+
+ x_range = (0, len(res))
+ y_range = (-800.0, 800.0)
+ self.Draw (graphics, xAxis=x_range, yAxis=y_range)
+
+#
+# following code copied from radiorausch file facsink.py
+# source: http://sites.google.com/site/radiorausch/
+#
+# KA1RBI modified Jul. 2011 to current GR (to fix error messages)
+#
+# Copyright 2003,2004,2005,2006 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.
+#
+
+# default_facsink_size = (640,240)
+default_facsink_size = wx.DefaultSize
+default_fac_rate = gr.prefs().get_long('wxgui', 'fac_rate', 3) # was 15
+
+class fac_sink_base(object):
+ def __init__(self, input_is_real=False, baseband_freq=0, y_per_div=10, ref_level=50,
+ sample_rate=1, fac_size=512,
+ fac_rate=default_fac_rate,
+ average=False, avg_alpha=None, title='', peak_hold=False):
+
+ # initialize common attributes
+ self.baseband_freq = baseband_freq
+ self.y_divs = 8
+ self.y_per_div=y_per_div
+ self.ref_level = ref_level
+ self.sample_rate = sample_rate
+ self.fac_size = fac_size
+ self.fac_rate = fac_rate
+ self.average = average
+ if avg_alpha is None:
+ self.avg_alpha = 0.20 / fac_rate # averaging needed to be slowed down for very slow rates
+ else:
+ self.avg_alpha = avg_alpha
+ self.title = title
+ self.peak_hold = peak_hold
+ self.input_is_real = input_is_real
+ self.msgq = gr.msg_queue(2) # queue that holds a maximum of 2 messages
+
+ def set_y_per_div(self, y_per_div):
+ self.y_per_div = y_per_div
+
+ def set_ref_level(self, ref_level):
+ self.ref_level = ref_level
+
+ def set_average(self, average):
+ self.average = average
+ if average:
+ self.avg.set_taps(self.avg_alpha)
+ self.set_peak_hold(False)
+ else:
+ self.avg.set_taps(1.0)
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ if enable:
+ self.set_average(False)
+ self.win.set_peak_hold(enable)
+
+ def set_avg_alpha(self, avg_alpha):
+ self.avg_alpha = avg_alpha
+
+ def set_baseband_freq(self, baseband_freq):
+ self.baseband_freq = baseband_freq
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self._set_n()
+
+ def _set_n(self):
+ self.one_in_n.set_n(max(1, int(self.sample_rate/self.fac_size/self.fac_rate)))
+
+
+class fac_sink_f(gr.hier_block2, fac_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=50, sample_rate=1, fac_size=512,
+ fac_rate=default_fac_rate,
+ average=False, avg_alpha=None,
+ title='', size=default_facsink_size, peak_hold=False):
+
+ fac_sink_base.__init__(self, input_is_real=True, baseband_freq=baseband_freq,
+ y_per_div=y_per_div, ref_level=ref_level,
+ sample_rate=sample_rate, fac_size=fac_size,
+ fac_rate=fac_rate,
+ average=average, avg_alpha=avg_alpha, title=title,
+ peak_hold=peak_hold)
+
+ s2p = gr.stream_to_vector(gr.sizeof_float, self.fac_size)
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fac_size,
+ max(1, int(self.sample_rate/self.fac_size/self.fac_rate)))
+
+
+ # windowing removed...
+
+ fac = gr.fft_vfc(self.fac_size, True, ())
+
+ c2mag = gr.complex_to_mag(self.fac_size)
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fac_size)
+
+ #
+ fac_fac = gr.fft_vfc(self.fac_size, True, ())
+ fac_c2mag = gr.complex_to_mag(fac_size)
+
+
+ # FIXME We need to add 3dB to all bins but the DC bin
+ log = gr.nlog10_ff(20, self.fac_size,
+ -20*math.log10(self.fac_size) )
+ sink = gr.message_sink(gr.sizeof_float * self.fac_size, self.msgq, True)
+
+ self.connect(self, s2p, self.one_in_n, fac, c2mag, fac_fac, fac_c2mag, self.avg, log, sink)
+ # gr.hier_block.__init__(self, fg, s2p, sink)
+ gr.hier_block2.__init__(self, "fac_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0, 0, 0))
+
+ self.win = fac_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+
+class fac_sink_c(gr.hier_block2, fac_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=90, sample_rate=1, fac_size=512,
+ fac_rate=default_fac_rate,
+ average=False, avg_alpha=None,
+ title='', size=default_facsink_size, peak_hold=False):
+
+ fac_sink_base.__init__(self, input_is_real=False, baseband_freq=baseband_freq,
+ y_per_div=y_per_div, ref_level=ref_level,
+ sample_rate=sample_rate, fac_size=fac_size,
+ fac_rate=fac_rate,
+ average=average, avg_alpha=avg_alpha, title=title,
+ peak_hold=peak_hold)
+ gr.hier_block2.__init__(self, "fac_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0))
+
+ s2p = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fac_size)
+ #s2p = repeater.s2v(gr.sizeof_gr_complex, self.fac_size)
+ self.one_in_n = blocks.keep_one_in_n(gr.sizeof_gr_complex * self.fac_size,
+ max(1, int(self.sample_rate/self.fac_size/self.fac_rate)))
+
+
+ # windowing removed ...
+
+ fac = fft.fft_vcc(self.fac_size, True, ())
+ c2mag = blocks.complex_to_mag(fac_size)
+
+ # Things go off into the weeds if we try for an inverse FFT so a forward FFT will have to do...
+ fac_fac = fft.fft_vfc(self.fac_size, True, ())
+ fac_c2mag = blocks.complex_to_mag(fac_size)
+
+
+ self.avg = filter.single_pole_iir_filter_ff(1.0, fac_size)
+
+ log = blocks.nlog10_ff(20, self.fac_size,
+ -20*math.log10(self.fac_size) ) # - 20*math.log10(norm) ) # - self.avg[0] )
+ sink = blocks.message_sink(gr.sizeof_float * fac_size, self.msgq, True)
+
+ self.connect(self, s2p, self.one_in_n, fac, c2mag, fac_fac, fac_c2mag, self.avg)
+ self.connect(self.avg, log, sink)
+
+ # gr.hier_block.__init__(self, fg, s2p, sink)
+
+ self.win = fac_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+# ------------------------------------------------------------------------
+
+fac_myDATA_EVENT = wx.NewEventType()
+fac_EVT_DATA_EVENT = wx.PyEventBinder (fac_myDATA_EVENT, 0)
+
+
+class fac_DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (fac_myDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class fac_input_watcher (threading.Thread):
+ def __init__ (self, msgq, fac_size, event_receiver, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.fac_size = fac_size
+ self.event_receiver = event_receiver
+ self.keep_running = True
+ self.start ()
+
+ def run (self):
+ while (self.keep_running):
+ msg = self.msgq.delete_head() # blocking read of message queue
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+
+ s = msg.to_string() # get the body of the msg as a string
+
+ # There may be more than one fac frame in the message.
+ # If so, we take only the last one
+ if nitems > 1:
+ start = itemsize * (nitems - 1)
+ s = s[start:start+itemsize]
+
+ complex_data = Numeric.fromstring (s, Numeric.Float32)
+ de = fac_DataEvent (complex_data)
+ wx.PostEvent (self.event_receiver, de)
+ del de
+
+
+class fac_window (plot.PlotCanvas):
+ def __init__ (self, facsink, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.y_range = None
+ self.facsink = facsink
+ self.peak_hold = False
+ self.peak_vals = None
+
+ self.SetEnableGrid (True)
+ # self.SetEnableZoom (True)
+ # self.SetBackgroundColour ('black')
+
+ self.build_popup_menu()
+
+ fac_EVT_DATA_EVENT (self, self.set_data)
+ wx.EVT_CLOSE (self, self.on_close_window)
+ self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+
+ self.input_watcher = fac_input_watcher(facsink.msgq, facsink.fac_size, self)
+
+
+ def on_close_window (self, event):
+ print "fac_window:on_close_window"
+ self.keep_running = False
+
+
+ def set_data (self, evt):
+ dB = evt.data
+ L = len (dB)
+
+ if self.peak_hold:
+ if self.peak_vals is None:
+ self.peak_vals = dB
+ else:
+ self.peak_vals = Numeric.maximum(dB, self.peak_vals)
+ dB = self.peak_vals
+
+ x = max(abs(self.facsink.sample_rate), abs(self.facsink.baseband_freq))
+ sf = 1000.0
+ units = "ms"
+
+ x_vals = ((Numeric.arrayrange (L/2)
+ * ( (sf / self.facsink.sample_rate ) )) )
+ points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points[:,0] = x_vals
+ points[:,1] = dB[0:L/2]
+
+
+ lines = plot.PolyLine (points, colour='DARKRED')
+
+
+ graphics = plot.PlotGraphics ([lines],
+ title=self.facsink.title,
+ xLabel = units, yLabel = "dB")
+
+ self.Draw (graphics, xAxis=None, yAxis=self.y_range)
+ self.update_y_range ()
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ self.peak_vals = None
+
+ def update_y_range (self):
+ ymax = self.facsink.ref_level
+ ymin = self.facsink.ref_level - self.facsink.y_per_div * self.facsink.y_divs
+ self.y_range = self._axisInterval ('min', ymin, ymax)
+
+ def on_average(self, evt):
+ # print "on_average"
+ self.facsink.set_average(evt.IsChecked())
+
+ def on_peak_hold(self, evt):
+ # print "on_peak_hold"
+ self.facsink.set_peak_hold(evt.IsChecked())
+
+ def on_incr_ref_level(self, evt):
+ # print "on_incr_ref_level"
+ self.facsink.set_ref_level(self.facsink.ref_level
+ + self.facsink.y_per_div)
+
+ def on_decr_ref_level(self, evt):
+ # print "on_decr_ref_level"
+ self.facsink.set_ref_level(self.facsink.ref_level
+ - self.facsink.y_per_div)
+
+ def on_incr_y_per_div(self, evt):
+ # print "on_incr_y_per_div"
+ self.facsink.set_y_per_div(next_up(self.facsink.y_per_div, (1,2,5,10,20)))
+
+ def on_decr_y_per_div(self, evt):
+ # print "on_decr_y_per_div"
+ self.facsink.set_y_per_div(next_down(self.facsink.y_per_div, (1,2,5,10,20)))
+
+ def on_y_per_div(self, evt):
+ # print "on_y_per_div"
+ Id = evt.GetId()
+ if Id == self.id_y_per_div_1:
+ self.facsink.set_y_per_div(1)
+ elif Id == self.id_y_per_div_2:
+ self.facsink.set_y_per_div(2)
+ elif Id == self.id_y_per_div_5:
+ self.facsink.set_y_per_div(5)
+ elif Id == self.id_y_per_div_10:
+ self.facsink.set_y_per_div(10)
+ elif Id == self.id_y_per_div_20:
+ self.facsink.set_y_per_div(20)
+
+
+ def on_right_click(self, event):
+ menu = self.popup_menu
+ for id, pred in self.checkmarks.items():
+ item = menu.FindItemById(id)
+ item.Check(pred())
+ self.PopupMenu(menu, event.GetPosition())
+
+
+ def build_popup_menu(self):
+ self.id_incr_ref_level = wx.NewId()
+ self.id_decr_ref_level = wx.NewId()
+ self.id_incr_y_per_div = wx.NewId()
+ self.id_decr_y_per_div = wx.NewId()
+ self.id_y_per_div_1 = wx.NewId()
+ self.id_y_per_div_2 = wx.NewId()
+ self.id_y_per_div_5 = wx.NewId()
+ self.id_y_per_div_10 = wx.NewId()
+ self.id_y_per_div_20 = wx.NewId()
+ self.id_average = wx.NewId()
+ self.id_peak_hold = wx.NewId()
+
+ self.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+ self.Bind(wx.EVT_MENU, self.on_peak_hold, id=self.id_peak_hold)
+ self.Bind(wx.EVT_MENU, self.on_incr_ref_level, id=self.id_incr_ref_level)
+ self.Bind(wx.EVT_MENU, self.on_decr_ref_level, id=self.id_decr_ref_level)
+ self.Bind(wx.EVT_MENU, self.on_incr_y_per_div, id=self.id_incr_y_per_div)
+ self.Bind(wx.EVT_MENU, self.on_decr_y_per_div, id=self.id_decr_y_per_div)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_1)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_2)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_5)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_10)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_20)
+
+
+ # make a menu
+ menu = wx.Menu()
+ self.popup_menu = menu
+ menu.AppendCheckItem(self.id_average, "Average")
+ menu.AppendCheckItem(self.id_peak_hold, "Peak Hold")
+ menu.Append(self.id_incr_ref_level, "Incr Ref Level")
+ menu.Append(self.id_decr_ref_level, "Decr Ref Level")
+ # menu.Append(self.id_incr_y_per_div, "Incr dB/div")
+ # menu.Append(self.id_decr_y_per_div, "Decr dB/div")
+ menu.AppendSeparator()
+ # we'd use RadioItems for these, but they're not supported on Mac
+ menu.AppendCheckItem(self.id_y_per_div_1, "1 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_2, "2 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_5, "5 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_10, "10 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_20, "20 dB/div")
+
+ self.checkmarks = {
+ self.id_average : lambda : self.facsink.average,
+ self.id_peak_hold : lambda : self.facsink.peak_hold,
+ self.id_y_per_div_1 : lambda : self.facsink.y_per_div == 1,
+ self.id_y_per_div_2 : lambda : self.facsink.y_per_div == 2,
+ self.id_y_per_div_5 : lambda : self.facsink.y_per_div == 5,
+ self.id_y_per_div_10 : lambda : self.facsink.y_per_div == 10,
+ self.id_y_per_div_20 : lambda : self.facsink.y_per_div == 20,
+ }
+
+
+def next_up(v, seq):
+ """
+ Return the first item in seq that is > v.
+ """
+ for s in seq:
+ if s > v:
+ return s
+ return v
+
+def next_down(v, seq):
+ """
+ Return the last item in seq that is < v.
+ """
+ rseq = list(seq[:])
+ rseq.reverse()
+
+ for s in rseq:
+ if s < v:
+ return s
+ return v
+
+
+# ----------------------------------------------------------------
+# Deprecated interfaces
+# ----------------------------------------------------------------
+
+# returns (block, win).
+# block requires a single input stream of float
+# win is a subclass of wxWindow
+
+def make_fac_sink_f(fg, parent, title, fac_size, input_rate, ymin = 0, ymax=50):
+
+ block = fac_sink_f(fg, parent, title=title, fac_size=fac_size, sample_rate=input_rate,
+ y_per_div=(ymax - ymin)/8, ref_level=ymax)
+ return (block, block.win)
+
+# returns (block, win).
+# block requires a single input stream of gr_complex
+# win is a subclass of wxWindow
+
+def make_fac_sink_c(fg, parent, title, fac_size, input_rate, ymin=0, ymax=50):
+ block = fac_sink_c(fg, parent, title=title, fac_size=fac_size, sample_rate=input_rate,
+ y_per_div=(ymax - ymin)/8, ref_level=ymax)
+ return (block, block.win)
+
+
+# ----------------------------------------------------------------
+# Standalone test app - deleted
+# ----------------------------------------------------------------
+
+
+############################################################################
+
+# Start the receiver
+#
+if '__main__' == __name__:
+ app = stdgui2.stdapp(p25_rx_block, "APCO P25 Receiver", 3)
+ app.MainLoop()
diff --git a/op25/gr-op25_repeater/apps/tdma/bit_utils.py b/op25/gr-op25_repeater/apps/tdma/bit_utils.py
new file mode 100644
index 0000000..df667dd
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/bit_utils.py
@@ -0,0 +1,84 @@
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import numpy as np
+
+def rev_int(n,l):
+ j=0
+ for i in xrange(l):
+ b=n&1
+ n=n>>1
+ j = (j << 1) | b
+ return j
+
+def bits_to_dibits(bits):
+ d = []
+ for i in xrange(len(bits)>>1):
+ d.append((bits[i*2]<<1) + bits[i*2+1])
+ return d
+
+def dibits_to_bits(dibits):
+ b = []
+ for d in dibits:
+ b.append((d>>1)&1)
+ b.append(d&1)
+ return b
+
+def mk_array(n, l):
+ a = []
+ for i in xrange(0,l):
+ a.insert(0, n & 1)
+ n = n >> 1
+ return np.array(a)
+
+def mk_int(a):
+ res= 0L
+ for i in xrange(0, len(a)):
+ res = res * 2
+ res = res + (a[i] & 1)
+ return res
+
+def mk_str(a):
+ return ''.join(['%s' % (x&1) for x in a])
+
+def check_l(a,b):
+ ans = 0
+ assert len(a) == len(b)
+ for i in xrange(len(a)):
+ if (a[i] == b[i]):
+ ans += 1
+ return ans
+
+def fixup(a):
+ res = []
+ for c in a:
+ if c == 3:
+ res.append(1)
+ else: # -3
+ res.append(3)
+
+ return res
+
+def find_sym(pattern, symbols):
+ for i in xrange(0, len(symbols)-len(pattern)):
+ chunk = symbols[i : i + len(pattern)]
+ if chunk == pattern:
+ return i
+ return -1
diff --git a/op25/gr-op25_repeater/apps/tdma/duid.py b/op25/gr-op25_repeater/apps/tdma/duid.py
new file mode 100644
index 0000000..0468e1c
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/duid.py
@@ -0,0 +1,53 @@
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import numpy as np
+from bit_utils import *
+
+duid_str = {}
+duid_str[0] = "4v"
+duid_str[3] = "sacch w"
+duid_str[6] = "2v"
+duid_str[9] = "facch w"
+duid_str[12] = "sacch w/o"
+duid_str[15] = "facch w/o"
+
+duid_map = {}
+def mk_duid_lookup():
+ g = np.array(np.mat('1 0 0 0 1 1 0 1; 0 1 0 0 1 0 1 1; 0 0 1 0 1 1 1 0; 0 0 0 1 0 1 1 1'))
+ for i in xrange(16):
+ codeword = mk_str(np.dot(mk_array(i, 4), g))
+ duid_map[codeword] = i
+
+def extract_duid(b):
+ duid0 = b[10] # duid 3,2
+ duid1 = b[47] # duid 1,0
+ duid2 = b[132] # par 3,2
+ duid3 = b[169] # par 1,0
+ v = (duid0 << 6) + (duid1 << 4) + (duid2 << 2) + duid3
+ va = mk_array(v, 8)
+ return mk_str(va)
+
+def decode_duid(burst):
+ try:
+ b = duid_str[duid_map[extract_duid(burst)]]
+ except: # FIXME: find closest matching codeword
+ b = 'unknown' + extract_duid(burst)
+ return b
diff --git a/op25/gr-op25_repeater/apps/tdma/isch.py b/op25/gr-op25_repeater/apps/tdma/isch.py
new file mode 100644
index 0000000..6a6a4c0
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/isch.py
@@ -0,0 +1,56 @@
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import numpy as np
+from bit_utils import *
+
+isch_map = {}
+
+def mk_isch_lookup():
+ g = np.array(np.mat('1 0 0 0 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1; 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 0 0; 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 1 0 0 0; 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 1 0; 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1; 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0; 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1; 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0; 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 1 1 1'))
+ c0 = 0x184229d461L
+ for i in xrange(0, 2**7):
+ codeword = mk_int(np.dot(mk_array(i, 9), g)) ^ c0
+ isch_map['%x' % codeword] = i
+
+def mk_isch(v):
+ v1 = v & 3
+ v = v >> 2
+ v2 = v & 1
+ v = v >> 1
+ v3 = v & 3
+ v = v >> 2
+ v4 = v & 3
+ v = v >> 2
+ v5 = v & 3
+ return v4, v3, v2, v1
+
+def decode_isch(syms):
+ sync0 = 0x575d57f7ff
+ v = mk_int(dibits_to_bits(syms))
+ vp = '%x' % v
+ isch = 'unknown'
+ if v == sync0:
+ return -2, -2, -2, -2
+ if vp in isch_map:
+ chn,loc,fr,cnt = mk_isch(isch_map[vp])
+ return chn, loc, fr, cnt
+ # FIXME: if bit error(s), locate closest matching codeword
+ return -1, -1, -1, -1
diff --git a/op25/gr-op25_repeater/apps/tdma/lfsr.py b/op25/gr-op25_repeater/apps/tdma/lfsr.py
new file mode 100644
index 0000000..c9b06f6
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/lfsr.py
@@ -0,0 +1,87 @@
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import numpy as np
+from bit_utils import *
+
+def mk_xor(nac,sysid,wacn):
+ xorbits = mk_xor_bits(nac,sysid,wacn)
+ xorsyms = [0] * (len(xorbits)/2)
+ for i in xrange(len(xorsyms)):
+ xorsyms[i] = (xorbits[i*2] << 1) + xorbits[i*2+1]
+ return xorsyms
+
+def asm_reg(s1,s2,s3,s4,s5,s6):
+ s1 = s1 & 0xfL
+ s2 = s2 & 0x1fL
+ s3 = s3 & 0x3fL
+ s4 = s4 & 0x1fL
+ s5 = s5 & 0x3fffL
+ s6 = s6 & 0x3ffL
+ return (s1<<40)+(s2<<35)+(s3<<29)+(s4<<24)+(s5<<10)+s6
+
+def disasm_reg(r):
+ s1 = (r>>40) & 0xfL
+ s2 = (r>>35) & 0x1fL
+ s3 = (r>>29) & 0x3fL
+ s4 = (r>>24) & 0x1fL
+ s5 = (r>>10) & 0x3fffL
+ s6 = r & 0x3ffL
+ return s1,s2,s3,s4,s5,s6
+
+def cyc_reg(reg):
+ s1,s2,s3,s4,s5,s6 = disasm_reg(reg)
+ cy1 = (s1 >> 3) & 1L
+ cy2 = (s2 >> 4) & 1L
+ cy3 = (s3 >> 5) & 1L
+ cy4 = (s4 >> 4) & 1L
+ cy5 = (s5 >> 13) & 1L
+ cy6 = (s6 >> 9) & 1L
+ x1 = cy1 ^ cy2
+ x2 = cy1 ^ cy3
+ x3 = cy1 ^ cy4
+ x4 = cy1 ^ cy5
+ x5 = cy1 ^ cy6
+ s1 = (s1 << 1) & 0xfL
+ s2 = (s2 << 1) & 0x1fL
+ s3 = (s3 << 1) & 0x3fL
+ s4 = (s4 << 1) & 0x1fL
+ s5 = (s5 << 1) & 0x3fffL
+ s6 = (s6 << 1) & 0x3ffL
+ s1 = s1 | (x1 & 1L)
+ s2 = s2 | (x2 & 1L)
+ s3 = s3 | (x3 & 1L)
+ s4 = s4 | (x4 & 1L)
+ s5 = s5 | (x5 & 1L)
+ s6 = s6 | (cy1 & 1L)
+ return asm_reg(s1,s2,s3,s4,s5,s6)
+
+def mk_xor_bits(nac,sysid,wacn):
+ reg = mk_array(16777216*wacn + 4096*sysid + nac, 44)
+
+ M = np.array(np.mat('1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0; 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1'))
+ reg = mk_int(np.dot(reg,M))
+
+ s = []
+ for i in xrange(4320):
+ s.append((reg >> 43) & 1)
+ reg = cyc_reg(reg)
+
+ return s
diff --git a/op25/gr-op25_repeater/apps/tdma/rs.py b/op25/gr-op25_repeater/apps/tdma/rs.py
new file mode 100644
index 0000000..55438d1
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/rs.py
@@ -0,0 +1,154 @@
+
+gly23127DecTbl = [
+ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 147459,
+ 1, 2, 2, 3, 2, 3, 3, 4268035, 2, 3, 3, 1574915, 3, 2097155, 294915, 4099,
+ 1, 2, 2, 3, 2, 3, 3, 147459, 2, 3, 3, 147459, 3, 147459, 147459, 147458,
+ 2, 3, 3, 32771, 3, 2051, 3149827, 786435, 3, 274435, 4194307, 2162691, 589827, 5275651, 10243, 147459,
+ 1, 2, 2, 3, 2, 3, 3, 2621443, 2, 3, 3, 8195, 3, 1118211, 294915, 4196355,
+ 2, 3, 3, 135171, 3, 2051, 294915, 1064963, 3, 4210691, 294915, 2162691, 294915, 663555, 294914, 294915,
+ 2, 3, 3, 5505027, 3, 2051, 65539, 45059, 3, 557059, 6147, 2162691, 6299651, 262147, 1572867, 147459,
+ 3, 2051, 548867, 2162691, 2051, 2050, 4325379, 2051, 1179651, 2162691, 2162691, 2162690, 20483, 2051, 294915, 2162691,
+ 1, 2, 2, 3, 2, 3, 3, 2621443, 2, 3, 3, 327683, 3, 43011, 5242883, 4099,
+ 2, 3, 3, 32771, 3, 1441795, 18435, 4099, 3, 4210691, 2236419, 4099, 589827, 4099, 4099, 4098,
+ 2, 3, 3, 32771, 3, 4198403, 270339, 1116163, 3, 3145731, 6147, 4726787, 589827, 262147, 2129923, 147459,
+ 3, 32771, 32771, 32770, 589827, 2121731, 4325379, 32771, 589827, 133123, 1327107, 32771, 589826, 589827, 589827, 4099,
+ 2, 3, 3, 2621443, 3, 2621443, 2621443, 2621442, 3, 4210691, 6147, 1212419, 131075, 262147, 90115, 2621443,
+ 3, 4210691, 1114115, 272387, 12291, 98307, 4325379, 2621443, 4210691, 4210690, 524291, 4210691, 3147779, 4210691, 294915, 4099,
+ 3, 204803, 6147, 16387, 1097731, 262147, 4325379, 2621443, 6147, 262147, 6146, 6147, 262147, 262146, 6147, 262147,
+ 2359299, 1576963, 4325379, 32771, 4325379, 2051, 4325378, 4325379, 40963, 4210691, 6147, 2162691, 589827, 262147, 4325379, 1056771,
+ 1, 2, 2, 3, 2, 3, 3, 268291, 2, 3, 3, 8195, 3, 2097155, 5242883, 622595,
+ 2, 3, 3, 32771, 3, 2097155, 655363, 1064963, 3, 2097155, 86019, 4587523, 2097155, 2097154, 10243, 2097155,
+ 2, 3, 3, 32771, 3, 1581059, 65539, 6291459, 3, 4261891, 2883587, 1052675, 36867, 262147, 10243, 147459,
+ 3, 32771, 32771, 32770, 4472835, 200707, 10243, 32771, 1179651, 540675, 10243, 32771, 10243, 2097155, 10242, 10243,
+ 2, 3, 3, 8195, 3, 4358147, 65539, 1064963, 3, 8195, 8195, 8194, 542723, 262147, 2232323, 8195,
+ 3, 851971, 6293507, 1064963, 12291, 1064963, 1064963, 1064962, 1179651, 38915, 524291, 8195, 4259843, 2097155, 294915, 1064963,
+ 3, 2117635, 65539, 657411, 65539, 262147, 65538, 65539, 1179651, 262147, 4243459, 8195, 262147, 262146, 65539, 262147,
+ 1179651, 4202499, 266243, 32771, 2654211, 2051, 65539, 1064963, 1179650, 1179651, 1179651, 2162691, 1179651, 262147, 10243, 4722691,
+ 2, 3, 3, 32771, 3, 81923, 5242883, 139267, 3, 659459, 5242883, 2115587, 5242883, 262147, 5242882, 5242883,
+ 3, 32771, 32771, 32770, 12291, 4720643, 2424835, 32771, 264195, 1122307, 524291, 32771, 180227, 2097155, 5242883, 4099,
+ 3, 32771, 32771, 32770, 2230275, 262147, 544771, 32771, 24579, 262147, 196611, 32771, 262147, 262146, 5242883, 262147,
+ 32771, 32770, 32770, 32769, 1048579, 32771, 32771, 32770, 6295555, 32771, 32771, 32770, 589827, 262147, 10243, 32771,
+ 3, 1050627, 409603, 4263939, 12291, 262147, 34819, 2621443, 2195459, 262147, 524291, 8195, 262147, 262146, 5242883, 262147,
+ 12291, 2228227, 524291, 32771, 12290, 12291, 12291, 1064963, 524291, 4210691, 524290, 524291, 12291, 262147, 524291, 198659,
+ 4718595, 262147, 3153923, 32771, 262147, 262146, 65539, 262147, 262147, 262146, 6147, 262147, 262146, 262145, 262147, 262146,
+ 83971, 32771, 32771, 32770, 12291, 262147, 4325379, 32771, 1179651, 262147, 524291, 32771, 262147, 262146, 2113539, 262147,
+ 1, 2, 2, 3, 2, 3, 3, 1081347, 2, 3, 3, 327683, 3, 2097155, 536579, 4196355,
+ 2, 3, 3, 135171, 3, 2097155, 18435, 786435, 3, 2097155, 4194307, 57347, 2097155, 2097154, 1245187, 2097155,
+ 2, 3, 3, 2107395, 3, 4198403, 65539, 786435, 3, 557059, 4194307, 1052675, 1312771, 73731, 2129923, 147459,
+ 3, 1130499, 4194307, 786435, 172035, 786435, 786435, 786434, 4194307, 133123, 4194306, 4194307, 20483, 2097155, 4194307, 786435,
+ 2, 3, 3, 135171, 3, 286723, 65539, 4196355, 3, 557059, 3162115, 4196355, 131075, 4196355, 4196355, 4196354,
+ 3, 135171, 135171, 135170, 5767171, 98307, 2105347, 135171, 75779, 1310723, 524291, 135171, 20483, 2097155, 294915, 4196355,
+ 3, 557059, 65539, 16387, 65539, 3276803, 65538, 65539, 557059, 557058, 401411, 557059, 20483, 557059, 65539, 4196355,
+ 2359299, 4202499, 1083395, 135171, 20483, 2051, 65539, 786435, 20483, 557059, 4194307, 2162691, 20482, 20483, 20483, 1056771,
+ 2, 3, 3, 327683, 3, 4198403, 18435, 139267, 3, 327683, 327683, 327682, 131075, 1589251, 2129923, 327683,
+ 3, 532483, 18435, 7340035, 18435, 98307, 18434, 18435, 1085443, 133123, 524291, 327683, 4464643, 2097155, 18435, 4099,
+ 3, 4198403, 1703939, 16387, 4198403, 4198402, 2129923, 4198403, 24579, 133123, 2129923, 327683, 2129923, 4198403, 2129922, 2129923,
+ 2359299, 133123, 77827, 32771, 1048579, 4198403, 18435, 786435, 133123, 133122, 4194307, 133123, 589827, 133123, 2129923, 1056771,
+ 3, 1050627, 4235267, 16387, 131075, 98307, 1314819, 2621443, 131075, 2109443, 524291, 327683, 131074, 131075, 131075, 4196355,
+ 2359299, 98307, 524291, 135171, 98307, 98306, 18435, 98307, 524291, 4210691, 524290, 524291, 131075, 98307, 524291, 1056771,
+ 2359299, 16387, 16387, 16386, 534531, 4198403, 65539, 16387, 5308419, 557059, 6147, 16387, 131075, 262147, 2129923, 1056771,
+ 2359298, 2359299, 2359299, 16387, 2359299, 98307, 4325379, 1056771, 2359299, 133123, 524291, 1056771, 20483, 1056771, 1056771, 1056770,
+ 2, 3, 3, 4734979, 3, 2097155, 65539, 139267, 3, 2097155, 165891, 1052675, 2097155, 2097154, 278531, 2097155,
+ 3, 2097155, 1318915, 67587, 2097155, 2097154, 4231171, 2097155, 2097155, 2097154, 524291, 2097155, 2097154, 2097153, 2097155, 2097154,
+ 3, 393219, 65539, 1052675, 65539, 51203, 65538, 65539, 24579, 1052675, 1052675, 1052674, 4849667, 2097155, 65539, 1052675,
+ 530435, 4202499, 2244611, 32771, 1048579, 2097155, 65539, 786435, 360451, 2097155, 4194307, 1052675, 2097155, 2097154, 10243, 2097155,
+ 3, 1050627, 65539, 2392067, 65539, 528387, 65538, 65539, 4460547, 212995, 524291, 8195, 1089539, 2097155, 65539, 4196355,
+ 49155, 4202499, 524291, 135171, 395267, 2097155, 65539, 1064963, 524291, 2097155, 524290, 524291, 2097155, 2097154, 524291, 2097155,
+ 65539, 4202499, 65538, 65539, 65538, 65539, 65537, 65538, 2099203, 557059, 65539, 1052675, 65539, 262147, 65538, 65539,
+ 4202499, 4202498, 65539, 4202499, 65539, 4202499, 65538, 65539, 1179651, 4202499, 524291, 280579, 20483, 2097155, 65539, 163843,
+ 3, 1050627, 2101251, 139267, 819203, 139267, 139267, 139266, 24579, 4227075, 524291, 327683, 71683, 2097155, 5242883, 139267,
+ 4390915, 282627, 524291, 32771, 1048579, 2097155, 18435, 139267, 524291, 2097155, 524290, 524291, 2097155, 2097154, 524291, 2097155,
+ 24579, 2686979, 4458499, 32771, 1048579, 4198403, 65539, 139267, 24578, 24579, 24579, 1052675, 24579, 262147, 2129923, 526339,
+ 1048579, 32771, 32771, 32770, 1048578, 1048579, 1048579, 32771, 24579, 133123, 524291, 32771, 1048579, 2097155, 397315, 4276227,
+ 1050627, 1050626, 524291, 1050627, 6307843, 1050627, 65539, 139267, 524291, 1050627, 524290, 524291, 131075, 262147, 524291, 53251,
+ 524291, 1050627, 524290, 524291, 12291, 98307, 524291, 4456451, 524290, 524291, 524289, 524290, 524291, 2097155, 524290, 524291,
+ 167939, 1050627, 65539, 16387, 65539, 262147, 65538, 65539, 24579, 262147, 524291, 6422531, 262147, 262146, 65539, 262147,
+ 2359299, 4202499, 524291, 32771, 1048579, 671747, 65539, 2103299, 524291, 69635, 524290, 524291, 4229123, 262147, 524291, 1056771,
+ 1, 2, 2, 3, 2, 3, 3, 1081347, 2, 3, 3, 8195, 3, 4980739, 2164739, 4099,
+ 2, 3, 3, 2375683, 3, 2051, 655363, 4099, 3, 229379, 4194307, 4099, 1073155, 4099, 4099, 4098,
+ 2, 3, 3, 593923, 3, 2051, 270339, 6291459, 3, 3145731, 4194307, 296963, 36867, 73731, 1572867, 147459,
+ 3, 2051, 4194307, 1187843, 2051, 2050, 114691, 2051, 4194307, 540675, 4194306, 4194307, 2490371, 2051, 4194307, 4099,
+ 2, 3, 3, 8195, 3, 2051, 4214787, 458755, 3, 8195, 8195, 8194, 131075, 2146307, 1572867, 8195,
+ 3, 2051, 1114115, 4751363, 2051, 2050, 2105347, 2051, 2625539, 1310723, 149507, 8195, 4259843, 2051, 294915, 4099,
+ 3, 2051, 2260995, 16387, 2051, 2050, 1572867, 2051, 344067, 4329475, 1572867, 8195, 1572867, 2051, 1572866, 1572867,
+ 2051, 2050, 266243, 2051, 2050, 2049, 2051, 2050, 40963, 2051, 4194307, 2162691, 2051, 2050, 1572867, 2051,
+ 2, 3, 3, 4327427, 3, 81923, 270339, 4099, 3, 3145731, 573443, 4099, 131075, 4099, 4099, 4098,
+ 3, 532483, 1114115, 4099, 6324227, 4099, 4099, 4098, 264195, 4099, 4099, 4098, 4099, 4098, 4098, 4097,
+ 3, 3145731, 270339, 16387, 270339, 688131, 270338, 270339, 3145731, 3145730, 196611, 3145731, 4212739, 3145731, 270339, 4099,
+ 151555, 4521987, 2623491, 32771, 1048579, 2051, 270339, 4099, 40963, 3145731, 4194307, 4099, 589827, 4099, 4099, 4098,
+ 3, 299011, 1114115, 16387, 131075, 5251075, 34819, 2621443, 131075, 591875, 6553603, 8195, 131074, 131075, 131075, 4099,
+ 1114115, 2228227, 1114114, 1114115, 802819, 2051, 1114115, 4099, 40963, 4210691, 1114115, 4099, 131075, 4099, 4099, 4098,
+ 4718595, 16387, 16387, 16386, 2166787, 2051, 270339, 16387, 40963, 3145731, 6147, 16387, 131075, 262147, 1572867, 4292611,
+ 40963, 2051, 1114115, 16387, 2051, 2050, 4325379, 2051, 40962, 40963, 40963, 917507, 40963, 2051, 2113539, 4099,
+ 2, 3, 3, 8195, 3, 81923, 655363, 6291459, 3, 8195, 8195, 8194, 36867, 1181699, 278531, 8195,
+ 3, 5246979, 655363, 67587, 655363, 303107, 655362, 655363, 264195, 540675, 3178499, 8195, 4259843, 2097155, 655363, 4099,
+ 3, 393219, 1067011, 6291459, 36867, 6291459, 6291459, 6291458, 36867, 540675, 196611, 8195, 36866, 36867, 36867, 6291459,
+ 2170883, 540675, 266243, 32771, 1048579, 2051, 655363, 6291459, 540675, 540674, 4194307, 540675, 36867, 540675, 10243, 1376259,
+ 3, 8195, 8195, 8194, 3407875, 528387, 34819, 8195, 8195, 8194, 8194, 8193, 4259843, 8195, 8195, 8194,
+ 49155, 2228227, 266243, 8195, 4259843, 2051, 655363, 1064963, 4259843, 8195, 8195, 8194, 4259842, 4259843, 4259843, 8195,
+ 4718595, 1146883, 266243, 8195, 155651, 2051, 65539, 6291459, 2099203, 8195, 8195, 8194, 36867, 262147, 1572867, 8195,
+ 266243, 2051, 266242, 266243, 2051, 2050, 266243, 2051, 1179651, 540675, 266243, 8195, 4259843, 2051, 2113539, 163843,
+ 3, 81923, 2101251, 1835011, 81923, 81922, 34819, 81923, 264195, 4227075, 196611, 8195, 2629635, 81923, 5242883, 4099,
+ 264195, 2228227, 4218883, 32771, 1048579, 81923, 655363, 4099, 264194, 264195, 264195, 4099, 264195, 4099, 4099, 4098,
+ 4718595, 14339, 196611, 32771, 1048579, 81923, 270339, 6291459, 196611, 3145731, 196610, 196611, 36867, 262147, 196611, 526339,
+ 1048579, 32771, 32771, 32770, 1048578, 1048579, 1048579, 32771, 264195, 540675, 196611, 32771, 1048579, 4333571, 2113539, 4099,
+ 4718595, 2228227, 34819, 8195, 34819, 81923, 34818, 34819, 1069059, 8195, 8195, 8194, 131075, 262147, 34819, 8195,
+ 2228227, 2228226, 1114115, 2228227, 12291, 2228227, 34819, 4456451, 264195, 2228227, 524291, 8195, 4259843, 1605635, 2113539, 4099,
+ 4718594, 4718595, 4718595, 16387, 4718595, 262147, 34819, 1183747, 4718595, 262147, 196611, 8195, 262147, 262146, 2113539, 262147,
+ 4718595, 2228227, 266243, 32771, 1048579, 2051, 2113539, 598019, 40963, 69635, 2113539, 5244931, 2113539, 262147, 2113538, 2113539,
+ 2, 3, 3, 1081347, 3, 1081347, 1081347, 1081346, 3, 22531, 4194307, 2752515, 131075, 73731, 278531, 1081347,
+ 3, 532483, 4194307, 67587, 331779, 4341763, 2105347, 1081347, 4194307, 1310723, 4194306, 4194307, 559107, 2097155, 4194307, 4099,
+ 3, 393219, 4194307, 16387, 2637827, 73731, 137219, 1081347, 4194307, 73731, 4194306, 4194307, 73731, 73730, 4194307, 73731,
+ 4194307, 2134019, 4194306, 4194307, 1048579, 2051, 4194307, 786435, 4194306, 4194307, 4194305, 4194306, 4194307, 73731, 4194306, 4194307,
+ 3, 6356995, 788483, 16387, 131075, 528387, 2105347, 1081347, 131075, 1310723, 102403, 8195, 131074, 131075, 131075, 4196355,
+ 49155, 1310723, 2105347, 135171, 2105347, 2051, 2105346, 2105347, 1310723, 1310722, 4194307, 1310723, 131075, 1310723, 2105347, 606211,
+ 1060867, 16387, 16387, 16386, 4489219, 2051, 65539, 16387, 2099203, 557059, 4194307, 16387, 131075, 73731, 1572867, 2363395,
+ 720899, 2051, 4194307, 16387, 2051, 2050, 2105347, 2051, 4194307, 1310723, 4194306, 4194307, 20483, 2051, 4194307, 163843,
+ 3, 532483, 2101251, 16387, 131075, 2361347, 4784131, 1081347, 131075, 4227075, 1058819, 327683, 131074, 131075, 131075, 4099,
+ 532483, 532482, 425987, 532483, 1048579, 532483, 18435, 4099, 2179075, 532483, 4194307, 4099, 131075, 4099, 4099, 4098,
+ 100355, 16387, 16387, 16386, 1048579, 4198403, 270339, 16387, 790531, 3145731, 4194307, 16387, 131075, 73731, 2129923, 526339,
+ 1048579, 532483, 4194307, 16387, 1048578, 1048579, 1048579, 2293763, 4194307, 133123, 4194306, 4194307, 1048579, 311299, 4194307, 4099,
+ 131075, 16387, 16387, 16386, 131074, 131075, 131075, 16387, 131074, 131075, 131075, 16387, 131073, 131074, 131074, 131075,
+ 4200451, 532483, 1114115, 16387, 131075, 98307, 2105347, 4456451, 131075, 1310723, 524291, 2131971, 131074, 131075, 131075, 4099,
+ 16387, 16386, 16386, 16385, 131075, 16387, 16387, 16386, 131075, 16387, 16387, 16386, 131074, 131075, 131075, 16387,
+ 2359299, 16387, 16387, 16386, 1048579, 2051, 561155, 16387, 40963, 69635, 4194307, 16387, 131075, 6815747, 329731, 1056771,
+ 3, 393219, 2101251, 67587, 4204547, 528387, 278531, 1081347, 1638403, 4227075, 278531, 8195, 278531, 2097155, 278530, 278531,
+ 49155, 67587, 67587, 67586, 1048579, 2097155, 655363, 67587, 143363, 2097155, 4194307, 67587, 2097155, 2097154, 278531, 2097155,
+ 393219, 393218, 565251, 393219, 1048579, 393219, 65539, 6291459, 2099203, 393219, 4194307, 1052675, 36867, 73731, 278531, 526339,
+ 1048579, 393219, 4194307, 67587, 1048578, 1048579, 1048579, 28675, 4194307, 540675, 4194306, 4194307, 1048579, 2097155, 4194307, 163843,
+ 49155, 528387, 5373955, 8195, 528387, 528386, 65539, 528387, 2099203, 8195, 8195, 8194, 131075, 528387, 278531, 8195,
+ 49154, 49155, 49155, 67587, 49155, 528387, 2105347, 4456451, 49155, 1310723, 524291, 8195, 4259843, 2097155, 1054723, 163843,
+ 2099203, 393219, 65539, 16387, 65539, 528387, 65538, 65539, 2099202, 2099203, 2099203, 8195, 2099203, 5259267, 65539, 163843,
+ 49155, 4202499, 266243, 3670019, 1048579, 2051, 65539, 163843, 2099203, 69635, 4194307, 163843, 794627, 163843, 163843, 163842,
+ 2101251, 4227075, 2101250, 2101251, 1048579, 81923, 2101251, 139267, 4227075, 4227074, 2101251, 4227075, 131075, 4227075, 278531, 526339,
+ 1048579, 532483, 2101251, 67587, 1048578, 1048579, 1048579, 4456451, 264195, 4227075, 524291, 1196035, 1048579, 2097155, 106499, 4099,
+ 1048579, 393219, 2101251, 16387, 1048578, 1048579, 1048579, 526339, 24579, 4227075, 196611, 526339, 1048579, 526339, 526339, 526338,
+ 1048578, 1048579, 1048579, 32771, 1048577, 1048578, 1048578, 1048579, 1048579, 69635, 4194307, 2367491, 1048578, 1048579, 1048579, 526339,
+ 335875, 1050627, 2101251, 16387, 131075, 528387, 34819, 4456451, 131075, 4227075, 524291, 8195, 131074, 131075, 131075, 3211267,
+ 49155, 2228227, 524291, 4456451, 1048579, 4456451, 4456451, 4456450, 524291, 69635, 524290, 524291, 131075, 26627, 524291, 4456451,
+ 4718595, 16387, 16387, 16386, 1048579, 2138115, 65539, 16387, 2099203, 69635, 1343491, 16387, 131075, 262147, 4206595, 526339,
+ 1048579, 69635, 141315, 16387, 1048578, 1048579, 1048579, 4456451, 69635, 69634, 524291, 69635, 1048579, 69635, 2113539, 163843 ]
+
+def gly23127GetSyn (pattern) :
+ aux = 0x400000
+
+ while(pattern & 0xFFFFF800) != 0 :
+ while (aux & pattern) == 0:
+ aux = aux >> 1
+ pattern = pattern ^ (aux / 0x800 * 0xC75) #generator is C75
+
+ return pattern
+
+def gly23127Dec (CW) :
+ correction = gly23127DecTbl[gly23127GetSyn(CW)]
+ CW = (CW ^ correction) >> 11
+ return CW, correction
+
+def gly24128Dec (n) :
+
+#based on gly23127Dec
+
+ CW = n >> 1 ; #toss the parity bit
+ correction = gly23127DecTbl[gly23127GetSyn(CW)]
+ CW = (CW ^ correction) >> 11
+ return CW, correction
diff --git a/op25/gr-op25_repeater/apps/tdma/tdma-decode.py b/op25/gr-op25_repeater/apps/tdma/tdma-decode.py
new file mode 100755
index 0000000..7d04f9b
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/tdma-decode.py
@@ -0,0 +1,114 @@
+#! /usr/bin/python
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+"""
+Decode a file of P25 TDMA symbols and write out all detected voice codewords
+
+After FEC decoding, print the resulting "B" vectors (49 bits per CW).
+
+Optionally, dump the timeslot info (type, position, type of content)
+
+The input file must contain the demodulated symbols, one per character
+using the low-order two bits of each byte
+"""
+
+import sys
+import numpy as np
+from optparse import OptionParser
+
+from bit_utils import *
+from isch import mk_isch_lookup, decode_isch
+from duid import mk_duid_lookup, decode_duid
+from lfsr import mk_xor
+from vf import process_v
+
+SUPERFRAME_LEN = 2160
+
+def main():
+ parser = OptionParser()
+ parser.add_option("-v", "--verbose", action="store_true", default=False)
+ parser.add_option("-i", "--input-file", type="string", default=None, help="input file name")
+ parser.add_option("-n", "--nac", type="int", default=0, help="NAC")
+ parser.add_option("-s", "--sysid", type="int", default=0, help="sysid")
+ parser.add_option("-w", "--wacn", type="int", default=0, help="WACN")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+ file = options.input_file
+
+ mk_isch_lookup()
+ mk_duid_lookup()
+ #print 'nac: %d' % options.nac
+ xorsyms = mk_xor(options.nac, options.sysid, options.wacn)
+
+ d = open(file).read()
+
+ symbols = []
+ for c in d:
+ symbols.append(ord(c))
+
+ sync0= bits_to_dibits(mk_array(0x575d57f7ff,40))
+ sync_start = find_sym(sync0, symbols)
+ assert sync_start > 0 # unable to locate any sync sequence
+ superframe = -1
+ for i in xrange(sync_start, sync_start + (180*32), 180):
+ chn, loc, fr, cnt = decode_isch ( symbols [ i : i + 20 ])
+ if chn == 0 and loc == 0:
+ superframe = i
+ break
+ assert superframe > 0 # unable to locate start of superframe
+
+ errors = 0
+ for i in xrange(superframe,len(symbols)-SUPERFRAME_LEN,SUPERFRAME_LEN):
+ syms1 = symbols[i + 10: i + SUPERFRAME_LEN + 10]
+ syms2 = np.array(syms1) ^ xorsyms
+ for j in xrange(12):
+ if options.verbose:
+ print '%s superframe %d timeslot %d %s' % ('=' * 20, i, j, '=' * 20)
+ chn, loc, fr, cnt = decode_isch ( symbols [ i + (j*180) : i + (j*180) + 20 ])
+ if chn == -1:
+ if options.verbose:
+ print 'unknown isch codeword at %d' % (i + (j*180))
+ errors += 1
+ elif chn == -2:
+ if options.verbose:
+ print 'sync isch codeword found at %d' % (i + (j*180))
+ errors = 0
+ else:
+ if options.verbose:
+ print "channel %d loc %d fr %d count %d" % (chn, loc, fr, cnt)
+ errors = 0
+
+ burst = syms1 [ (j*180) : (j*180) + 180 ]
+ burst_d= syms2 [ (j*180) : (j*180) + 180 ]
+ b = decode_duid(burst)
+ if options.verbose:
+ print 'burst at %d type %s' % (i + (j*180), b)
+ if b == '2v' or b == '4v':
+ process_v(burst_d, b)
+ if errors > 6:
+ if options.verbose:
+ print "too many successive errors, exiting at i=%d" % (i)
+ break
+
+if __name__ == "__main__":
+ main()
diff --git a/op25/gr-op25_repeater/apps/tdma/vf.py b/op25/gr-op25_repeater/apps/tdma/vf.py
new file mode 100644
index 0000000..96dbeaa
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/tdma/vf.py
@@ -0,0 +1,153 @@
+
+# P25 TDMA Decoder (C) Copyright 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+
+import sys
+import numpy as np
+
+from bit_utils import *
+from rs import gly23127Dec, gly24128Dec
+
+def process_vcw(vf):
+ c0, c1, c2, c3 = extract_vcw(vf)
+ c0 = mk_int(c0)
+ c0 = rev_int(c0, 24)
+ c1 = mk_int(c1)
+ c1 = rev_int(c1, 23)
+ c2 = mk_int(c2)
+ c2 = rev_int(c2, 11)
+ c3 = mk_int(c3)
+ c3 = rev_int(c3, 14)
+ u0, correction0 = gly24128Dec(c0)
+ pr = [0] * 24
+ m1 = [0] * 23
+ pr[0] = 16 * u0
+ for n in xrange(1,24):
+ pr[n] = (173*pr[n-1] + 13849) - 65536 * int((173*pr[n-1]+13849)/65536)
+ m1[n-1] = int(pr[n] / 32768) & 1
+ m1 = mk_int(m1)
+
+ u1, correction1 = gly23127Dec(c1 ^ m1)
+ u2 = c2
+ u3 = c3
+ b = [0] * 9
+ b[0] = ((u0 >> 5) & 0x78) + ((u3 >> 9) & 0x7)
+ b[1] = ((u0 >> 3) & 0x1e) + ((u3 >> 13) & 0x1)
+ b[2] = ((u0 << 1) & 0x1e) + ((u3 >> 12) & 0x1)
+ b[3] = ((u1 >> 3) & 0x1fe) + ((u3 >> 8) & 0x1)
+ b[4] = ((u1 << 3) & 0x78) + ((u3 >> 5) & 0x7)
+ b[5] = ((u2 >> 6) & 0x1e) + ((u3 >> 4) & 0x1)
+ b[6] = ((u2 >> 3) & 0x0e) + ((u3 >> 3) & 0x1)
+ b[7] = ( u2 & 0x0e) + ((u3 >> 2) & 0x1)
+ b[8] = ((u2 << 2) & 0x04) + ( u3 & 0x3)
+ s = "\t".join(['%s' % x for x in b])
+ print "%s" % s
+
+def process_v(f,type):
+ vf = dibits_to_bits(f[11:11+36])
+ process_vcw(vf)
+ vf = dibits_to_bits(f[48:48+36])
+ process_vcw(vf)
+ if type == '2v':
+ return
+ vf = dibits_to_bits(f[96:96+36])
+ process_vcw(vf)
+ vf = dibits_to_bits(f[133:133+36])
+ process_vcw(vf)
+
+def extract_vcw(vf):
+ c0 = [0] * 24
+ c1 = [0] * 23
+ c2 = [0] * 11
+ c3 = [0] * 14
+
+ c0[23] = vf[0]
+ c0[5] = vf[1]
+ c1[10] = vf[2]
+ c2[3] = vf[3]
+ c0[22] = vf[4]
+ c0[4] = vf[5]
+ c1[9] = vf[6]
+ c2[2] = vf[7]
+ c0[21] = vf[8]
+ c0[3] = vf[9]
+ c1[8] = vf[10]
+ c2[1] = vf[11]
+ c0[20] = vf[12]
+ c0[2] = vf[13]
+ c1[7] = vf[14]
+ c2[0] = vf[15]
+ c0[19] = vf[16]
+ c0[1] = vf[17]
+ c1[6] = vf[18]
+ c3[13] = vf[19]
+ c0[18] = vf[20]
+ c0[0] = vf[21]
+ c1[5] = vf[22]
+ c3[12] = vf[23]
+ c0[17] = vf[24]
+ c1[22] = vf[25]
+ c1[4] = vf[26]
+ c3[11] = vf[27]
+ c0[16] = vf[28]
+ c1[21] = vf[29]
+ c1[3] = vf[30]
+ c3[10] = vf[31]
+ c0[15] = vf[32]
+ c1[20] = vf[33]
+ c1[2] = vf[34]
+ c3[9] = vf[35]
+ c0[14] = vf[36]
+ c1[19] = vf[37]
+ c1[1] = vf[38]
+ c3[8] = vf[39]
+ c0[13] = vf[40]
+ c1[18] = vf[41]
+ c1[0] = vf[42]
+ c3[7] = vf[43]
+ c0[12] = vf[44]
+ c1[17] = vf[45]
+ c2[10] = vf[46]
+ c3[6] = vf[47]
+ c0[11] = vf[48]
+ c1[16] = vf[49]
+ c2[9] = vf[50]
+ c3[5] = vf[51]
+ c0[10] = vf[52]
+ c1[15] = vf[53]
+ c2[8] = vf[54]
+ c3[4] = vf[55]
+ c0[9] = vf[56]
+ c1[14] = vf[57]
+ c2[7] = vf[58]
+ c3[3] = vf[59]
+ c0[8] = vf[60]
+ c1[13] = vf[61]
+ c2[6] = vf[62]
+ c3[2] = vf[63]
+ c0[7] = vf[64]
+ c1[12] = vf[65]
+ c2[5] = vf[66]
+ c3[1] = vf[67]
+ c0[6] = vf[68]
+ c1[11] = vf[69]
+ c2[4] = vf[70]
+ c3[0] = vf[71]
+
+ return c0, c1, c2, c3
diff --git a/op25/gr-op25_repeater/apps/trunking.py b/op25/gr-op25_repeater/apps/trunking.py
new file mode 100644
index 0000000..33cd681
--- /dev/null
+++ b/op25/gr-op25_repeater/apps/trunking.py
@@ -0,0 +1,569 @@
+
+# Copyright 2011, 2012, 2013 KA1RBI
+#
+# This file is part of OP25
+#
+# OP25 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.
+#
+# OP25 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 OP25; see the file COPYING. If not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Boston, MA
+# 02110-1301, USA.
+#
+# FIXME: hideously mixes indentation, some is tabs and some is spaces
+#
+
+import time
+
+def crc16(dat,len): # slow version
+ poly = (1<<12) + (1<<5) + (1<<0)
+ crc = 0
+ for i in range(len):
+ bits = (dat >> (((len-1)-i)*8)) & 0xff
+ for j in range(8):
+ bit = (bits >> (7-j)) & 1
+ crc = ((crc << 1) | bit) & 0x1ffff
+ if crc & 0x10000:
+ crc = (crc & 0xffff) ^ poly
+ crc = crc ^ 0xffff
+ return crc
+
+class trunked_system (object):
+ def __init__(self, debug=0, config=None):
+ self.debug = debug
+ self.freq_table = {}
+ self.stats = {}
+ self.stats['tsbks'] = 0
+ self.stats['crc'] = 0
+ self.tsbk_cache = {}
+ self.secondary = {}
+ self.adjacent = {}
+ self.rfss_syid = 0
+ self.rfss_rfid = 0
+ self.rfss_stid = 0
+ self.rfss_chan = 0
+ self.rfss_txchan = 0
+ self.ns_syid = 0
+ self.ns_wacn = 0
+ self.ns_chan = 0
+ self.voice_frequencies = {}
+ self.blacklist = {}
+ self.whitelist = None
+ self.tgid_map = None
+ self.offset = 0
+ self.sysname = 0
+ self.trunk_cc = 0
+ if config:
+ self.blacklist = config['blacklist']
+ self.whitelist = config['whitelist']
+ self.tgid_map = config['tgid_map']
+ self.offset = config['offset']
+ self.sysname = config['sysname']
+ self.trunk_cc = config['cclist'][0] # TODO: scan thru list
+
+ def to_string(self):
+ s = []
+ s.append('rf: syid %x rfid %d stid %d frequency %f uplink %f' % ( self.rfss_syid, self.rfss_rfid, self.rfss_stid, float(self.rfss_chan) / 1000000.0, float(self.rfss_txchan) / 1000000.0))
+ s.append('net: syid %x wacn %x frequency %f' % ( self.ns_syid, self.ns_wacn, float(self.ns_chan) / 1000000.0))
+ s.append('secondary control channel(s): %s' % ','.join(['%f' % (float(k) / 1000000.0) for k in self.secondary.keys()]))
+ s.append('stats: tsbks %d crc %d' % (self.stats['tsbks'], self.stats['crc']))
+ s.append('')
+ t = time.time()
+ for f in self.voice_frequencies:
+ s.append('voice frequency %f tgid %d %4.1fs ago count %d' % (f / 1000000.0, self.voice_frequencies[f]['tgid'], t - self.voice_frequencies[f]['time'], self.voice_frequencies[f]['counter']))
+ s.append('')
+ for table in self.freq_table:
+ a = self.freq_table[table]['frequency'] / 1000000.0
+ b = self.freq_table[table]['step'] / 1000000.0
+ c = self.freq_table[table]['offset'] / 1000000.0
+ s.append('tbl-id: %x frequency: %f step %f offset %f' % ( table, a,b,c))
+ #self.freq_table[table]['frequency'] / 1000000.0, self.freq_table[table]['step'] / 1000000.0, self.freq_table[table]['offset']) / 1000000.0)
+ for f in self.adjacent:
+ s.append('adjacent %f: %s' % (float(f) / 1000000.0, self.adjacent[f]))
+ return '\n'.join(s)
+
+# return frequency in Hz
+ def channel_id_to_frequency(self, id):
+ table = (id >> 12) & 0xf
+ channel = id & 0xfff
+ if table not in self.freq_table:
+ return None
+ return self.freq_table[table]['frequency'] + self.freq_table[table]['step'] * channel
+
+ def channel_id_to_string(self, id):
+ table = (id >> 12) & 0xf
+ channel = id & 0xfff
+ if table not in self.freq_table:
+ return "%x-%d" % (table, channel)
+ return "%f" % ((self.freq_table[table]['frequency'] + self.freq_table[table]['step'] * channel) / 1000000.0)
+
+ def get_tag(self, tgid):
+ if not tgid:
+ return ""
+ if tgid not in self.tgid_map:
+ return "Talkgroup ID %d [0x%x]" % (tgid, tgid)
+ return self.tgid_map[tgid]
+
+ def update_voice_frequency(self, frequency, tgid=None):
+ if frequency is None:
+ return
+ if frequency not in self.voice_frequencies:
+ self.voice_frequencies[frequency] = {'counter':0}
+ self.voice_frequencies[frequency]['tgid'] = tgid
+ self.voice_frequencies[frequency]['counter'] += 1
+ self.voice_frequencies[frequency]['time'] = time.time()
+
+ def find_voice_frequency(self, start_time, tgid=None):
+ for frequency in self.voice_frequencies:
+ if self.voice_frequencies[frequency]['time'] < start_time:
+ continue
+ active_tgid = self.voice_frequencies[frequency]['tgid']
+ if active_tgid in self.blacklist:
+ continue
+ if self.whitelist and active_tgid not in self.whitelist:
+ continue
+ if tgid is None or tgid == active_tgid:
+ return frequency, active_tgid
+ return None, None
+
+ def add_blacklist(self, tgid):
+ if not tgid:
+ return
+ self.blacklist[tgid] = 1
+
+ def decode_mbt_data(self, opcode, header, mbt_data):
+ if self.debug > 10:
+ print "decode_mbt_data: %x %x" %(opcode, mbt_data)
+ if opcode == 0x0: # grp voice channel grant
+ ch1 = (mbt_data >> 64) & 0xffff
+ ch2 = (mbt_data >> 48) & 0xffff
+ ga = (mbt_data >> 32) & 0xffff
+ if self.debug > 10:
+ print "mbt00 voice grant ch1 %x ch2 %x addr 0x%x" %(ch1, ch2, ga)
+ elif opcode == 0x3c: # adjacent status
+ syid = (header >> 48) & 0xfff
+ rfid = (header >> 24) & 0xff
+ stid = (header >> 16) & 0xff
+ ch1 = (mbt_data >> 80) & 0xffff
+ ch2 = (mbt_data >> 64) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ f2 = self.channel_id_to_frequency(ch2)
+ if f1 and f2:
+ self.adjacent[f1] = 'rfid: %d stid:%d uplink:%f' % (rfid, stid, f2 / 1000000.0)
+ if self.debug > 10:
+ print "mbt3c adjacent sys %x rfid %x stid %x ch1 %x ch2 %x f1 %s f2 %s" %(syid, rfid, stid, ch1, ch2, self.channel_id_to_string(ch1), self.channel_id_to_string(ch2))
+ elif opcode == 0x3b: # network status
+ syid = (header >> 48) & 0xfff
+ wacn = (mbt_data >> 76) & 0xfffff
+ ch1 = (mbt_data >> 56) & 0xffff
+ ch2 = (mbt_data >> 40) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ f2 = self.channel_id_to_frequency(ch2)
+ if f1 and f2:
+ self.ns_syid = syid
+ self.ns_wacn = wacn
+ self.ns_chan = f1
+ if self.debug > 10:
+ print "mbt3b net stat sys %x wacn %x ch1 %s ch2 %s" %(syid, wacn, self.channel_id_to_string(ch1), self.channel_id_to_string(ch2))
+ elif opcode == 0x3a: # rfss status
+ syid = (header >> 48) & 0xfff
+ rfid = (mbt_data >> 88) & 0xff
+ stid = (mbt_data >> 80) & 0xff
+ ch1 = (mbt_data >> 64) & 0xffff
+ ch2 = (mbt_data >> 48) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ f2 = self.channel_id_to_frequency(ch2)
+ if f1 and f2:
+ self.rfss_syid = syid
+ self.rfss_rfid = rfid
+ self.rfss_stid = stid
+ self.rfss_chan = f1
+ self.rfss_txchan = f2
+ if self.debug > 10:
+ print "mbt3a rfss stat sys %x rfid %x stid %x ch1 %s ch2 %s" %(syid, rfid, stid, self.channel_id_to_string(ch1), self.channel_id_to_string(ch2))
+ #else:
+ # print "mbt other %x" % opcode
+
+ def decode_tsbk(self, tsbk):
+ self.stats['tsbks'] += 1
+ updated = 0
+# if crc16(tsbk, 12) != 0:
+# self.stats['crc'] += 1
+# return # crc check failed
+ tsbk = tsbk << 16 # for missing crc
+ opcode = (tsbk >> 88) & 0x3f
+ if self.debug > 10:
+ print "TSBK: 0x%02x 0x%024x" % (opcode, tsbk)
+ if opcode == 0x02: # group voice chan grant update
+ mfrid = (tsbk >> 80) & 0xff
+ ch1 = (tsbk >> 64) & 0xffff
+ ga1 = (tsbk >> 48) & 0xffff
+ ch2 = (tsbk >> 32) & 0xffff
+ ga2 = (tsbk >> 16) & 0xffff
+ if mfrid == 0x90:
+ if self.debug > 10:
+ ch1 = (tsbk >> 56) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ if f1 == None: f1 = 0
+ print "tsbk02[90] %x %f" % (ch1, f1 / 1000000.0)
+ else:
+ f1 = self.channel_id_to_frequency(ch1)
+ f2 = self.channel_id_to_frequency(ch2)
+ self.update_voice_frequency(f1, tgid=ga1)
+ if f1 != f2:
+ self.update_voice_frequency(f2, tgid=ga2)
+ if f1:
+ updated += 1
+ if f2:
+ updated += 1
+ if self.debug > 10:
+ print "tsbk02 grant update: chan %s %d %s %d" %(self.channel_id_to_string(ch1), ga1, self.channel_id_to_string(ch2), ga2)
+ elif opcode == 0x16: # sndcp data ch
+ ch1 = (tsbk >> 48) & 0xffff
+ ch2 = (tsbk >> 32) & 0xffff
+ if self.debug > 10:
+ print "tsbk16 sndcp data ch: chan %x %x" %(ch1, ch2)
+ elif opcode == 0x34: # iden_up vhf uhf
+ iden = (tsbk >> 76) & 0xf
+ bwvu = (tsbk >> 72) & 0xf
+ toff0 = (tsbk >> 58) & 0x3fff
+ spac = (tsbk >> 48) & 0x3ff
+ freq = (tsbk >> 16) & 0xffffffff
+ toff_sign = (toff0 >> 13) & 1
+ toff = toff0 & 0x1fff
+ if toff_sign == 0:
+ toff = 0 - toff
+ txt = ["mob Tx-", "mob Tx+"]
+ self.freq_table[iden] = {}
+ self.freq_table[iden]['offset'] = toff * spac * 125
+ self.freq_table[iden]['step'] = spac * 125
+ self.freq_table[iden]['frequency'] = freq * 5
+ if self.debug > 10:
+ print "tsbk34 iden vhf/uhf id %d toff %f spac %f freq %f [%s]" % (iden, toff * spac * 0.125 * 1e-3, spac * 0.125, freq * 0.000005, txt[toff_sign])
+ elif opcode == 0x3d: # iden_up
+ iden = (tsbk >> 76) & 0xf
+ bw = (tsbk >> 67) & 0x1ff
+ toff0 = (tsbk >> 58) & 0x1ff
+ spac = (tsbk >> 48) & 0x3ff
+ freq = (tsbk >> 16) & 0xffffffff
+ toff_sign = (toff0 >> 8) & 1
+ toff = toff0 & 0xff
+ if toff_sign == 0:
+ toff = 0 - toff
+ txt = ["mob xmit < recv", "mob xmit > recv"]
+ self.freq_table[iden] = {}
+ self.freq_table[iden]['offset'] = toff * 250000
+ self.freq_table[iden]['step'] = spac * 125
+ self.freq_table[iden]['frequency'] = freq * 5
+ if self.debug > 10:
+ print "tsbk3d iden id %d toff %f spac %f freq %f" % (iden, toff * 0.25, spac * 0.125, freq * 0.000005)
+ elif opcode == 0x3a: # rfss status
+ syid = (tsbk >> 56) & 0xfff
+ rfid = (tsbk >> 48) & 0xff
+ stid = (tsbk >> 40) & 0xff
+ chan = (tsbk >> 24) & 0xffff
+ f1 = self.channel_id_to_frequency(chan)
+ if f1:
+ self.rfss_syid = syid
+ self.rfss_rfid = rfid
+ self.rfss_stid = stid
+ self.rfss_chan = f1
+ self.rfss_txchan = f1 + self.freq_table[chan >> 12]['offset']
+ if self.debug > 10:
+ print "tsbk3a rfss status: syid: %x rfid %x stid %d ch1 %x(%s)" %(syid, rfid, stid, chan, self.channel_id_to_string(chan))
+ elif opcode == 0x39: # secondary cc
+ rfid = (tsbk >> 72) & 0xff
+ stid = (tsbk >> 64) & 0xff
+ ch1 = (tsbk >> 48) & 0xffff
+ ch2 = (tsbk >> 24) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ f2 = self.channel_id_to_frequency(ch2)
+ if f1 and f2:
+ self.secondary[ f1 ] = 1
+ self.secondary[ f2 ] = 1
+ if self.debug > 10:
+ print "tsbk39 secondary cc: rfid %x stid %d ch1 %x(%s) ch2 %x(%s)" %(rfid, stid, ch1, self.channel_id_to_string(ch1), ch2, self.channel_id_to_string(ch2))
+ elif opcode == 0x3b: # network status
+ wacn = (tsbk >> 52) & 0xfffff
+ syid = (tsbk >> 40) & 0xfff
+ ch1 = (tsbk >> 24) & 0xffff
+ f1 = self.channel_id_to_frequency(ch1)
+ if f1:
+ self.ns_syid = syid
+ self.ns_wacn = wacn
+ self.ns_chan = f1
+ if self.debug > 10:
+ print "tsbk3b net stat: wacn %x syid %x ch1 %x(%s)" %(wacn, syid, ch1, self.channel_id_to_string(ch1))
+ elif opcode == 0x3c: # adjacent status
+ rfid = (tsbk >> 48) & 0xff
+ stid = (tsbk >> 40) & 0xff
+ ch1 = (tsbk >> 24) & 0xffff
+ table = (ch1 >> 12) & 0xf
+ f1 = self.channel_id_to_frequency(ch1)
+ if f1 and table in self.freq_table:
+ self.adjacent[f1] = 'rfid: %d stid:%d uplink:%f tbl:%d' % (rfid, stid, (f1 + self.freq_table[table]['offset']) / 1000000.0, table)
+ if self.debug > 10:
+ print "tsbk3c adjacent: rfid %x stid %d ch1 %x(%s)" %(rfid, stid, ch1, self.channel_id_to_string(ch1))
+ if table in self.freq_table:
+ print "tsbk3c : %s %s" % (self.freq_table[table]['frequency'] , self.freq_table[table]['step'] )
+ #else:
+ # print "tsbk other %x" % opcode
+ return updated
+
+
+class rx_ctl (object):
+ def __init__(self, debug=0, frequency_set=None, conf_file=None):
+ class _states(object):
+ ACQ = 0
+ CC = 1
+ TO_VC = 2
+ VC = 3
+ self.states = _states
+
+ self.state = self.states.CC
+ self.trunked_systems = {}
+ self.frequency_set = frequency_set
+ self.debug = debug
+ self.tgid_hold = None
+ self.tgid_hold_until = time.time()
+ self.TGID_HOLD_TIME = 2.0 # TODO: make more configurable
+ self.current_nac = None
+ self.current_id = 0
+ self.TSYS_HOLD_TIME = 3.0 # TODO: make more configurable
+ self.wait_until = time.time()
+ self.configs = {}
+
+ if conf_file:
+ self.build_config(conf_file)
+ self.nacs = self.configs.keys()
+ self.current_nac = self.nacs[0]
+ self.current_state = self.states.CC
+
+ def set_frequency(self, params):
+ frequency = params['freq']
+ if frequency and self.frequency_set:
+ self.frequency_set(params)
+
+ def add_trunked_system(self, nac):
+ assert nac not in self.trunked_systems # duplicate nac not allowed
+ blacklist = {}
+ whitelist = None
+ tgid_map = {}
+ cfg = None
+ if nac in self.configs:
+ cfg = self.configs[nac]
+ self.trunked_systems[nac] = trunked_system(debug = self.debug, config=cfg)
+
+ def build_config(self, config_filename):
+ import ConfigParser
+ config = ConfigParser.ConfigParser()
+ config.read(config_filename)
+ configs = {}
+ for section in config.sections():
+ nac = int(config.get(section, 'nac'), 0) # nac required
+ assert nac != 0 # nac=0 not allowed
+ assert nac not in configs # duplicate nac not allowed
+ configs[nac] = {}
+ for option in config.options(section):
+ configs[nac][option] = config.get(section, option).lower()
+ configs[nac]['sysname'] = section
+
+ for nac in configs:
+ self.configs[nac] = {'cclist':[], 'offset':0, 'whitelist':None, 'blacklist':{}, 'tgid_map':{}, 'sysname': configs[nac]['sysname']}
+ for f in configs[nac]['control_channel_list'].split(','):
+ if f.find('.') == -1: # assume in Hz
+ self.configs[nac]['cclist'].append(int(f))
+ else: # assume in MHz due to '.'
+ self.configs[nac]['cclist'].append(int(float(f) * 1000000))
+ if 'offset' in configs[nac]:
+ self.configs[nac]['offset'] = int(configs[nac]['offset'])
+ if 'modulation' in configs[nac]:
+ self.configs[nac]['modulation'] = configs[nac]['modulation']
+ else:
+ self.configs[nac]['modulation'] = 'cqpsk'
+ if 'whitelist' in configs[nac]:
+ self.configs[nac]['whitelist'] = dict.fromkeys([int(d) for d in configs[nac]['whitelist'].split(',')])
+ if 'blacklist' in configs[nac]:
+ self.configs[nac]['blacklist'] = dict.fromkeys([int(d) for d in configs[nac]['blacklist'].split(',')])
+ if 'tgid_tags_file' in configs[nac]:
+ import csv
+ with open(configs[nac]['tgid_tags_file'], 'rb') as csvfile:
+ sreader = csv.reader(csvfile, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
+ for row in sreader:
+ tgid = int(row[0])
+ txt = row[1]
+ self.configs[nac]['tgid_map'][tgid] = txt
+
+ self.add_trunked_system(nac)
+
+ def find_next_tsys(self):
+ self.current_id += 1
+ if self.current_id >= len(self.nacs):
+ self.current_id = 0
+ return self.nacs[self.current_id]
+
+ def to_string(self):
+ s = ''
+ for nac in self.trunked_systems:
+ s += '\n====== NAC 0x%x ====== %s ======\n' % (nac, self.trunked_systems[nac].sysname)
+ s += self.trunked_systems[nac].to_string()
+ return s
+
+ def process_qmsg(self, msg):
+ type = msg.type()
+ updated = 0
+ curr_time = time.time()
+ if type == -2:
+ cmd = msg.to_string()
+ if self.debug > 10:
+ print "process_qmsg: command: %s" % cmd
+ self.update_state(cmd, curr_time)
+ return
+ elif type == -1:
+ print "process_data_unit timeout"
+ self.update_state('timeout', curr_time)
+ return
+ s = msg.to_string()
+ # nac is always 1st two bytes
+ nac = (ord(s[0]) << 8) + ord(s[1])
+ s = s[2:]
+ if self.debug > 10:
+ print "nac %x type %d at %f state %d len %d" %(nac, type, time.time(), self.state, len(s))
+ if (type == 7 or type == 12) and nac not in self.trunked_systems:
+ if not self.configs:
+ # TODO: allow whitelist/blacklist rather than blind automatic-add
+ self.add_trunked_system(nac)
+ else:
+ return
+ if type == 7: # trunk: TSBK
+ t = 0
+ for c in s:
+ t = (t << 8) + ord(c)
+ updated += self.trunked_systems[nac].decode_tsbk(t)
+ elif type == 12: # trunk: MBT
+ s1 = s[:10]
+ s2 = s[10:]
+ header = mbt_data = 0
+ for c in s1:
+ header = (header << 8) + ord(c)
+ for c in s2:
+ mbt_data = (mbt_data << 8) + ord(c)
+ opcode = (header >> 16) & 0x3f
+ if self.debug > 10:
+ print "type %d at %f state %d len %d/%d opcode %x [%x/%x]" %(type, time.time(), self.state, len(s1), len(s2), opcode, header,mbt_data)
+ self.trunked_systems[nac].decode_mbt_data(opcode, header << 16, mbt_data << 32)
+
+ if nac != self.current_nac:
+ return
+
+ if updated:
+ self.update_state('update', curr_time)
+ else:
+ self.update_state('duid%d' % type, curr_time)
+
+ def update_state(self, command, curr_time):
+ if not self.configs:
+ return # run in "manual mode" if no conf
+
+ nac = self.current_nac
+ tsys = self.trunked_systems[nac]
+
+ new_frequency = None
+ new_tgid = None
+ new_state = None
+ new_nac = None
+
+ if command == 'timeout' or command == 'duid15':
+ if self.current_state != self.states.CC:
+ new_state = self.states.CC
+ new_frequency = tsys.trunk_cc
+ elif command == 'update':
+ if self.current_state == self.states.CC:
+ desired_tgid = None
+ if self.tgid_hold_until > curr_time:
+ desired_tgid = self.tgid_hold
+ new_frequency, new_tgid = tsys.find_voice_frequency(curr_time, tgid=desired_tgid)
+ if new_frequency:
+ new_state = self.states.TO_VC
+ self.current_tgid = new_tgid
+ elif command == 'duid3':
+ if self.current_state != self.states.CC:
+ new_state = self.states.CC
+ new_frequency = tsys.trunk_cc
+ elif command == 'duid0' or command == 'duid5' or command == 'duid10':
+ if self.state == self.states.TO_VC:
+ new_state = self.states.VC
+ self.tgid_hold = self.current_tgid
+ self.tgid_hold_until = max(curr_time + self.TGID_HOLD_TIME, self.tgid_hold_until)
+ self.wait_until = curr_time + self.TSYS_HOLD_TIME
+ elif command == 'duid7' or command == 'duid12':
+ pass
+ elif command == 'set_hold':
+ if self.current_tgid:
+ self.tgid_hold = self.current_tgid
+ self.tgid_hold_until = curr_time + 86400 * 10000
+ print 'set hold until %f' % self.tgid_hold_until
+ elif command == 'unset_hold':
+ if self.current_tgid:
+ self.current_tgid = None
+ self.tgid_hold = None
+ self.tgid_hold_until = curr_time
+ elif command == 'skip':
+ pass # TODO
+ elif command == 'lockout':
+ if self.current_tgid:
+ tsys.add_blacklist(self.current_tgid)
+ self.current_tgid = None
+ self.tgid_hold = None
+ self.tgid_hold_until = curr_time
+ if self.current_state != self.states.CC:
+ new_state = self.states.CC
+ new_frequency = tsys.trunk_cc
+ else:
+ print 'update_state: unknown command: %s\n' % command
+ assert 0 == 1
+
+ if self.wait_until <= curr_time and self.tgid_hold_until <= curr_time:
+ self.wait_until = curr_time + self.TSYS_HOLD_TIME
+ new_nac = self.find_next_tsys()
+
+ if new_nac:
+ nac = self.current_nac = new_nac
+ tsys = self.trunked_systems[nac]
+ new_frequency = tsys.trunk_cc
+ self.current_tgid = None
+
+ if new_frequency:
+ self.set_frequency({'freq': new_frequency, 'tgid': self.current_tgid, 'offset': tsys.offset, 'tag': tsys.get_tag(self.current_tgid), 'nac': nac, 'system': tsys.sysname})
+
+ if new_state:
+ self.current_state = new_state
+
+def main():
+ q = 0x3a000012ae01013348704a54
+ rc = crc16(q,12)
+ print "should be zero: %x" % rc
+ assert rc == 0
+
+ q = 0x3a001012ae01013348704a54
+ rc = crc16(q,12)
+ print "should be nonzero: %x" % rc
+ assert rc != 0
+
+ t = trunked_system(debug=255)
+ q = 0x3a000012ae0101334870
+ t.decode_tsbk(q)
+
+ q = 0x02900031210020018e7c
+ t.decode_tsbk(q)
+
+if __name__ == '__main__':
+ main()
diff --git a/op25/gr-op25_repeater/cmake/Modules/CMakeParseArgumentsCopy.cmake b/op25/gr-op25_repeater/cmake/Modules/CMakeParseArgumentsCopy.cmake
new file mode 100644
index 0000000..7ce4c49
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
+# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
+#
+# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
+# parsing the arguments given to that macro or function.
+# It processes the arguments and defines a set of variables which hold the
+# values of the respective options.
+#
+# The <options> argument contains all options for the respective macro,
+# i.e. keywords which can be used when calling the macro without any value
+# following, like e.g. the OPTIONAL keyword of the install() command.
+#
+# The <one_value_keywords> argument contains all keywords for this macro
+# which are followed by one value, like e.g. DESTINATION keyword of the
+# install() command.
+#
+# The <multi_value_keywords> argument contains all keywords for this macro
+# which can be followed by more than one value, like e.g. the TARGETS or
+# FILES keywords of the install() command.
+#
+# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
+# keywords listed in <options>, <one_value_keywords> and
+# <multi_value_keywords> a variable composed of the given <prefix>
+# followed by "_" and the name of the respective keyword.
+# These variables will then hold the respective value from the argument list.
+# For the <options> keywords this will be TRUE or FALSE.
+#
+# All remaining arguments are collected in a variable
+# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
+# your macro was called with unrecognized parameters.
+#
+# As an example here a my_install() macro, which takes similar arguments as the
+# real install() command:
+#
+# function(MY_INSTALL)
+# set(options OPTIONAL FAST)
+# set(oneValueArgs DESTINATION RENAME)
+# set(multiValueArgs TARGETS CONFIGURATIONS)
+# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+# ...
+#
+# Assume my_install() has been called like this:
+# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
+#
+# After the cmake_parse_arguments() call the macro will have set the following
+# variables:
+# MY_INSTALL_OPTIONAL = TRUE
+# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
+# MY_INSTALL_DESTINATION = "bin"
+# MY_INSTALL_RENAME = "" (was not used)
+# MY_INSTALL_TARGETS = "foo;bar"
+# MY_INSTALL_CONFIGURATIONS = "" (was not used)
+# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
+#
+# You can the continue and process these variables.
+#
+# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
+# another recognized keyword follows, this is interpreted as the beginning of
+# the new option.
+# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
+# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
+# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
+
+#=============================================================================
+# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
+ return()
+endif()
+set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
+
+
+function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
+ # first set all result variables to empty/FALSE
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames})
+ set(${prefix}_${arg_name})
+ endforeach(arg_name)
+
+ foreach(option ${_optionNames})
+ set(${prefix}_${option} FALSE)
+ endforeach(option)
+
+ set(${prefix}_UNPARSED_ARGUMENTS)
+
+ set(insideValues FALSE)
+ set(currentArgName)
+
+ # now iterate over all arguments and fill the result variables
+ foreach(currentArg ${ARGN})
+ list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+ list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
+
+ if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
+ if(insideValues)
+ if("${insideValues}" STREQUAL "SINGLE")
+ set(${prefix}_${currentArgName} ${currentArg})
+ set(insideValues FALSE)
+ elseif("${insideValues}" STREQUAL "MULTI")
+ list(APPEND ${prefix}_${currentArgName} ${currentArg})
+ endif()
+ else(insideValues)
+ list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
+ endif(insideValues)
+ else()
+ if(NOT ${optionIndex} EQUAL -1)
+ set(${prefix}_${currentArg} TRUE)
+ set(insideValues FALSE)
+ elseif(NOT ${singleArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "SINGLE")
+ elseif(NOT ${multiArgIndex} EQUAL -1)
+ set(currentArgName ${currentArg})
+ set(${prefix}_${currentArgName})
+ set(insideValues "MULTI")
+ endif()
+ endif()
+
+ endforeach(currentArg)
+
+ # propagate the result variables to the caller:
+ foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
+ set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
+ endforeach(arg_name)
+ set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
+
+endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
diff --git a/op25/gr-op25_repeater/cmake/Modules/FindCppUnit.cmake b/op25/gr-op25_repeater/cmake/Modules/FindCppUnit.cmake
new file mode 100644
index 0000000..9af308f
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/FindCppUnit.cmake
@@ -0,0 +1,36 @@
+# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
+# Modified to use pkg config and use standard var names
+
+#
+# Find the CppUnit includes and library
+#
+# This module defines
+# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
+# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
+# CPPUNIT_FOUND, If false, do not try to use CppUnit.
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_CPPUNIT "cppunit")
+
+FIND_PATH(CPPUNIT_INCLUDE_DIRS
+ NAMES cppunit/TestCase.h
+ HINTS ${PC_CPPUNIT_INCLUDE_DIR}
+ PATHS
+ /usr/local/include
+ /usr/include
+)
+
+FIND_LIBRARY(CPPUNIT_LIBRARIES
+ NAMES cppunit
+ HINTS ${PC_CPPUNIT_LIBDIR}
+ PATHS
+ ${CPPUNIT_INCLUDE_DIRS}/../lib
+ /usr/local/lib
+ /usr/lib
+)
+
+LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
+MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
diff --git a/op25/gr-op25_repeater/cmake/Modules/FindGnuradioRuntime.cmake b/op25/gr-op25_repeater/cmake/Modules/FindGnuradioRuntime.cmake
new file mode 100644
index 0000000..afed684
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/FindGnuradioRuntime.cmake
@@ -0,0 +1,36 @@
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime)
+
+if(PC_GNURADIO_RUNTIME_FOUND)
+ # look for include files
+ FIND_PATH(
+ GNURADIO_RUNTIME_INCLUDE_DIRS
+ NAMES gnuradio/top_block.h
+ HINTS $ENV{GNURADIO_RUNTIME_DIR}/include
+ ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS}
+ ${CMAKE_INSTALL_PREFIX}/include
+ PATHS /usr/local/include
+ /usr/include
+ )
+
+ # look for libs
+ FIND_LIBRARY(
+ GNURADIO_RUNTIME_LIBRARIES
+ NAMES gnuradio-runtime
+ HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
+ ${PC_GNURADIO_RUNTIME_LIBDIR}
+ ${CMAKE_INSTALL_PREFIX}/lib/
+ ${CMAKE_INSTALL_PREFIX}/lib64/
+ PATHS /usr/local/lib
+ /usr/local/lib64
+ /usr/lib
+ /usr/lib64
+ )
+
+ set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND})
+endif(PC_GNURADIO_RUNTIME_FOUND)
+
+INCLUDE(FindPackageHandleStandardArgs)
+# do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used.
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES)
+MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS)
diff --git a/op25/gr-op25_repeater/cmake/Modules/GrMiscUtils.cmake b/op25/gr-op25_repeater/cmake/Modules/GrMiscUtils.cmake
new file mode 100644
index 0000000..9331d5d
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/GrMiscUtils.cmake
@@ -0,0 +1,210 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE)
+
+########################################################################
+# Set global variable macro.
+# Used for subdirectories to export settings.
+# Example: include and library paths.
+########################################################################
+function(GR_SET_GLOBAL var)
+ set(${var} ${ARGN} CACHE INTERNAL "" FORCE)
+endfunction(GR_SET_GLOBAL)
+
+########################################################################
+# Set the pre-processor definition if the condition is true.
+# - def the pre-processor definition to set and condition name
+########################################################################
+function(GR_ADD_COND_DEF def)
+ if(${def})
+ add_definitions(-D${def})
+ endif(${def})
+endfunction(GR_ADD_COND_DEF)
+
+########################################################################
+# Check for a header and conditionally set a compile define.
+# - hdr the relative path to the header file
+# - def the pre-processor definition to set
+########################################################################
+function(GR_CHECK_HDR_N_DEF hdr def)
+ include(CheckIncludeFileCXX)
+ CHECK_INCLUDE_FILE_CXX(${hdr} ${def})
+ GR_ADD_COND_DEF(${def})
+endfunction(GR_CHECK_HDR_N_DEF)
+
+########################################################################
+# Include subdirectory macro.
+# Sets the CMake directory variables,
+# includes the subdirectory CMakeLists.txt,
+# resets the CMake directory variables.
+#
+# This macro includes subdirectories rather than adding them
+# so that the subdirectory can affect variables in the level above.
+# This provides a work-around for the lack of convenience libraries.
+# This way a subdirectory can append to the list of library sources.
+########################################################################
+macro(GR_INCLUDE_SUBDIRECTORY subdir)
+ #insert the current directories on the front of the list
+ list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR})
+ list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR})
+
+ #set the current directories to the names of the subdirs
+ set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
+ set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir})
+
+ #include the subdirectory CMakeLists to run it
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+
+ #reset the value of the current directories
+ list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR)
+ list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR)
+
+ #pop the subdir names of the front of the list
+ list(REMOVE_AT _cmake_source_dirs 0)
+ list(REMOVE_AT _cmake_binary_dirs 0)
+endmacro(GR_INCLUDE_SUBDIRECTORY)
+
+########################################################################
+# Check if a compiler flag works and conditionally set a compile define.
+# - flag the compiler flag to check for
+# - have the variable to set with result
+########################################################################
+macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have)
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG(${flag} ${have})
+ if(${have})
+ add_definitions(${flag})
+ endif(${have})
+endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE)
+
+########################################################################
+# Generates the .la libtool file
+# This appears to generate libtool files that cannot be used by auto*.
+# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest])
+# Notice: there is not COMPONENT option, these will not get distributed.
+########################################################################
+function(GR_LIBTOOL)
+ if(NOT DEFINED GENERATE_LIBTOOL)
+ set(GENERATE_LIBTOOL OFF) #disabled by default
+ endif()
+
+ if(GENERATE_LIBTOOL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN})
+
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION})
+ endif(LIBTOOL)
+ endif(GENERATE_LIBTOOL)
+
+endfunction(GR_LIBTOOL)
+
+########################################################################
+# Do standard things to the library target
+# - set target properties
+# - make install rules
+# Also handle gnuradio custom naming conventions w/ extras mode.
+########################################################################
+function(GR_LIBRARY_FOO target)
+ #parse the arguments for component names
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN})
+
+ #set additional target properties
+ set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER})
+
+ #install the generated files like so...
+ install(TARGETS ${target}
+ LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file
+ ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file
+ RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file
+ )
+
+ #extras mode enabled automatically on linux
+ if(NOT DEFINED LIBRARY_EXTRAS)
+ set(LIBRARY_EXTRAS ${LINUX})
+ endif()
+
+ #special extras mode to enable alternative naming conventions
+ if(LIBRARY_EXTRAS)
+
+ #create .la file before changing props
+ GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR})
+
+ #give the library a special name with ultra-zero soversion
+ set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
+ set(target_name lib${target}-${LIBVER}.so.0.0.0)
+
+ #custom command to generate symlinks
+ add_custom_command(
+ TARGET ${target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install
+ )
+
+ #and install the extra symlinks
+ install(
+ FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so
+ ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0
+ DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT}
+ )
+
+ endif(LIBRARY_EXTRAS)
+endfunction(GR_LIBRARY_FOO)
+
+########################################################################
+# Create a dummy custom command that depends on other targets.
+# Usage:
+# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...)
+# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps})
+#
+# Custom command cant depend on targets, but can depend on executables,
+# and executables can depend on targets. So this is the process:
+########################################################################
+function(GR_GEN_TARGET_DEPS name var)
+ file(
+ WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ "int main(void){return 0;}\n"
+ )
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp
+ )
+ add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp)
+ if(ARGN)
+ add_dependencies(${name} ${ARGN})
+ endif(ARGN)
+
+ if(CMAKE_CROSSCOMPILING)
+ set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross
+ else()
+ set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE)
+ endif()
+endfunction(GR_GEN_TARGET_DEPS)
diff --git a/op25/gr-op25_repeater/cmake/Modules/GrPlatform.cmake b/op25/gr-op25_repeater/cmake/Modules/GrPlatform.cmake
new file mode 100644
index 0000000..a2e4f3b
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/GrPlatform.cmake
@@ -0,0 +1,46 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
+
+########################################################################
+# Setup additional defines for OS types
+########################################################################
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LINUX TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/debian_version")
+ set(DEBIAN TRUE)
+endif()
+
+if(LINUX AND EXISTS "/etc/redhat-release")
+ set(REDHAT TRUE)
+endif()
+
+########################################################################
+# when the library suffix should be 64 (applies to redhat linux family)
+########################################################################
+if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
+ set(LIB_SUFFIX 64)
+endif()
+set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
diff --git a/op25/gr-op25_repeater/cmake/Modules/GrPython.cmake b/op25/gr-op25_repeater/cmake/Modules/GrPython.cmake
new file mode 100644
index 0000000..68ca58e
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/GrPython.cmake
@@ -0,0 +1,227 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_PYTHON_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
+
+########################################################################
+# Setup the python interpreter:
+# This allows the user to specify a specific interpreter,
+# or finds the interpreter via the built-in cmake module.
+########################################################################
+#this allows the user to override PYTHON_EXECUTABLE
+if(PYTHON_EXECUTABLE)
+
+ set(PYTHONINTERP_FOUND TRUE)
+
+#otherwise if not set, try to automatically find it
+else(PYTHON_EXECUTABLE)
+
+ #use the built-in find script
+ find_package(PythonInterp 2)
+
+ #and if that fails use the find program routine
+ if(NOT PYTHONINTERP_FOUND)
+ find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
+ if(PYTHON_EXECUTABLE)
+ set(PYTHONINTERP_FOUND TRUE)
+ endif(PYTHON_EXECUTABLE)
+ endif(NOT PYTHONINTERP_FOUND)
+
+endif(PYTHON_EXECUTABLE)
+
+#make the path to the executable appear in the cmake gui
+set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
+
+#make sure we can use -B with python (introduced in 2.6)
+if(PYTHON_EXECUTABLE)
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -B -c ""
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
+ )
+ if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
+ set(PYTHON_DASH_B "-B")
+ endif()
+endif(PYTHON_EXECUTABLE)
+
+########################################################################
+# Check for the existence of a python module:
+# - desc a string description of the check
+# - mod the name of the module to import
+# - cmd an additional command to run
+# - have the result variable to set
+########################################################################
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ message(STATUS "")
+ message(STATUS "Python checking for ${desc}")
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "
+#########################################
+try: import ${mod}
+except: exit(-1)
+try: assert ${cmd}
+except: exit(-1)
+#########################################"
+ RESULT_VARIABLE ${have}
+ )
+ if(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else(${have} EQUAL 0)
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif(${have} EQUAL 0)
+endmacro(GR_PYTHON_CHECK_MODULE)
+
+########################################################################
+# Sets the python installation directory GR_PYTHON_DIR
+########################################################################
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
+from distutils import sysconfig
+print sysconfig.get_python_lib(plat_specific=True, prefix='')
+" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
+
+########################################################################
+# Create an always-built target with a unique name
+# Usage: GR_UNIQUE_TARGET(<description> <dependencies list>)
+########################################################################
+function(GR_UNIQUE_TARGET desc)
+ file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
+unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
+ OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
+ add_custom_target(${_target} ALL DEPENDS ${ARGN})
+endfunction(GR_UNIQUE_TARGET)
+
+########################################################################
+# Install python sources (also builds and installs byte-compiled python)
+########################################################################
+function(GR_PYTHON_INSTALL)
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN})
+
+ ####################################################################
+ if(GR_PYTHON_INSTALL_FILES)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
+ foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
+
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
+
+ endforeach(pyfile)
+
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
+ ####################################################################
+ elseif(GR_PYTHON_INSTALL_PROGRAMS)
+ ####################################################################
+ file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
+
+ foreach(pyfile ${GR_PYTHON_INSTALL_PROGRAMS})
+ get_filename_component(pyfile_name ${pyfile} NAME)
+ get_filename_component(pyfile ${pyfile} ABSOLUTE)
+ string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pyexefile "${pyfile}.exe")
+ list(APPEND python_install_gen_targets ${pyexefile})
+
+ get_filename_component(pyexefile_path ${pyexefile} PATH)
+ file(MAKE_DIRECTORY ${pyexefile_path})
+
+ add_custom_command(
+ OUTPUT ${pyexefile} DEPENDS ${pyfile}
+ COMMAND ${PYTHON_EXECUTABLE} -c
+ \"open('${pyexefile}', 'w').write('\#!${pyexe_native}\\n'+open('${pyfile}').read())\"
+ COMMENT "Shebangin ${pyfile_name}"
+ )
+
+ #on windows, python files need an extension to execute
+ get_filename_component(pyfile_ext ${pyfile} EXT)
+ if(WIN32 AND NOT pyfile_ext)
+ set(pyfile_name "${pyfile_name}.py")
+ endif()
+
+ install(PROGRAMS ${pyexefile} RENAME ${pyfile_name}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+ endforeach(pyfile)
+
+ endif()
+
+ GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
+
+endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/op25/gr-op25_repeater/cmake/Modules/GrSwig.cmake b/op25/gr-op25_repeater/cmake/Modules/GrSwig.cmake
new file mode 100644
index 0000000..569667b
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/GrSwig.cmake
@@ -0,0 +1,229 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_SWIG_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_SWIG_CMAKE TRUE)
+
+include(GrPython)
+
+########################################################################
+# Builds a swig documentation file to be generated into python docstrings
+# Usage: GR_SWIG_MAKE_DOCS(output_file input_path input_path....)
+#
+# Set the following variable to specify extra dependent targets:
+# - GR_SWIG_DOCS_SOURCE_DEPS
+# - GR_SWIG_DOCS_TARGET_DEPS
+########################################################################
+function(GR_SWIG_MAKE_DOCS output_file)
+ find_package(Doxygen)
+ if(DOXYGEN_FOUND)
+
+ #setup the input files variable list, quote formated
+ set(input_files)
+ unset(INPUT_PATHS)
+ foreach(input_path ${ARGN})
+ if (IS_DIRECTORY ${input_path}) #when input path is a directory
+ file(GLOB input_path_h_files ${input_path}/*.h)
+ else() #otherwise its just a file, no glob
+ set(input_path_h_files ${input_path})
+ endif()
+ list(APPEND input_files ${input_path_h_files})
+ set(INPUT_PATHS "${INPUT_PATHS} \"${input_path}\"")
+ endforeach(input_path)
+
+ #determine the output directory
+ get_filename_component(name ${output_file} NAME_WE)
+ get_filename_component(OUTPUT_DIRECTORY ${output_file} PATH)
+ set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}/${name}_swig_docs)
+ make_directory(${OUTPUT_DIRECTORY})
+
+ #generate the Doxyfile used by doxygen
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.swig_doc.in
+ ${OUTPUT_DIRECTORY}/Doxyfile
+ @ONLY)
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_tag tag_deps ${GR_SWIG_DOCS_TARGET_DEPS})
+
+ #call doxygen on the Doxyfile + input headers
+ add_custom_command(
+ OUTPUT ${OUTPUT_DIRECTORY}/xml/index.xml
+ DEPENDS ${input_files} ${GR_SWIG_DOCS_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${OUTPUT_DIRECTORY}/Doxyfile
+ COMMENT "Generating doxygen xml for ${name} docs"
+ )
+
+ #call the swig_doc script on the xml files
+ add_custom_command(
+ OUTPUT ${output_file}
+ DEPENDS ${input_files} ${OUTPUT_DIRECTORY}/xml/index.xml
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
+ ${OUTPUT_DIRECTORY}/xml
+ ${output_file}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/doxygen
+ )
+
+ else(DOXYGEN_FOUND)
+ file(WRITE ${output_file} "\n") #no doxygen -> empty file
+ endif(DOXYGEN_FOUND)
+endfunction(GR_SWIG_MAKE_DOCS)
+
+########################################################################
+# Build a swig target for the common gnuradio use case. Usage:
+# GR_SWIG_MAKE(target ifile ifile ifile...)
+#
+# Set the following variables before calling:
+# - GR_SWIG_FLAGS
+# - GR_SWIG_INCLUDE_DIRS
+# - GR_SWIG_LIBRARIES
+# - GR_SWIG_SOURCE_DEPS
+# - GR_SWIG_TARGET_DEPS
+# - GR_SWIG_DOC_FILE
+# - GR_SWIG_DOC_DIRS
+########################################################################
+macro(GR_SWIG_MAKE name)
+ set(ifiles ${ARGN})
+
+ #do swig doc generation if specified
+ if (GR_SWIG_DOC_FILE)
+ set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
+ set(GR_SWIG_DOCS_TAREGT_DEPS ${GR_SWIG_TARGET_DEPS})
+ GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
+ list(APPEND GR_SWIG_SOURCE_DEPS ${GR_SWIG_DOC_FILE})
+ endif()
+
+ #append additional include directories
+ find_package(PythonLibs 2)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
+
+ #determine include dependencies for swig file
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${CMAKE_BINARY_DIR}/get_swig_deps.py
+ "${ifiles}" "${GR_SWIG_INCLUDE_DIRS}"
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ OUTPUT_VARIABLE SWIG_MODULE_${name}_EXTRA_DEPS
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
+ #Create a dummy custom command that depends on other targets
+ include(GrMiscUtils)
+ GR_GEN_TARGET_DEPS(_${name}_swig_tag tag_deps ${GR_SWIG_TARGET_DEPS})
+ set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
+ add_custom_command(
+ OUTPUT ${tag_file}
+ DEPENDS ${GR_SWIG_SOURCE_DEPS} ${tag_deps}
+ COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
+ )
+
+ #append the specified include directories
+ include_directories(${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+
+ #setup the swig flags with flags and include directories
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -module ${name} ${GR_SWIG_FLAGS})
+ foreach(dir ${GR_SWIG_INCLUDE_DIRS})
+ list(APPEND CMAKE_SWIG_FLAGS "-I${dir}")
+ endforeach(dir)
+
+ #set the C++ property on the swig .i file so it builds
+ set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
+
+ #setup the actual swig library target to be built
+ include(UseSWIG)
+ SWIG_ADD_MODULE(${name} python ${ifiles})
+ SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
+
+endmacro(GR_SWIG_MAKE)
+
+########################################################################
+# Install swig targets generated by GR_SWIG_MAKE. Usage:
+# GR_SWIG_INSTALL(
+# TARGETS target target target...
+# [DESTINATION destination]
+# [COMPONENT component]
+# )
+########################################################################
+macro(GR_SWIG_INSTALL)
+
+ include(CMakeParseArgumentsCopy)
+ CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
+
+ foreach(name ${GR_SWIG_INSTALL_TARGETS})
+ install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ include(GrPython)
+ GR_PYTHON_INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.py
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
+ )
+
+ GR_LIBTOOL(
+ TARGET ${SWIG_MODULE_${name}_REAL_NAME}
+ DESTINATION ${GR_SWIG_INSTALL_DESTINATION}
+ )
+
+ endforeach(name)
+
+endmacro(GR_SWIG_INSTALL)
+
+########################################################################
+# Generate a python file that can determine swig dependencies.
+# Used by the make macro above to determine extra dependencies.
+# When you build C++, CMake figures out the header dependencies.
+# This code essentially performs that logic for swig includes.
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
+
+import os, sys, re
+
+include_matcher = re.compile('[#|%]include\\s*[<|\"](.*)[>|\"]')
+include_dirs = sys.argv[2].split(';')
+
+def get_swig_incs(file_path):
+ file_contents = open(file_path, 'r').read()
+ return include_matcher.findall(file_contents, re.MULTILINE)
+
+def get_swig_deps(file_path, level):
+ deps = [file_path]
+ if level == 0: return deps
+ for inc_file in get_swig_incs(file_path):
+ for inc_dir in include_dirs:
+ inc_path = os.path.join(inc_dir, inc_file)
+ if not os.path.exists(inc_path): continue
+ deps.extend(get_swig_deps(inc_path, level-1))
+ return deps
+
+if __name__ == '__main__':
+ ifiles = sys.argv[1].split(';')
+ deps = sum([get_swig_deps(ifile, 3) for ifile in ifiles], [])
+ #sys.stderr.write(';'.join(set(deps)) + '\\n\\n')
+ print(';'.join(set(deps)))
+")
diff --git a/op25/gr-op25_repeater/cmake/Modules/GrTest.cmake b/op25/gr-op25_repeater/cmake/Modules/GrTest.cmake
new file mode 100644
index 0000000..6174c03
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/Modules/GrTest.cmake
@@ -0,0 +1,133 @@
+# 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.
+
+if(DEFINED __INCLUDED_GR_TEST_CMAKE)
+ return()
+endif()
+set(__INCLUDED_GR_TEST_CMAKE TRUE)
+
+########################################################################
+# Add a unit test and setup the environment for a unit test.
+# Takes the same arguments as the ADD_TEST function.
+#
+# Before calling set the following variables:
+# GR_TEST_TARGET_DEPS - built targets for the library path
+# GR_TEST_LIBRARY_DIRS - directories for the library path
+# GR_TEST_PYTHON_DIRS - directories for the python path
+########################################################################
+function(GR_ADD_TEST test_name)
+
+ if(WIN32)
+ #Ensure that the build exe also appears in the PATH.
+ list(APPEND GR_TEST_TARGET_DEPS ${ARGN})
+
+ #In the land of windows, all libraries must be in the PATH.
+ #Since the dependent libraries are not yet installed,
+ #we must manually set them in the PATH to run tests.
+ #The following appends the path of a target dependency.
+ foreach(target ${GR_TEST_TARGET_DEPS})
+ get_target_property(location ${target} LOCATION)
+ if(location)
+ get_filename_component(path ${location} PATH)
+ string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
+ list(APPEND GR_TEST_LIBRARY_DIRS ${path})
+ endif(location)
+ endforeach(target)
+
+ #SWIG generates the python library files into a subdirectory.
+ #Therefore, we must append this subdirectory into PYTHONPATH.
+ #Only do this for the python directories matching the following:
+ foreach(pydir ${GR_TEST_PYTHON_DIRS})
+ get_filename_component(name ${pydir} NAME)
+ if(name MATCHES "^(swig|lib|src)$")
+ list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE})
+ endif()
+ endforeach(pydir)
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
+ file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list?
+
+ set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}")
+
+ #http://www.cmake.org/pipermail/cmake/2009-May/029464.html
+ #Replaced this add test + set environs code with the shell script generation.
+ #Its nicer to be able to manually run the shell script to diagnose problems.
+ #ADD_TEST(${ARGV})
+ #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}")
+
+ if(UNIX)
+ set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH")
+ #set both LD and DYLD paths to cover multiple UNIX OS library paths
+ list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH")
+ list(APPEND pypath "$PYTHONPATH")
+
+ #replace list separator with the path separator
+ string(REPLACE ";" ":" libpath "${libpath}")
+ string(REPLACE ";" ":" pypath "${pypath}")
+ list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ find_program(SHELL sh)
+ set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh)
+ file(WRITE ${sh_file} "#!${SHELL}\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${sh_file} "export ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${sh_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${sh_file} "\n")
+
+ #make the shell file executable
+ execute_process(COMMAND chmod +x ${sh_file})
+
+ add_test(${test_name} ${SHELL} ${sh_file})
+
+ endif(UNIX)
+
+ if(WIN32)
+ list(APPEND libpath ${DLL_PATHS} "%PATH%")
+ list(APPEND pypath "%PYTHONPATH%")
+
+ #replace list separator with the path separator (escaped)
+ string(REPLACE ";" "\\;" libpath "${libpath}")
+ string(REPLACE ";" "\\;" pypath "${pypath}")
+ list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}")
+
+ #generate a bat file that sets the environment and runs the test
+ set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat)
+ file(WRITE ${bat_file} "@echo off\n")
+ #each line sets an environment variable
+ foreach(environ ${environs})
+ file(APPEND ${bat_file} "SET ${environ}\n")
+ endforeach(environ)
+ #load the command to run with its arguments
+ foreach(arg ${ARGN})
+ file(APPEND ${bat_file} "${arg} ")
+ endforeach(arg)
+ file(APPEND ${bat_file} "\n")
+
+ add_test(${test_name} ${bat_file})
+ endif(WIN32)
+
+endfunction(GR_ADD_TEST)
diff --git a/op25/gr-op25_repeater/cmake/cmake_uninstall.cmake.in b/op25/gr-op25_repeater/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..9ae1ae4
--- /dev/null
+++ b/op25/gr-op25_repeater/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,32 @@
+# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
+
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ IF(EXISTS "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF(NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
+ENDFOREACH(file)
diff --git a/op25/gr-op25_repeater/docs/CMakeLists.txt b/op25/gr-op25_repeater/docs/CMakeLists.txt
new file mode 100644
index 0000000..f16fbf6
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 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 dependencies
+########################################################################
+find_package(Doxygen)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_DOXYGEN)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(doxygen)
+
+endif(ENABLE_DOXYGEN)
diff --git a/op25/gr-op25_repeater/docs/README.op25_repeater b/op25/gr-op25_repeater/docs/README.op25_repeater
new file mode 100644
index 0000000..a857e07
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/README.op25_repeater
@@ -0,0 +1,11 @@
+This is the op25_repeater-write-a-block package meant as a guide to building
+out-of-tree packages. To use the op25_repeater blocks, the Python namespaces
+is in 'op25_repeater', which is imported as:
+
+ import op25_repeater
+
+See the Doxygen documentation for details about the blocks available
+in this package. A quick listing of the details can be found in Python
+after importing by using:
+
+ help(op25_repeater)
diff --git a/op25/gr-op25_repeater/docs/doxygen/CMakeLists.txt b/op25/gr-op25_repeater/docs/doxygen/CMakeLists.txt
new file mode 100644
index 0000000..1b44799
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/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.
+
+########################################################################
+# Create the doxygen configuration file
+########################################################################
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir)
+file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir)
+file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir)
+
+set(HAVE_DOT ${DOXYGEN_DOT_FOUND})
+set(enable_html_docs YES)
+set(enable_latex_docs NO)
+set(enable_xml_docs YES)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+@ONLY)
+
+set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
+
+########################################################################
+# Make and install doxygen docs
+########################################################################
+add_custom_command(
+ OUTPUT ${BUILT_DIRS}
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Generating documentation with doxygen"
+)
+
+add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS})
+
+install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR})
diff --git a/op25/gr-op25_repeater/docs/doxygen/Doxyfile.in b/op25/gr-op25_repeater/docs/doxygen/Doxyfile.in
new file mode 100644
index 0000000..ae2d638
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/Doxyfile.in
@@ -0,0 +1,1504 @@
+# Doxyfile 1.5.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "GNU Radio's OP25_REPEATER Package"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
+# Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 4
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = NO
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = NO
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = NO
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @top_srcdir@ @top_builddir@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h \
+ *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = @abs_top_builddir@/docs/doxygen/html \
+ @abs_top_builddir@/docs/doxygen/xml \
+ @abs_top_builddir@/docs/doxygen/other/doxypy.py \
+ @abs_top_builddir@/_CPack_Packages \
+ @abs_top_srcdir@/cmake
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS = */.deps/* \
+ */.libs/* \
+ */.svn/* \
+ */CVS/* \
+ */__init__.py \
+ */qa_*.cc \
+ */qa_*.h \
+ */qa_*.py
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS = ad9862 \
+ numpy \
+ *swig* \
+ *Swig* \
+ *my_top_block* \
+ *my_graph* \
+ *app_top_block* \
+ *am_rx_graph* \
+ *_queue_watcher_thread* \
+ *parse* \
+ *MyFrame* \
+ *MyApp* \
+ *PyObject* \
+ *wfm_rx_block* \
+ *_sptr* \
+ *debug* \
+ *wfm_rx_sca_block* \
+ *tv_rx_block* \
+ *wxapt_rx_block* \
+ *example_signal*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS = *.py=@top_srcdir@/doc/doxygen/other/doxypy.py
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = @enable_html_docs@
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#namespace">Qt Help Project / Namespace</a>.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#virtual-folders">Qt Help Project / Virtual Folders</a>.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file .
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = YES
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 180
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = @enable_latex_docs@
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = @enable_xml_docs@
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = @HAVE_DOT@
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/op25/gr-op25_repeater/docs/doxygen/Doxyfile.swig_doc.in b/op25/gr-op25_repeater/docs/doxygen/Doxyfile.swig_doc.in
new file mode 100644
index 0000000..50b8aa8
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/Doxyfile.swig_doc.in
@@ -0,0 +1,1514 @@
+# Doxyfile 1.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = @CPACK_PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = @CPACK_PACKAGE_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = @INPUT_PATHS@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE =
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP)
+# there is already a search function so this one should typically
+# be disabled.
+
+SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = YES
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = FreeSans
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/__init__.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/__init__.py
new file mode 100644
index 0000000..5cd0b3c
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/__init__.py
@@ -0,0 +1,82 @@
+#
+# 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.
+#
+"""
+Python interface to contents of doxygen xml documentation.
+
+Example use:
+See the contents of the example folder for the C++ and
+doxygen-generated xml used in this example.
+
+>>> # Parse the doxygen docs.
+>>> import os
+>>> this_dir = os.path.dirname(globals()['__file__'])
+>>> xml_path = this_dir + "/example/xml/"
+>>> di = DoxyIndex(xml_path)
+
+Get a list of all top-level objects.
+
+>>> print([mem.name() for mem in di.members()])
+[u'Aadvark', u'aadvarky_enough', u'main']
+
+Get all functions.
+
+>>> print([mem.name() for mem in di.in_category(DoxyFunction)])
+[u'aadvarky_enough', u'main']
+
+Check if an object is present.
+
+>>> di.has_member(u'Aadvark')
+True
+>>> di.has_member(u'Fish')
+False
+
+Get an item by name and check its properties.
+
+>>> aad = di.get_member(u'Aadvark')
+>>> print(aad.brief_description)
+Models the mammal Aadvark.
+>>> print(aad.detailed_description)
+Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
+<BLANKLINE>
+This line is uninformative and is only to test line breaks in the comments.
+>>> [mem.name() for mem in aad.members()]
+[u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness']
+>>> aad.get_member(u'print').brief_description
+u'Outputs the vital aadvark statistics.'
+
+"""
+
+from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+
+def _test():
+ import os
+ this_dir = os.path.dirname(globals()['__file__'])
+ xml_path = this_dir + "/example/xml/"
+ di = DoxyIndex(xml_path)
+ # Get the Aadvark class
+ aad = di.get_member('Aadvark')
+ aad.brief_description
+ import doctest
+ return doctest.testmod()
+
+if __name__ == "__main__":
+ _test()
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/base.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/base.py
new file mode 100644
index 0000000..e8f026a
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/base.py
@@ -0,0 +1,219 @@
+#
+# 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.
+#
+"""
+A base class is created.
+
+Classes based upon this are used to make more user-friendly interfaces
+to the doxygen xml docs than the generated classes provide.
+"""
+
+import os
+import pdb
+
+from xml.parsers.expat import ExpatError
+
+from generated import compound
+
+
+class Base(object):
+
+ class Duplicate(StandardError):
+ pass
+
+ class NoSuchMember(StandardError):
+ pass
+
+ class ParsingError(StandardError):
+ pass
+
+ def __init__(self, parse_data, top=None):
+ self._parsed = False
+ self._error = False
+ self._parse_data = parse_data
+ self._members = []
+ self._dict_members = {}
+ self._in_category = {}
+ self._data = {}
+ if top is not None:
+ self._xml_path = top._xml_path
+ # Set up holder of references
+ else:
+ top = self
+ self._refs = {}
+ self._xml_path = parse_data
+ self.top = top
+
+ @classmethod
+ def from_refid(cls, refid, top=None):
+ """ Instantiate class from a refid rather than parsing object. """
+ # First check to see if its already been instantiated.
+ if top is not None and refid in top._refs:
+ return top._refs[refid]
+ # Otherwise create a new instance and set refid.
+ inst = cls(None, top=top)
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ @classmethod
+ def from_parse_data(cls, parse_data, top=None):
+ refid = getattr(parse_data, 'refid', None)
+ if refid is not None and top is not None and refid in top._refs:
+ return top._refs[refid]
+ inst = cls(parse_data, top=top)
+ if refid is not None:
+ inst.refid = refid
+ inst.add_ref(inst)
+ return inst
+
+ def add_ref(self, obj):
+ if hasattr(obj, 'refid'):
+ self.top._refs[obj.refid] = obj
+
+ mem_classes = []
+
+ def get_cls(self, mem):
+ for cls in self.mem_classes:
+ if cls.can_parse(mem):
+ return cls
+ raise StandardError(("Did not find a class for object '%s'." \
+ % (mem.get_name())))
+
+ def convert_mem(self, mem):
+ try:
+ cls = self.get_cls(mem)
+ converted = cls.from_parse_data(mem, self.top)
+ if converted is None:
+ raise StandardError('No class matched this object.')
+ self.add_ref(converted)
+ return converted
+ except StandardError, e:
+ print e
+
+ @classmethod
+ def includes(cls, inst):
+ return isinstance(inst, cls)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return False
+
+ def _parse(self):
+ self._parsed = True
+
+ def _get_dict_members(self, cat=None):
+ """
+ For given category a dictionary is returned mapping member names to
+ members of that category. For names that are duplicated the name is
+ mapped to None.
+ """
+ self.confirm_no_error()
+ if cat not in self._dict_members:
+ new_dict = {}
+ for mem in self.in_category(cat):
+ if mem.name() not in new_dict:
+ new_dict[mem.name()] = mem
+ else:
+ new_dict[mem.name()] = self.Duplicate
+ self._dict_members[cat] = new_dict
+ return self._dict_members[cat]
+
+ def in_category(self, cat):
+ self.confirm_no_error()
+ if cat is None:
+ return self._members
+ if cat not in self._in_category:
+ self._in_category[cat] = [mem for mem in self._members
+ if cat.includes(mem)]
+ return self._in_category[cat]
+
+ def get_member(self, name, cat=None):
+ self.confirm_no_error()
+ # Check if it's in a namespace or class.
+ bits = name.split('::')
+ first = bits[0]
+ rest = '::'.join(bits[1:])
+ member = self._get_dict_members(cat).get(first, self.NoSuchMember)
+ # Raise any errors that are returned.
+ if member in set([self.NoSuchMember, self.Duplicate]):
+ raise member()
+ if rest:
+ return member.get_member(rest, cat=cat)
+ return member
+
+ def has_member(self, name, cat=None):
+ try:
+ mem = self.get_member(name, cat=cat)
+ return True
+ except self.NoSuchMember:
+ return False
+
+ def data(self):
+ self.confirm_no_error()
+ return self._data
+
+ def members(self):
+ self.confirm_no_error()
+ return self._members
+
+ def process_memberdefs(self):
+ mdtss = []
+ for sec in self._retrieved_data.compounddef.sectiondef:
+ mdtss += sec.memberdef
+ # At the moment we lose all information associated with sections.
+ # Sometimes a memberdef is in several sectiondef.
+ # We make sure we don't get duplicates here.
+ uniques = set([])
+ for mem in mdtss:
+ converted = self.convert_mem(mem)
+ pair = (mem.name, mem.__class__)
+ if pair not in uniques:
+ uniques.add(pair)
+ self._members.append(converted)
+
+ def retrieve_data(self):
+ filename = os.path.join(self._xml_path, self.refid + '.xml')
+ try:
+ self._retrieved_data = compound.parse(filename)
+ except ExpatError:
+ print('Error in xml in file %s' % filename)
+ self._error = True
+ self._retrieved_data = None
+
+ def check_parsed(self):
+ if not self._parsed:
+ self._parse()
+
+ def confirm_no_error(self):
+ self.check_parsed()
+ if self._error:
+ raise self.ParsingError()
+
+ def error(self):
+ self.check_parsed()
+ return self._error
+
+ def name(self):
+ # first see if we can do it without processing.
+ if self._parse_data is not None:
+ return self._parse_data.name
+ self.check_parsed()
+ return self._retrieved_data.compounddef.name
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/doxyindex.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/doxyindex.py
new file mode 100644
index 0000000..0132ab8
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/doxyindex.py
@@ -0,0 +1,237 @@
+#
+# 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.
+#
+"""
+Classes providing more user-friendly interfaces to the doxygen xml
+docs than the generated classes provide.
+"""
+
+import os
+
+from generated import index
+from base import Base
+from text import description
+
+class DoxyIndex(Base):
+ """
+ Parses a doxygen xml directory.
+ """
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyIndex, self)._parse()
+ self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
+ for mem in self._root.compound:
+ converted = self.convert_mem(mem)
+ # For files we want the contents to be accessible directly
+ # from the parent rather than having to go through the file
+ # object.
+ if self.get_cls(mem) == DoxyFile:
+ if mem.name.endswith('.h'):
+ self._members += converted.members()
+ self._members.append(converted)
+ else:
+ self._members.append(converted)
+
+
+def generate_swig_doc_i(self):
+ """
+ %feature("docstring") gr_make_align_on_samplenumbers_ss::align_state "
+ Wraps the C++: gr_align_on_samplenumbers_ss::align_state";
+ """
+ pass
+
+
+class DoxyCompMem(Base):
+
+
+ kind = None
+
+ def __init__(self, *args, **kwargs):
+ super(DoxyCompMem, self).__init__(*args, **kwargs)
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind == cls.kind
+
+ def set_descriptions(self, parse_data):
+ bd = description(getattr(parse_data, 'briefdescription', None))
+ dd = description(getattr(parse_data, 'detaileddescription', None))
+ self._data['brief_description'] = bd
+ self._data['detailed_description'] = dd
+
+class DoxyCompound(DoxyCompMem):
+ pass
+
+class DoxyMember(DoxyCompMem):
+ pass
+
+
+class DoxyFunction(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'function'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFunction, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['params'] = []
+ prms = self._parse_data.param
+ for prm in prms:
+ self._data['params'].append(DoxyParam(prm))
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ params = property(lambda self: self.data()['params'])
+
+Base.mem_classes.append(DoxyFunction)
+
+
+class DoxyParam(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyParam, self)._parse()
+ self.set_descriptions(self._parse_data)
+ self._data['declname'] = self._parse_data.declname
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+ declname = property(lambda self: self.data()['declname'])
+
+class DoxyClass(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'class'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyClass, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ self.set_descriptions(self._retrieved_data.compounddef)
+ # Sectiondef.kind tells about whether private or public.
+ # We just ignore this for now.
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyClass)
+
+
+class DoxyFile(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'file'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyFile, self)._parse()
+ self.retrieve_data()
+ self.set_descriptions(self._retrieved_data.compounddef)
+ if self._error:
+ return
+ self.process_memberdefs()
+
+ brief_description = property(lambda self: self.data()['brief_description'])
+ detailed_description = property(lambda self: self.data()['detailed_description'])
+
+Base.mem_classes.append(DoxyFile)
+
+
+class DoxyNamespace(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'namespace'
+
+Base.mem_classes.append(DoxyNamespace)
+
+
+class DoxyGroup(DoxyCompound):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'group'
+
+ def _parse(self):
+ if self._parsed:
+ return
+ super(DoxyGroup, self)._parse()
+ self.retrieve_data()
+ if self._error:
+ return
+ cdef = self._retrieved_data.compounddef
+ self._data['title'] = description(cdef.title)
+ # Process inner groups
+ grps = cdef.innergroup
+ for grp in grps:
+ converted = DoxyGroup.from_refid(grp.refid, top=self.top)
+ self._members.append(converted)
+ # Process inner classes
+ klasses = cdef.innerclass
+ for kls in klasses:
+ converted = DoxyClass.from_refid(kls.refid, top=self.top)
+ self._members.append(converted)
+ # Process normal members
+ self.process_memberdefs()
+
+ title = property(lambda self: self.data()['title'])
+
+
+Base.mem_classes.append(DoxyGroup)
+
+
+class DoxyFriend(DoxyMember):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kind = 'friend'
+
+Base.mem_classes.append(DoxyFriend)
+
+
+class DoxyOther(Base):
+
+ __module__ = "gnuradio.utils.doxyxml"
+
+ kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum', 'dir', 'page'])
+
+ @classmethod
+ def can_parse(cls, obj):
+ return obj.kind in cls.kinds
+
+Base.mem_classes.append(DoxyOther)
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/__init__.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/__init__.py
new file mode 100644
index 0000000..3982397
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/__init__.py
@@ -0,0 +1,7 @@
+"""
+Contains generated files produced by generateDS.py.
+
+These do the real work of parsing the doxygen xml files but the
+resultant classes are not very friendly to navigate so the rest of the
+doxyxml module processes them further.
+"""
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compound.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compound.py
new file mode 100644
index 0000000..1522ac2
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compound.py
@@ -0,0 +1,503 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+import sys
+
+import compoundsuper as supermod
+from compoundsuper import MixedContainer
+
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compounddef=None):
+ supermod.DoxygenType.__init__(self, version, compounddef)
+
+ def find(self, details):
+
+ return self.compounddef.find(details)
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class compounddefTypeSub(supermod.compounddefType):
+ def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers)
+
+ def find(self, details):
+
+ if self.id == details.refid:
+ return self
+
+ for sectiondef in self.sectiondef:
+ result = sectiondef.find(details)
+ if result:
+ return result
+
+
+supermod.compounddefType.subclass = compounddefTypeSub
+# end class compounddefTypeSub
+
+
+class listofallmembersTypeSub(supermod.listofallmembersType):
+ def __init__(self, member=None):
+ supermod.listofallmembersType.__init__(self, member)
+supermod.listofallmembersType.subclass = listofallmembersTypeSub
+# end class listofallmembersTypeSub
+
+
+class memberRefTypeSub(supermod.memberRefType):
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''):
+ supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name)
+supermod.memberRefType.subclass = memberRefTypeSub
+# end class memberRefTypeSub
+
+
+class compoundRefTypeSub(supermod.compoundRefType):
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.compoundRefType.__init__(self, mixedclass_, content_)
+supermod.compoundRefType.subclass = compoundRefTypeSub
+# end class compoundRefTypeSub
+
+
+class reimplementTypeSub(supermod.reimplementType):
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.reimplementType.__init__(self, mixedclass_, content_)
+supermod.reimplementType.subclass = reimplementTypeSub
+# end class reimplementTypeSub
+
+
+class incTypeSub(supermod.incType):
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.incType.__init__(self, mixedclass_, content_)
+supermod.incType.subclass = incTypeSub
+# end class incTypeSub
+
+
+class refTypeSub(supermod.refType):
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refType.__init__(self, mixedclass_, content_)
+supermod.refType.subclass = refTypeSub
+# end class refTypeSub
+
+
+
+class refTextTypeSub(supermod.refTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.refTextType.__init__(self, mixedclass_, content_)
+
+supermod.refTextType.subclass = refTextTypeSub
+# end class refTextTypeSub
+
+class sectiondefTypeSub(supermod.sectiondefType):
+
+
+ def __init__(self, kind=None, header='', description=None, memberdef=None):
+ supermod.sectiondefType.__init__(self, kind, header, description, memberdef)
+
+ def find(self, details):
+
+ for memberdef in self.memberdef:
+ if memberdef.id == details.refid:
+ return memberdef
+
+ return None
+
+
+supermod.sectiondefType.subclass = sectiondefTypeSub
+# end class sectiondefTypeSub
+
+
+class memberdefTypeSub(supermod.memberdefType):
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby)
+supermod.memberdefType.subclass = memberdefTypeSub
+# end class memberdefTypeSub
+
+
+class descriptionTypeSub(supermod.descriptionType):
+ def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ supermod.descriptionType.__init__(self, mixedclass_, content_)
+supermod.descriptionType.subclass = descriptionTypeSub
+# end class descriptionTypeSub
+
+
+class enumvalueTypeSub(supermod.enumvalueType):
+ def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ supermod.enumvalueType.__init__(self, mixedclass_, content_)
+supermod.enumvalueType.subclass = enumvalueTypeSub
+# end class enumvalueTypeSub
+
+
+class templateparamlistTypeSub(supermod.templateparamlistType):
+ def __init__(self, param=None):
+ supermod.templateparamlistType.__init__(self, param)
+supermod.templateparamlistType.subclass = templateparamlistTypeSub
+# end class templateparamlistTypeSub
+
+
+class paramTypeSub(supermod.paramType):
+ def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None):
+ supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription)
+supermod.paramType.subclass = paramTypeSub
+# end class paramTypeSub
+
+
+class linkedTextTypeSub(supermod.linkedTextType):
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ supermod.linkedTextType.__init__(self, mixedclass_, content_)
+supermod.linkedTextType.subclass = linkedTextTypeSub
+# end class linkedTextTypeSub
+
+
+class graphTypeSub(supermod.graphType):
+ def __init__(self, node=None):
+ supermod.graphType.__init__(self, node)
+supermod.graphType.subclass = graphTypeSub
+# end class graphTypeSub
+
+
+class nodeTypeSub(supermod.nodeType):
+ def __init__(self, id=None, label='', link=None, childnode=None):
+ supermod.nodeType.__init__(self, id, label, link, childnode)
+supermod.nodeType.subclass = nodeTypeSub
+# end class nodeTypeSub
+
+
+class childnodeTypeSub(supermod.childnodeType):
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ supermod.childnodeType.__init__(self, relation, refid, edgelabel)
+supermod.childnodeType.subclass = childnodeTypeSub
+# end class childnodeTypeSub
+
+
+class linkTypeSub(supermod.linkType):
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ supermod.linkType.__init__(self, refid, external)
+supermod.linkType.subclass = linkTypeSub
+# end class linkTypeSub
+
+
+class listingTypeSub(supermod.listingType):
+ def __init__(self, codeline=None):
+ supermod.listingType.__init__(self, codeline)
+supermod.listingType.subclass = listingTypeSub
+# end class listingTypeSub
+
+
+class codelineTypeSub(supermod.codelineType):
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight)
+supermod.codelineType.subclass = codelineTypeSub
+# end class codelineTypeSub
+
+
+class highlightTypeSub(supermod.highlightType):
+ def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ supermod.highlightType.__init__(self, mixedclass_, content_)
+supermod.highlightType.subclass = highlightTypeSub
+# end class highlightTypeSub
+
+
+class referenceTypeSub(supermod.referenceType):
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.referenceType.__init__(self, mixedclass_, content_)
+supermod.referenceType.subclass = referenceTypeSub
+# end class referenceTypeSub
+
+
+class locationTypeSub(supermod.locationType):
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file)
+supermod.locationType.subclass = locationTypeSub
+# end class locationTypeSub
+
+
+class docSect1TypeSub(supermod.docSect1Type):
+ def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect1Type.__init__(self, mixedclass_, content_)
+supermod.docSect1Type.subclass = docSect1TypeSub
+# end class docSect1TypeSub
+
+
+class docSect2TypeSub(supermod.docSect2Type):
+ def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect2Type.__init__(self, mixedclass_, content_)
+supermod.docSect2Type.subclass = docSect2TypeSub
+# end class docSect2TypeSub
+
+
+class docSect3TypeSub(supermod.docSect3Type):
+ def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect3Type.__init__(self, mixedclass_, content_)
+supermod.docSect3Type.subclass = docSect3TypeSub
+# end class docSect3TypeSub
+
+
+class docSect4TypeSub(supermod.docSect4Type):
+ def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None):
+ supermod.docSect4Type.__init__(self, mixedclass_, content_)
+supermod.docSect4Type.subclass = docSect4TypeSub
+# end class docSect4TypeSub
+
+
+class docInternalTypeSub(supermod.docInternalType):
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ supermod.docInternalType.__init__(self, mixedclass_, content_)
+supermod.docInternalType.subclass = docInternalTypeSub
+# end class docInternalTypeSub
+
+
+class docInternalS1TypeSub(supermod.docInternalS1Type):
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ supermod.docInternalS1Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS1Type.subclass = docInternalS1TypeSub
+# end class docInternalS1TypeSub
+
+
+class docInternalS2TypeSub(supermod.docInternalS2Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS2Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS2Type.subclass = docInternalS2TypeSub
+# end class docInternalS2TypeSub
+
+
+class docInternalS3TypeSub(supermod.docInternalS3Type):
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ supermod.docInternalS3Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS3Type.subclass = docInternalS3TypeSub
+# end class docInternalS3TypeSub
+
+
+class docInternalS4TypeSub(supermod.docInternalS4Type):
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ supermod.docInternalS4Type.__init__(self, mixedclass_, content_)
+supermod.docInternalS4Type.subclass = docInternalS4TypeSub
+# end class docInternalS4TypeSub
+
+
+class docURLLinkSub(supermod.docURLLink):
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docURLLink.__init__(self, mixedclass_, content_)
+supermod.docURLLink.subclass = docURLLinkSub
+# end class docURLLinkSub
+
+
+class docAnchorTypeSub(supermod.docAnchorType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docAnchorType.__init__(self, mixedclass_, content_)
+supermod.docAnchorType.subclass = docAnchorTypeSub
+# end class docAnchorTypeSub
+
+
+class docFormulaTypeSub(supermod.docFormulaType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docFormulaType.__init__(self, mixedclass_, content_)
+supermod.docFormulaType.subclass = docFormulaTypeSub
+# end class docFormulaTypeSub
+
+
+class docIndexEntryTypeSub(supermod.docIndexEntryType):
+ def __init__(self, primaryie='', secondaryie=''):
+ supermod.docIndexEntryType.__init__(self, primaryie, secondaryie)
+supermod.docIndexEntryType.subclass = docIndexEntryTypeSub
+# end class docIndexEntryTypeSub
+
+
+class docListTypeSub(supermod.docListType):
+ def __init__(self, listitem=None):
+ supermod.docListType.__init__(self, listitem)
+supermod.docListType.subclass = docListTypeSub
+# end class docListTypeSub
+
+
+class docListItemTypeSub(supermod.docListItemType):
+ def __init__(self, para=None):
+ supermod.docListItemType.__init__(self, para)
+supermod.docListItemType.subclass = docListItemTypeSub
+# end class docListItemTypeSub
+
+
+class docSimpleSectTypeSub(supermod.docSimpleSectType):
+ def __init__(self, kind=None, title=None, para=None):
+ supermod.docSimpleSectType.__init__(self, kind, title, para)
+supermod.docSimpleSectType.subclass = docSimpleSectTypeSub
+# end class docSimpleSectTypeSub
+
+
+class docVarListEntryTypeSub(supermod.docVarListEntryType):
+ def __init__(self, term=None):
+ supermod.docVarListEntryType.__init__(self, term)
+supermod.docVarListEntryType.subclass = docVarListEntryTypeSub
+# end class docVarListEntryTypeSub
+
+
+class docRefTextTypeSub(supermod.docRefTextType):
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docRefTextType.__init__(self, mixedclass_, content_)
+supermod.docRefTextType.subclass = docRefTextTypeSub
+# end class docRefTextTypeSub
+
+
+class docTableTypeSub(supermod.docTableType):
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ supermod.docTableType.__init__(self, rows, cols, row, caption)
+supermod.docTableType.subclass = docTableTypeSub
+# end class docTableTypeSub
+
+
+class docRowTypeSub(supermod.docRowType):
+ def __init__(self, entry=None):
+ supermod.docRowType.__init__(self, entry)
+supermod.docRowType.subclass = docRowTypeSub
+# end class docRowTypeSub
+
+
+class docEntryTypeSub(supermod.docEntryType):
+ def __init__(self, thead=None, para=None):
+ supermod.docEntryType.__init__(self, thead, para)
+supermod.docEntryType.subclass = docEntryTypeSub
+# end class docEntryTypeSub
+
+
+class docHeadingTypeSub(supermod.docHeadingType):
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docHeadingType.__init__(self, mixedclass_, content_)
+supermod.docHeadingType.subclass = docHeadingTypeSub
+# end class docHeadingTypeSub
+
+
+class docImageTypeSub(supermod.docImageType):
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docImageType.__init__(self, mixedclass_, content_)
+supermod.docImageType.subclass = docImageTypeSub
+# end class docImageTypeSub
+
+
+class docDotFileTypeSub(supermod.docDotFileType):
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docDotFileType.__init__(self, mixedclass_, content_)
+supermod.docDotFileType.subclass = docDotFileTypeSub
+# end class docDotFileTypeSub
+
+
+class docTocItemTypeSub(supermod.docTocItemType):
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ supermod.docTocItemType.__init__(self, mixedclass_, content_)
+supermod.docTocItemType.subclass = docTocItemTypeSub
+# end class docTocItemTypeSub
+
+
+class docTocListTypeSub(supermod.docTocListType):
+ def __init__(self, tocitem=None):
+ supermod.docTocListType.__init__(self, tocitem)
+supermod.docTocListType.subclass = docTocListTypeSub
+# end class docTocListTypeSub
+
+
+class docLanguageTypeSub(supermod.docLanguageType):
+ def __init__(self, langid=None, para=None):
+ supermod.docLanguageType.__init__(self, langid, para)
+supermod.docLanguageType.subclass = docLanguageTypeSub
+# end class docLanguageTypeSub
+
+
+class docParamListTypeSub(supermod.docParamListType):
+ def __init__(self, kind=None, parameteritem=None):
+ supermod.docParamListType.__init__(self, kind, parameteritem)
+supermod.docParamListType.subclass = docParamListTypeSub
+# end class docParamListTypeSub
+
+
+class docParamListItemSub(supermod.docParamListItem):
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription)
+supermod.docParamListItem.subclass = docParamListItemSub
+# end class docParamListItemSub
+
+
+class docParamNameListSub(supermod.docParamNameList):
+ def __init__(self, parametername=None):
+ supermod.docParamNameList.__init__(self, parametername)
+supermod.docParamNameList.subclass = docParamNameListSub
+# end class docParamNameListSub
+
+
+class docParamNameSub(supermod.docParamName):
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ supermod.docParamName.__init__(self, mixedclass_, content_)
+supermod.docParamName.subclass = docParamNameSub
+# end class docParamNameSub
+
+
+class docXRefSectTypeSub(supermod.docXRefSectType):
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription)
+supermod.docXRefSectType.subclass = docXRefSectTypeSub
+# end class docXRefSectTypeSub
+
+
+class docCopyTypeSub(supermod.docCopyType):
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ supermod.docCopyType.__init__(self, link, para, sect1, internal)
+supermod.docCopyType.subclass = docCopyTypeSub
+# end class docCopyTypeSub
+
+
+class docCharTypeSub(supermod.docCharType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docCharType.__init__(self, char)
+supermod.docCharType.subclass = docCharTypeSub
+# end class docCharTypeSub
+
+class docParaTypeSub(supermod.docParaType):
+ def __init__(self, char=None, valueOf_=''):
+ supermod.docParaType.__init__(self, char)
+
+ self.parameterlist = []
+ self.simplesects = []
+ self.content = []
+
+ def buildChildren(self, child_, nodeName_):
+ supermod.docParaType.buildChildren(self, child_, nodeName_)
+
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == "ref":
+ obj_ = supermod.docRefTextType.factory()
+ obj_.build(child_)
+ self.content.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterlist':
+ obj_ = supermod.docParamListType.factory()
+ obj_.build(child_)
+ self.parameterlist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'simplesect':
+ obj_ = supermod.docSimpleSectType.factory()
+ obj_.build(child_)
+ self.simplesects.append(obj_)
+
+
+supermod.docParaType.subclass = docParaTypeSub
+# end class docParaTypeSub
+
+
+
+def parse(inFilename):
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+ return rootObj
+
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compoundsuper.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compoundsuper.py
new file mode 100644
index 0000000..6255dda
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -0,0 +1,8342 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compounddef=None):
+ self.version = version
+ self.compounddef = compounddef
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compounddef(self): return self.compounddef
+ def set_compounddef(self, compounddef): self.compounddef = compounddef
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (quote_attrib(self.version), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ if self.compounddef:
+ self.compounddef.export(outfile, level, namespace_, name_='compounddef')
+ def hasContent_(self):
+ if (
+ self.compounddef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = "%s",\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.compounddef:
+ showIndent(outfile, level)
+ outfile.write('compounddef=model_.compounddefType(\n')
+ self.compounddef.exportLiteral(outfile, level, name_='compounddef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compounddef':
+ obj_ = compounddefType.factory()
+ obj_.build(child_)
+ self.set_compounddef(obj_)
+# end class DoxygenType
+
+
+class compounddefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
+ self.kind = kind
+ self.prot = prot
+ self.id = id
+ self.compoundname = compoundname
+ self.title = title
+ if basecompoundref is None:
+ self.basecompoundref = []
+ else:
+ self.basecompoundref = basecompoundref
+ if derivedcompoundref is None:
+ self.derivedcompoundref = []
+ else:
+ self.derivedcompoundref = derivedcompoundref
+ if includes is None:
+ self.includes = []
+ else:
+ self.includes = includes
+ if includedby is None:
+ self.includedby = []
+ else:
+ self.includedby = includedby
+ self.incdepgraph = incdepgraph
+ self.invincdepgraph = invincdepgraph
+ if innerdir is None:
+ self.innerdir = []
+ else:
+ self.innerdir = innerdir
+ if innerfile is None:
+ self.innerfile = []
+ else:
+ self.innerfile = innerfile
+ if innerclass is None:
+ self.innerclass = []
+ else:
+ self.innerclass = innerclass
+ if innernamespace is None:
+ self.innernamespace = []
+ else:
+ self.innernamespace = innernamespace
+ if innerpage is None:
+ self.innerpage = []
+ else:
+ self.innerpage = innerpage
+ if innergroup is None:
+ self.innergroup = []
+ else:
+ self.innergroup = innergroup
+ self.templateparamlist = templateparamlist
+ if sectiondef is None:
+ self.sectiondef = []
+ else:
+ self.sectiondef = sectiondef
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inheritancegraph = inheritancegraph
+ self.collaborationgraph = collaborationgraph
+ self.programlisting = programlisting
+ self.location = location
+ self.listofallmembers = listofallmembers
+ def factory(*args_, **kwargs_):
+ if compounddefType.subclass:
+ return compounddefType.subclass(*args_, **kwargs_)
+ else:
+ return compounddefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compoundname(self): return self.compoundname
+ def set_compoundname(self, compoundname): self.compoundname = compoundname
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_basecompoundref(self): return self.basecompoundref
+ def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref
+ def add_basecompoundref(self, value): self.basecompoundref.append(value)
+ def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value
+ def get_derivedcompoundref(self): return self.derivedcompoundref
+ def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref
+ def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value)
+ def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value
+ def get_includes(self): return self.includes
+ def set_includes(self, includes): self.includes = includes
+ def add_includes(self, value): self.includes.append(value)
+ def insert_includes(self, index, value): self.includes[index] = value
+ def get_includedby(self): return self.includedby
+ def set_includedby(self, includedby): self.includedby = includedby
+ def add_includedby(self, value): self.includedby.append(value)
+ def insert_includedby(self, index, value): self.includedby[index] = value
+ def get_incdepgraph(self): return self.incdepgraph
+ def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph
+ def get_invincdepgraph(self): return self.invincdepgraph
+ def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph
+ def get_innerdir(self): return self.innerdir
+ def set_innerdir(self, innerdir): self.innerdir = innerdir
+ def add_innerdir(self, value): self.innerdir.append(value)
+ def insert_innerdir(self, index, value): self.innerdir[index] = value
+ def get_innerfile(self): return self.innerfile
+ def set_innerfile(self, innerfile): self.innerfile = innerfile
+ def add_innerfile(self, value): self.innerfile.append(value)
+ def insert_innerfile(self, index, value): self.innerfile[index] = value
+ def get_innerclass(self): return self.innerclass
+ def set_innerclass(self, innerclass): self.innerclass = innerclass
+ def add_innerclass(self, value): self.innerclass.append(value)
+ def insert_innerclass(self, index, value): self.innerclass[index] = value
+ def get_innernamespace(self): return self.innernamespace
+ def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace
+ def add_innernamespace(self, value): self.innernamespace.append(value)
+ def insert_innernamespace(self, index, value): self.innernamespace[index] = value
+ def get_innerpage(self): return self.innerpage
+ def set_innerpage(self, innerpage): self.innerpage = innerpage
+ def add_innerpage(self, value): self.innerpage.append(value)
+ def insert_innerpage(self, index, value): self.innerpage[index] = value
+ def get_innergroup(self): return self.innergroup
+ def set_innergroup(self, innergroup): self.innergroup = innergroup
+ def add_innergroup(self, value): self.innergroup.append(value)
+ def insert_innergroup(self, index, value): self.innergroup[index] = value
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_sectiondef(self): return self.sectiondef
+ def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef
+ def add_sectiondef(self, value): self.sectiondef.append(value)
+ def insert_sectiondef(self, index, value): self.sectiondef[index] = value
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inheritancegraph(self): return self.inheritancegraph
+ def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph
+ def get_collaborationgraph(self): return self.collaborationgraph
+ def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph
+ def get_programlisting(self): return self.programlisting
+ def set_programlisting(self, programlisting): self.programlisting = programlisting
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_listofallmembers(self): return self.listofallmembers
+ def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compounddefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'):
+ if self.compoundname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_))
+ if self.title is not None:
+ showIndent(outfile, level)
+ outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_))
+ for basecompoundref_ in self.basecompoundref:
+ basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref')
+ for derivedcompoundref_ in self.derivedcompoundref:
+ derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref')
+ for includes_ in self.includes:
+ includes_.export(outfile, level, namespace_, name_='includes')
+ for includedby_ in self.includedby:
+ includedby_.export(outfile, level, namespace_, name_='includedby')
+ if self.incdepgraph:
+ self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph')
+ if self.invincdepgraph:
+ self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph')
+ for innerdir_ in self.innerdir:
+ innerdir_.export(outfile, level, namespace_, name_='innerdir')
+ for innerfile_ in self.innerfile:
+ innerfile_.export(outfile, level, namespace_, name_='innerfile')
+ for innerclass_ in self.innerclass:
+ innerclass_.export(outfile, level, namespace_, name_='innerclass')
+ for innernamespace_ in self.innernamespace:
+ innernamespace_.export(outfile, level, namespace_, name_='innernamespace')
+ for innerpage_ in self.innerpage:
+ innerpage_.export(outfile, level, namespace_, name_='innerpage')
+ for innergroup_ in self.innergroup:
+ innergroup_.export(outfile, level, namespace_, name_='innergroup')
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ for sectiondef_ in self.sectiondef:
+ sectiondef_.export(outfile, level, namespace_, name_='sectiondef')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inheritancegraph:
+ self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph')
+ if self.collaborationgraph:
+ self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph')
+ if self.programlisting:
+ self.programlisting.export(outfile, level, namespace_, name_='programlisting')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location')
+ if self.listofallmembers:
+ self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers')
+ def hasContent_(self):
+ if (
+ self.compoundname is not None or
+ self.title is not None or
+ self.basecompoundref is not None or
+ self.derivedcompoundref is not None or
+ self.includes is not None or
+ self.includedby is not None or
+ self.incdepgraph is not None or
+ self.invincdepgraph is not None or
+ self.innerdir is not None or
+ self.innerfile is not None or
+ self.innerclass is not None or
+ self.innernamespace is not None or
+ self.innerpage is not None or
+ self.innergroup is not None or
+ self.templateparamlist is not None or
+ self.sectiondef is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inheritancegraph is not None or
+ self.collaborationgraph is not None or
+ self.programlisting is not None or
+ self.location is not None or
+ self.listofallmembers is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compounddefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding))
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.xsd_string(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('basecompoundref=[\n')
+ level += 1
+ for basecompoundref in self.basecompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.basecompoundref(\n')
+ basecompoundref.exportLiteral(outfile, level, name_='basecompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('derivedcompoundref=[\n')
+ level += 1
+ for derivedcompoundref in self.derivedcompoundref:
+ showIndent(outfile, level)
+ outfile.write('model_.derivedcompoundref(\n')
+ derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includes=[\n')
+ level += 1
+ for includes in self.includes:
+ showIndent(outfile, level)
+ outfile.write('model_.includes(\n')
+ includes.exportLiteral(outfile, level, name_='includes')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('includedby=[\n')
+ level += 1
+ for includedby in self.includedby:
+ showIndent(outfile, level)
+ outfile.write('model_.includedby(\n')
+ includedby.exportLiteral(outfile, level, name_='includedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.incdepgraph:
+ showIndent(outfile, level)
+ outfile.write('incdepgraph=model_.graphType(\n')
+ self.incdepgraph.exportLiteral(outfile, level, name_='incdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.invincdepgraph:
+ showIndent(outfile, level)
+ outfile.write('invincdepgraph=model_.graphType(\n')
+ self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('innerdir=[\n')
+ level += 1
+ for innerdir in self.innerdir:
+ showIndent(outfile, level)
+ outfile.write('model_.innerdir(\n')
+ innerdir.exportLiteral(outfile, level, name_='innerdir')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerfile=[\n')
+ level += 1
+ for innerfile in self.innerfile:
+ showIndent(outfile, level)
+ outfile.write('model_.innerfile(\n')
+ innerfile.exportLiteral(outfile, level, name_='innerfile')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerclass=[\n')
+ level += 1
+ for innerclass in self.innerclass:
+ showIndent(outfile, level)
+ outfile.write('model_.innerclass(\n')
+ innerclass.exportLiteral(outfile, level, name_='innerclass')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innernamespace=[\n')
+ level += 1
+ for innernamespace in self.innernamespace:
+ showIndent(outfile, level)
+ outfile.write('model_.innernamespace(\n')
+ innernamespace.exportLiteral(outfile, level, name_='innernamespace')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innerpage=[\n')
+ level += 1
+ for innerpage in self.innerpage:
+ showIndent(outfile, level)
+ outfile.write('model_.innerpage(\n')
+ innerpage.exportLiteral(outfile, level, name_='innerpage')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('innergroup=[\n')
+ level += 1
+ for innergroup in self.innergroup:
+ showIndent(outfile, level)
+ outfile.write('model_.innergroup(\n')
+ innergroup.exportLiteral(outfile, level, name_='innergroup')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('sectiondef=[\n')
+ level += 1
+ for sectiondef in self.sectiondef:
+ showIndent(outfile, level)
+ outfile.write('model_.sectiondef(\n')
+ sectiondef.exportLiteral(outfile, level, name_='sectiondef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inheritancegraph:
+ showIndent(outfile, level)
+ outfile.write('inheritancegraph=model_.graphType(\n')
+ self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.collaborationgraph:
+ showIndent(outfile, level)
+ outfile.write('collaborationgraph=model_.graphType(\n')
+ self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.programlisting:
+ showIndent(outfile, level)
+ outfile.write('programlisting=model_.listingType(\n')
+ self.programlisting.exportLiteral(outfile, level, name_='programlisting')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.listofallmembers:
+ showIndent(outfile, level)
+ outfile.write('listofallmembers=model_.listofallmembersType(\n')
+ self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compoundname':
+ compoundname_ = ''
+ for text__content_ in child_.childNodes:
+ compoundname_ += text__content_.nodeValue
+ self.compoundname = compoundname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'basecompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.basecompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'derivedcompoundref':
+ obj_ = compoundRefType.factory()
+ obj_.build(child_)
+ self.derivedcompoundref.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includes':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includes.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'includedby':
+ obj_ = incType.factory()
+ obj_.build(child_)
+ self.includedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'incdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_incdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'invincdepgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_invincdepgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerdir':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerdir.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerfile':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerfile.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerclass':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerclass.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innernamespace':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innernamespace.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innerpage':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innerpage.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'innergroup':
+ obj_ = refType.factory()
+ obj_.build(child_)
+ self.innergroup.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sectiondef':
+ obj_ = sectiondefType.factory()
+ obj_.build(child_)
+ self.sectiondef.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inheritancegraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_inheritancegraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'collaborationgraph':
+ obj_ = graphType.factory()
+ obj_.build(child_)
+ self.set_collaborationgraph(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'programlisting':
+ obj_ = listingType.factory()
+ obj_.build(child_)
+ self.set_programlisting(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listofallmembers':
+ obj_ = listofallmembersType.factory()
+ obj_.build(child_)
+ self.set_listofallmembers(obj_)
+# end class compounddefType
+
+
+class listofallmembersType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, member=None):
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if listofallmembersType.subclass:
+ return listofallmembersType.subclass(*args_, **kwargs_)
+ else:
+ return listofallmembersType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'):
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listofallmembersType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = memberRefType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class listofallmembersType
+
+
+class memberRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ self.ambiguityscope = ambiguityscope
+ self.scope = scope
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if memberRefType.subclass:
+ return memberRefType.subclass(*args_, **kwargs_)
+ else:
+ return memberRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_scope(self): return self.scope
+ def set_scope(self, scope): self.scope = scope
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_ambiguityscope(self): return self.ambiguityscope
+ def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope
+ def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberRefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.ambiguityscope is not None:
+ outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'):
+ if self.scope is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.scope is not None or
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.ambiguityscope is not None:
+ showIndent(outfile, level)
+ outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('ambiguityscope'):
+ self.ambiguityscope = attrs.get('ambiguityscope').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'scope':
+ scope_ = ''
+ for text__content_ in child_.childNodes:
+ scope_ += text__content_.nodeValue
+ self.scope = scope_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class memberRefType
+
+
+class scope(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if scope.subclass:
+ return scope.subclass(*args_, **kwargs_)
+ else:
+ return scope(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='scope')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='scope'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='scope'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='scope'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class scope
+
+
+class name(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if name.subclass:
+ return name.subclass(*args_, **kwargs_)
+ else:
+ return name(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='name')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='name'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='name'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='name'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class name
+
+
+class compoundRefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.virt = virt
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if compoundRefType.subclass:
+ return compoundRefType.subclass(*args_, **kwargs_)
+ else:
+ return compoundRefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='compoundRefType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='compoundRefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class compoundRefType
+
+
+class reimplementType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if reimplementType.subclass:
+ return reimplementType.subclass(*args_, **kwargs_)
+ else:
+ return reimplementType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='reimplementType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='reimplementType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class reimplementType
+
+
+class incType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.local = local
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if incType.subclass:
+ return incType.subclass(*args_, **kwargs_)
+ else:
+ return incType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_local(self): return self.local
+ def set_local(self, local): self.local = local
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='incType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='incType'):
+ if self.local is not None:
+ outfile.write(' local=%s' % (quote_attrib(self.local), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='incType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='incType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.local is not None:
+ showIndent(outfile, level)
+ outfile.write('local = "%s",\n' % (self.local,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('local'):
+ self.local = attrs.get('local').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class incType
+
+
+class refType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
+ self.prot = prot
+ self.refid = refid
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refType.subclass:
+ return refType.subclass(*args_, **kwargs_)
+ else:
+ return refType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refType
+
+
+class refTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if refTextType.subclass:
+ return refTextType.subclass(*args_, **kwargs_)
+ else:
+ return refTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='refTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='refTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='refTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class refTextType
+
+
+class sectiondefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, header=None, description=None, memberdef=None):
+ self.kind = kind
+ self.header = header
+ self.description = description
+ if memberdef is None:
+ self.memberdef = []
+ else:
+ self.memberdef = memberdef
+ def factory(*args_, **kwargs_):
+ if sectiondefType.subclass:
+ return sectiondefType.subclass(*args_, **kwargs_)
+ else:
+ return sectiondefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_header(self): return self.header
+ def set_header(self, header): self.header = header
+ def get_description(self): return self.description
+ def set_description(self, description): self.description = description
+ def get_memberdef(self): return self.memberdef
+ def set_memberdef(self, memberdef): self.memberdef = memberdef
+ def add_memberdef(self, value): self.memberdef.append(value)
+ def insert_memberdef(self, index, value): self.memberdef[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sectiondefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'):
+ if self.header is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_))
+ if self.description:
+ self.description.export(outfile, level, namespace_, name_='description')
+ for memberdef_ in self.memberdef:
+ memberdef_.export(outfile, level, namespace_, name_='memberdef')
+ def hasContent_(self):
+ if (
+ self.header is not None or
+ self.description is not None or
+ self.memberdef is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sectiondefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding))
+ if self.description:
+ showIndent(outfile, level)
+ outfile.write('description=model_.descriptionType(\n')
+ self.description.exportLiteral(outfile, level, name_='description')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('memberdef=[\n')
+ level += 1
+ for memberdef in self.memberdef:
+ showIndent(outfile, level)
+ outfile.write('model_.memberdef(\n')
+ memberdef.exportLiteral(outfile, level, name_='memberdef')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'header':
+ header_ = ''
+ for text__content_ in child_.childNodes:
+ header_ += text__content_.nodeValue
+ self.header = header_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'description':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_description(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'memberdef':
+ obj_ = memberdefType.factory()
+ obj_.build(child_)
+ self.memberdef.append(obj_)
+# end class sectiondefType
+
+
+class memberdefType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
+ self.initonly = initonly
+ self.kind = kind
+ self.volatile = volatile
+ self.const = const
+ self.raisexx = raisexx
+ self.virt = virt
+ self.readable = readable
+ self.prot = prot
+ self.explicit = explicit
+ self.new = new
+ self.final = final
+ self.writable = writable
+ self.add = add
+ self.static = static
+ self.remove = remove
+ self.sealed = sealed
+ self.mutable = mutable
+ self.gettable = gettable
+ self.inline = inline
+ self.settable = settable
+ self.id = id
+ self.templateparamlist = templateparamlist
+ self.type_ = type_
+ self.definition = definition
+ self.argsstring = argsstring
+ self.name = name
+ self.read = read
+ self.write = write
+ self.bitfield = bitfield
+ if reimplements is None:
+ self.reimplements = []
+ else:
+ self.reimplements = reimplements
+ if reimplementedby is None:
+ self.reimplementedby = []
+ else:
+ self.reimplementedby = reimplementedby
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ if enumvalue is None:
+ self.enumvalue = []
+ else:
+ self.enumvalue = enumvalue
+ self.initializer = initializer
+ self.exceptions = exceptions
+ self.briefdescription = briefdescription
+ self.detaileddescription = detaileddescription
+ self.inbodydescription = inbodydescription
+ self.location = location
+ if references is None:
+ self.references = []
+ else:
+ self.references = references
+ if referencedby is None:
+ self.referencedby = []
+ else:
+ self.referencedby = referencedby
+ def factory(*args_, **kwargs_):
+ if memberdefType.subclass:
+ return memberdefType.subclass(*args_, **kwargs_)
+ else:
+ return memberdefType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_templateparamlist(self): return self.templateparamlist
+ def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_definition(self): return self.definition
+ def set_definition(self, definition): self.definition = definition
+ def get_argsstring(self): return self.argsstring
+ def set_argsstring(self, argsstring): self.argsstring = argsstring
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_read(self): return self.read
+ def set_read(self, read): self.read = read
+ def get_write(self): return self.write
+ def set_write(self, write): self.write = write
+ def get_bitfield(self): return self.bitfield
+ def set_bitfield(self, bitfield): self.bitfield = bitfield
+ def get_reimplements(self): return self.reimplements
+ def set_reimplements(self, reimplements): self.reimplements = reimplements
+ def add_reimplements(self, value): self.reimplements.append(value)
+ def insert_reimplements(self, index, value): self.reimplements[index] = value
+ def get_reimplementedby(self): return self.reimplementedby
+ def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby
+ def add_reimplementedby(self, value): self.reimplementedby.append(value)
+ def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def get_enumvalue(self): return self.enumvalue
+ def set_enumvalue(self, enumvalue): self.enumvalue = enumvalue
+ def add_enumvalue(self, value): self.enumvalue.append(value)
+ def insert_enumvalue(self, index, value): self.enumvalue[index] = value
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_exceptions(self): return self.exceptions
+ def set_exceptions(self, exceptions): self.exceptions = exceptions
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_inbodydescription(self): return self.inbodydescription
+ def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription
+ def get_location(self): return self.location
+ def set_location(self, location): self.location = location
+ def get_references(self): return self.references
+ def set_references(self, references): self.references = references
+ def add_references(self, value): self.references.append(value)
+ def insert_references(self, index, value): self.references[index] = value
+ def get_referencedby(self): return self.referencedby
+ def set_referencedby(self, referencedby): self.referencedby = referencedby
+ def add_referencedby(self, value): self.referencedby.append(value)
+ def insert_referencedby(self, index, value): self.referencedby[index] = value
+ def get_initonly(self): return self.initonly
+ def set_initonly(self, initonly): self.initonly = initonly
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_volatile(self): return self.volatile
+ def set_volatile(self, volatile): self.volatile = volatile
+ def get_const(self): return self.const
+ def set_const(self, const): self.const = const
+ def get_raise(self): return self.raisexx
+ def set_raise(self, raisexx): self.raisexx = raisexx
+ def get_virt(self): return self.virt
+ def set_virt(self, virt): self.virt = virt
+ def get_readable(self): return self.readable
+ def set_readable(self, readable): self.readable = readable
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_explicit(self): return self.explicit
+ def set_explicit(self, explicit): self.explicit = explicit
+ def get_new(self): return self.new
+ def set_new(self, new): self.new = new
+ def get_final(self): return self.final
+ def set_final(self, final): self.final = final
+ def get_writable(self): return self.writable
+ def set_writable(self, writable): self.writable = writable
+ def get_add(self): return self.add
+ def set_add(self, add): self.add = add
+ def get_static(self): return self.static
+ def set_static(self, static): self.static = static
+ def get_remove(self): return self.remove
+ def set_remove(self, remove): self.remove = remove
+ def get_sealed(self): return self.sealed
+ def set_sealed(self, sealed): self.sealed = sealed
+ def get_mutable(self): return self.mutable
+ def set_mutable(self, mutable): self.mutable = mutable
+ def get_gettable(self): return self.gettable
+ def set_gettable(self, gettable): self.gettable = gettable
+ def get_inline(self): return self.inline
+ def set_inline(self, inline): self.inline = inline
+ def get_settable(self): return self.settable
+ def set_settable(self, settable): self.settable = settable
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='memberdefType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.initonly is not None:
+ outfile.write(' initonly=%s' % (quote_attrib(self.initonly), ))
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ if self.volatile is not None:
+ outfile.write(' volatile=%s' % (quote_attrib(self.volatile), ))
+ if self.const is not None:
+ outfile.write(' const=%s' % (quote_attrib(self.const), ))
+ if self.raisexx is not None:
+ outfile.write(' raise=%s' % (quote_attrib(self.raisexx), ))
+ if self.virt is not None:
+ outfile.write(' virt=%s' % (quote_attrib(self.virt), ))
+ if self.readable is not None:
+ outfile.write(' readable=%s' % (quote_attrib(self.readable), ))
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.explicit is not None:
+ outfile.write(' explicit=%s' % (quote_attrib(self.explicit), ))
+ if self.new is not None:
+ outfile.write(' new=%s' % (quote_attrib(self.new), ))
+ if self.final is not None:
+ outfile.write(' final=%s' % (quote_attrib(self.final), ))
+ if self.writable is not None:
+ outfile.write(' writable=%s' % (quote_attrib(self.writable), ))
+ if self.add is not None:
+ outfile.write(' add=%s' % (quote_attrib(self.add), ))
+ if self.static is not None:
+ outfile.write(' static=%s' % (quote_attrib(self.static), ))
+ if self.remove is not None:
+ outfile.write(' remove=%s' % (quote_attrib(self.remove), ))
+ if self.sealed is not None:
+ outfile.write(' sealed=%s' % (quote_attrib(self.sealed), ))
+ if self.mutable is not None:
+ outfile.write(' mutable=%s' % (quote_attrib(self.mutable), ))
+ if self.gettable is not None:
+ outfile.write(' gettable=%s' % (quote_attrib(self.gettable), ))
+ if self.inline is not None:
+ outfile.write(' inline=%s' % (quote_attrib(self.inline), ))
+ if self.settable is not None:
+ outfile.write(' settable=%s' % (quote_attrib(self.settable), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'):
+ if self.templateparamlist:
+ self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist')
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.definition is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_))
+ if self.argsstring is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ if self.read is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_))
+ if self.write is not None:
+ showIndent(outfile, level)
+ outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_))
+ if self.bitfield is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_))
+ for reimplements_ in self.reimplements:
+ reimplements_.export(outfile, level, namespace_, name_='reimplements')
+ for reimplementedby_ in self.reimplementedby:
+ reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby')
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ for enumvalue_ in self.enumvalue:
+ enumvalue_.export(outfile, level, namespace_, name_='enumvalue')
+ if self.initializer:
+ self.initializer.export(outfile, level, namespace_, name_='initializer')
+ if self.exceptions:
+ self.exceptions.export(outfile, level, namespace_, name_='exceptions')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ if self.detaileddescription:
+ self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription')
+ if self.inbodydescription:
+ self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription')
+ if self.location:
+ self.location.export(outfile, level, namespace_, name_='location', )
+ for references_ in self.references:
+ references_.export(outfile, level, namespace_, name_='references')
+ for referencedby_ in self.referencedby:
+ referencedby_.export(outfile, level, namespace_, name_='referencedby')
+ def hasContent_(self):
+ if (
+ self.templateparamlist is not None or
+ self.type_ is not None or
+ self.definition is not None or
+ self.argsstring is not None or
+ self.name is not None or
+ self.read is not None or
+ self.write is not None or
+ self.bitfield is not None or
+ self.reimplements is not None or
+ self.reimplementedby is not None or
+ self.param is not None or
+ self.enumvalue is not None or
+ self.initializer is not None or
+ self.exceptions is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None or
+ self.inbodydescription is not None or
+ self.location is not None or
+ self.references is not None or
+ self.referencedby is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='memberdefType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.initonly is not None:
+ showIndent(outfile, level)
+ outfile.write('initonly = "%s",\n' % (self.initonly,))
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.volatile is not None:
+ showIndent(outfile, level)
+ outfile.write('volatile = "%s",\n' % (self.volatile,))
+ if self.const is not None:
+ showIndent(outfile, level)
+ outfile.write('const = "%s",\n' % (self.const,))
+ if self.raisexx is not None:
+ showIndent(outfile, level)
+ outfile.write('raisexx = "%s",\n' % (self.raisexx,))
+ if self.virt is not None:
+ showIndent(outfile, level)
+ outfile.write('virt = "%s",\n' % (self.virt,))
+ if self.readable is not None:
+ showIndent(outfile, level)
+ outfile.write('readable = "%s",\n' % (self.readable,))
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.explicit is not None:
+ showIndent(outfile, level)
+ outfile.write('explicit = "%s",\n' % (self.explicit,))
+ if self.new is not None:
+ showIndent(outfile, level)
+ outfile.write('new = "%s",\n' % (self.new,))
+ if self.final is not None:
+ showIndent(outfile, level)
+ outfile.write('final = "%s",\n' % (self.final,))
+ if self.writable is not None:
+ showIndent(outfile, level)
+ outfile.write('writable = "%s",\n' % (self.writable,))
+ if self.add is not None:
+ showIndent(outfile, level)
+ outfile.write('add = "%s",\n' % (self.add,))
+ if self.static is not None:
+ showIndent(outfile, level)
+ outfile.write('static = "%s",\n' % (self.static,))
+ if self.remove is not None:
+ showIndent(outfile, level)
+ outfile.write('remove = "%s",\n' % (self.remove,))
+ if self.sealed is not None:
+ showIndent(outfile, level)
+ outfile.write('sealed = "%s",\n' % (self.sealed,))
+ if self.mutable is not None:
+ showIndent(outfile, level)
+ outfile.write('mutable = "%s",\n' % (self.mutable,))
+ if self.gettable is not None:
+ showIndent(outfile, level)
+ outfile.write('gettable = "%s",\n' % (self.gettable,))
+ if self.inline is not None:
+ showIndent(outfile, level)
+ outfile.write('inline = "%s",\n' % (self.inline,))
+ if self.settable is not None:
+ showIndent(outfile, level)
+ outfile.write('settable = "%s",\n' % (self.settable,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.templateparamlist:
+ showIndent(outfile, level)
+ outfile.write('templateparamlist=model_.templateparamlistType(\n')
+ self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('reimplements=[\n')
+ level += 1
+ for reimplements in self.reimplements:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplements(\n')
+ reimplements.exportLiteral(outfile, level, name_='reimplements')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('reimplementedby=[\n')
+ level += 1
+ for reimplementedby in self.reimplementedby:
+ showIndent(outfile, level)
+ outfile.write('model_.reimplementedby(\n')
+ reimplementedby.exportLiteral(outfile, level, name_='reimplementedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('enumvalue=[\n')
+ level += 1
+ for enumvalue in self.enumvalue:
+ showIndent(outfile, level)
+ outfile.write('model_.enumvalue(\n')
+ enumvalue.exportLiteral(outfile, level, name_='enumvalue')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.initializer:
+ showIndent(outfile, level)
+ outfile.write('initializer=model_.linkedTextType(\n')
+ self.initializer.exportLiteral(outfile, level, name_='initializer')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.exceptions:
+ showIndent(outfile, level)
+ outfile.write('exceptions=model_.linkedTextType(\n')
+ self.exceptions.exportLiteral(outfile, level, name_='exceptions')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.detaileddescription:
+ showIndent(outfile, level)
+ outfile.write('detaileddescription=model_.descriptionType(\n')
+ self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.inbodydescription:
+ showIndent(outfile, level)
+ outfile.write('inbodydescription=model_.descriptionType(\n')
+ self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.location:
+ showIndent(outfile, level)
+ outfile.write('location=model_.locationType(\n')
+ self.location.exportLiteral(outfile, level, name_='location')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('references=[\n')
+ level += 1
+ for references in self.references:
+ showIndent(outfile, level)
+ outfile.write('model_.references(\n')
+ references.exportLiteral(outfile, level, name_='references')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('referencedby=[\n')
+ level += 1
+ for referencedby in self.referencedby:
+ showIndent(outfile, level)
+ outfile.write('model_.referencedby(\n')
+ referencedby.exportLiteral(outfile, level, name_='referencedby')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('initonly'):
+ self.initonly = attrs.get('initonly').value
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('volatile'):
+ self.volatile = attrs.get('volatile').value
+ if attrs.get('const'):
+ self.const = attrs.get('const').value
+ if attrs.get('raise'):
+ self.raisexx = attrs.get('raise').value
+ if attrs.get('virt'):
+ self.virt = attrs.get('virt').value
+ if attrs.get('readable'):
+ self.readable = attrs.get('readable').value
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('explicit'):
+ self.explicit = attrs.get('explicit').value
+ if attrs.get('new'):
+ self.new = attrs.get('new').value
+ if attrs.get('final'):
+ self.final = attrs.get('final').value
+ if attrs.get('writable'):
+ self.writable = attrs.get('writable').value
+ if attrs.get('add'):
+ self.add = attrs.get('add').value
+ if attrs.get('static'):
+ self.static = attrs.get('static').value
+ if attrs.get('remove'):
+ self.remove = attrs.get('remove').value
+ if attrs.get('sealed'):
+ self.sealed = attrs.get('sealed').value
+ if attrs.get('mutable'):
+ self.mutable = attrs.get('mutable').value
+ if attrs.get('gettable'):
+ self.gettable = attrs.get('gettable').value
+ if attrs.get('inline'):
+ self.inline = attrs.get('inline').value
+ if attrs.get('settable'):
+ self.settable = attrs.get('settable').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'templateparamlist':
+ obj_ = templateparamlistType.factory()
+ obj_.build(child_)
+ self.set_templateparamlist(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'definition':
+ definition_ = ''
+ for text__content_ in child_.childNodes:
+ definition_ += text__content_.nodeValue
+ self.definition = definition_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'argsstring':
+ argsstring_ = ''
+ for text__content_ in child_.childNodes:
+ argsstring_ += text__content_.nodeValue
+ self.argsstring = argsstring_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'read':
+ read_ = ''
+ for text__content_ in child_.childNodes:
+ read_ += text__content_.nodeValue
+ self.read = read_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'write':
+ write_ = ''
+ for text__content_ in child_.childNodes:
+ write_ += text__content_.nodeValue
+ self.write = write_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'bitfield':
+ bitfield_ = ''
+ for text__content_ in child_.childNodes:
+ bitfield_ += text__content_.nodeValue
+ self.bitfield = bitfield_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplements':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplements.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'reimplementedby':
+ obj_ = reimplementType.factory()
+ obj_.build(child_)
+ self.reimplementedby.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'enumvalue':
+ obj_ = enumvalueType.factory()
+ obj_.build(child_)
+ self.enumvalue.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_initializer(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'exceptions':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_exceptions(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_detaileddescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'inbodydescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_inbodydescription(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'location':
+ obj_ = locationType.factory()
+ obj_.build(child_)
+ self.set_location(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'references':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.references.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'referencedby':
+ obj_ = referenceType.factory()
+ obj_.build(child_)
+ self.referencedby.append(obj_)
+# end class memberdefType
+
+
+class definition(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if definition.subclass:
+ return definition.subclass(*args_, **kwargs_)
+ else:
+ return definition(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='definition')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='definition'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='definition'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='definition'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class definition
+
+
+class argsstring(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if argsstring.subclass:
+ return argsstring.subclass(*args_, **kwargs_)
+ else:
+ return argsstring(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='argsstring')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='argsstring'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='argsstring'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class argsstring
+
+
+class read(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if read.subclass:
+ return read.subclass(*args_, **kwargs_)
+ else:
+ return read(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='read')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='read'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='read'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='read'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class read
+
+
+class write(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if write.subclass:
+ return write.subclass(*args_, **kwargs_)
+ else:
+ return write(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='write')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='write'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='write'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='write'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class write
+
+
+class bitfield(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if bitfield.subclass:
+ return bitfield.subclass(*args_, **kwargs_)
+ else:
+ return bitfield(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='bitfield')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='bitfield'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='bitfield'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class bitfield
+
+
+class descriptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if descriptionType.subclass:
+ return descriptionType.subclass(*args_, **kwargs_)
+ else:
+ return descriptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='descriptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='descriptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class descriptionType
+
+
+class enumvalueType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
+ self.prot = prot
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if enumvalueType.subclass:
+ return enumvalueType.subclass(*args_, **kwargs_)
+ else:
+ return enumvalueType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_initializer(self): return self.initializer
+ def set_initializer(self, initializer): self.initializer = initializer
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def get_detaileddescription(self): return self.detaileddescription
+ def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription
+ def get_prot(self): return self.prot
+ def set_prot(self, prot): self.prot = prot
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='enumvalueType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'):
+ if self.prot is not None:
+ outfile.write(' prot=%s' % (quote_attrib(self.prot), ))
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.initializer is not None or
+ self.briefdescription is not None or
+ self.detaileddescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='enumvalueType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.prot is not None:
+ showIndent(outfile, level)
+ outfile.write('prot = "%s",\n' % (self.prot,))
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('prot'):
+ self.prot = attrs.get('prot').value
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'name', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'initializer':
+ childobj_ = linkedTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'initializer', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'briefdescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'detaileddescription':
+ childobj_ = descriptionType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'detaileddescription', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class enumvalueType
+
+
+class templateparamlistType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, param=None):
+ if param is None:
+ self.param = []
+ else:
+ self.param = param
+ def factory(*args_, **kwargs_):
+ if templateparamlistType.subclass:
+ return templateparamlistType.subclass(*args_, **kwargs_)
+ else:
+ return templateparamlistType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_param(self): return self.param
+ def set_param(self, param): self.param = param
+ def add_param(self, value): self.param.append(value)
+ def insert_param(self, index, value): self.param[index] = value
+ def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'):
+ for param_ in self.param:
+ param_.export(outfile, level, namespace_, name_='param')
+ def hasContent_(self):
+ if (
+ self.param is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='templateparamlistType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('param=[\n')
+ level += 1
+ for param in self.param:
+ showIndent(outfile, level)
+ outfile.write('model_.param(\n')
+ param.exportLiteral(outfile, level, name_='param')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'param':
+ obj_ = paramType.factory()
+ obj_.build(child_)
+ self.param.append(obj_)
+# end class templateparamlistType
+
+
+class paramType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None):
+ self.type_ = type_
+ self.declname = declname
+ self.defname = defname
+ self.array = array
+ self.defval = defval
+ self.briefdescription = briefdescription
+ def factory(*args_, **kwargs_):
+ if paramType.subclass:
+ return paramType.subclass(*args_, **kwargs_)
+ else:
+ return paramType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_declname(self): return self.declname
+ def set_declname(self, declname): self.declname = declname
+ def get_defname(self): return self.defname
+ def set_defname(self, defname): self.defname = defname
+ def get_array(self): return self.array
+ def set_array(self, array): self.array = array
+ def get_defval(self): return self.defval
+ def set_defval(self, defval): self.defval = defval
+ def get_briefdescription(self): return self.briefdescription
+ def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription
+ def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='paramType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='paramType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='paramType'):
+ if self.type_:
+ self.type_.export(outfile, level, namespace_, name_='type')
+ if self.declname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_))
+ if self.defname is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_))
+ if self.array is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_))
+ if self.defval:
+ self.defval.export(outfile, level, namespace_, name_='defval')
+ if self.briefdescription:
+ self.briefdescription.export(outfile, level, namespace_, name_='briefdescription')
+ def hasContent_(self):
+ if (
+ self.type_ is not None or
+ self.declname is not None or
+ self.defname is not None or
+ self.array is not None or
+ self.defval is not None or
+ self.briefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='paramType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.type_:
+ showIndent(outfile, level)
+ outfile.write('type_=model_.linkedTextType(\n')
+ self.type_.exportLiteral(outfile, level, name_='type')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding))
+ if self.defval:
+ showIndent(outfile, level)
+ outfile.write('defval=model_.linkedTextType(\n')
+ self.defval.exportLiteral(outfile, level, name_='defval')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ if self.briefdescription:
+ showIndent(outfile, level)
+ outfile.write('briefdescription=model_.descriptionType(\n')
+ self.briefdescription.exportLiteral(outfile, level, name_='briefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'type':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_type(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'declname':
+ declname_ = ''
+ for text__content_ in child_.childNodes:
+ declname_ += text__content_.nodeValue
+ self.declname = declname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defname':
+ defname_ = ''
+ for text__content_ in child_.childNodes:
+ defname_ += text__content_.nodeValue
+ self.defname = defname_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'array':
+ array_ = ''
+ for text__content_ in child_.childNodes:
+ array_ += text__content_.nodeValue
+ self.array = array_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'defval':
+ obj_ = linkedTextType.factory()
+ obj_.build(child_)
+ self.set_defval(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'briefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_briefdescription(obj_)
+# end class paramType
+
+
+class declname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if declname.subclass:
+ return declname.subclass(*args_, **kwargs_)
+ else:
+ return declname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='declname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='declname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='declname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='declname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class declname
+
+
+class defname(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if defname.subclass:
+ return defname.subclass(*args_, **kwargs_)
+ else:
+ return defname(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='defname')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='defname'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='defname'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='defname'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class defname
+
+
+class array(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if array.subclass:
+ return array.subclass(*args_, **kwargs_)
+ else:
+ return array(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='array')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='array'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='array'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='array'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class array
+
+
+class linkedTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, ref=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if linkedTextType.subclass:
+ return linkedTextType.subclass(*args_, **kwargs_)
+ else:
+ return linkedTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkedTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkedTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class linkedTextType
+
+
+class graphType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, node=None):
+ if node is None:
+ self.node = []
+ else:
+ self.node = node
+ def factory(*args_, **kwargs_):
+ if graphType.subclass:
+ return graphType.subclass(*args_, **kwargs_)
+ else:
+ return graphType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_node(self): return self.node
+ def set_node(self, node): self.node = node
+ def add_node(self, value): self.node.append(value)
+ def insert_node(self, index, value): self.node[index] = value
+ def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='graphType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='graphType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='graphType'):
+ for node_ in self.node:
+ node_.export(outfile, level, namespace_, name_='node')
+ def hasContent_(self):
+ if (
+ self.node is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='graphType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('node=[\n')
+ level += 1
+ for node in self.node:
+ showIndent(outfile, level)
+ outfile.write('model_.node(\n')
+ node.exportLiteral(outfile, level, name_='node')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'node':
+ obj_ = nodeType.factory()
+ obj_.build(child_)
+ self.node.append(obj_)
+# end class graphType
+
+
+class nodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, label=None, link=None, childnode=None):
+ self.id = id
+ self.label = label
+ self.link = link
+ if childnode is None:
+ self.childnode = []
+ else:
+ self.childnode = childnode
+ def factory(*args_, **kwargs_):
+ if nodeType.subclass:
+ return nodeType.subclass(*args_, **kwargs_)
+ else:
+ return nodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_label(self): return self.label
+ def set_label(self, label): self.label = label
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def get_childnode(self): return self.childnode
+ def set_childnode(self, childnode): self.childnode = childnode
+ def add_childnode(self, value): self.childnode.append(value)
+ def insert_childnode(self, index, value): self.childnode[index] = value
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='nodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='nodeType'):
+ if self.label is not None:
+ showIndent(outfile, level)
+ outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_))
+ if self.link:
+ self.link.export(outfile, level, namespace_, name_='link')
+ for childnode_ in self.childnode:
+ childnode_.export(outfile, level, namespace_, name_='childnode')
+ def hasContent_(self):
+ if (
+ self.label is not None or
+ self.link is not None or
+ self.childnode is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='nodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding))
+ if self.link:
+ showIndent(outfile, level)
+ outfile.write('link=model_.linkType(\n')
+ self.link.exportLiteral(outfile, level, name_='link')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('childnode=[\n')
+ level += 1
+ for childnode in self.childnode:
+ showIndent(outfile, level)
+ outfile.write('model_.childnode(\n')
+ childnode.exportLiteral(outfile, level, name_='childnode')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'label':
+ label_ = ''
+ for text__content_ in child_.childNodes:
+ label_ += text__content_.nodeValue
+ self.label = label_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'link':
+ obj_ = linkType.factory()
+ obj_.build(child_)
+ self.set_link(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'childnode':
+ obj_ = childnodeType.factory()
+ obj_.build(child_)
+ self.childnode.append(obj_)
+# end class nodeType
+
+
+class label(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if label.subclass:
+ return label.subclass(*args_, **kwargs_)
+ else:
+ return label(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='label')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='label'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='label'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='label'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class label
+
+
+class childnodeType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, relation=None, refid=None, edgelabel=None):
+ self.relation = relation
+ self.refid = refid
+ if edgelabel is None:
+ self.edgelabel = []
+ else:
+ self.edgelabel = edgelabel
+ def factory(*args_, **kwargs_):
+ if childnodeType.subclass:
+ return childnodeType.subclass(*args_, **kwargs_)
+ else:
+ return childnodeType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_edgelabel(self): return self.edgelabel
+ def set_edgelabel(self, edgelabel): self.edgelabel = edgelabel
+ def add_edgelabel(self, value): self.edgelabel.append(value)
+ def insert_edgelabel(self, index, value): self.edgelabel[index] = value
+ def get_relation(self): return self.relation
+ def set_relation(self, relation): self.relation = relation
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='childnodeType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'):
+ if self.relation is not None:
+ outfile.write(' relation=%s' % (quote_attrib(self.relation), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'):
+ for edgelabel_ in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_))
+ def hasContent_(self):
+ if (
+ self.edgelabel is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='childnodeType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.relation is not None:
+ showIndent(outfile, level)
+ outfile.write('relation = "%s",\n' % (self.relation,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('edgelabel=[\n')
+ level += 1
+ for edgelabel in self.edgelabel:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('relation'):
+ self.relation = attrs.get('relation').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'edgelabel':
+ edgelabel_ = ''
+ for text__content_ in child_.childNodes:
+ edgelabel_ += text__content_.nodeValue
+ self.edgelabel.append(edgelabel_)
+# end class childnodeType
+
+
+class edgelabel(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if edgelabel.subclass:
+ return edgelabel.subclass(*args_, **kwargs_)
+ else:
+ return edgelabel(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='edgelabel')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='edgelabel'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class edgelabel
+
+
+class linkType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, external=None, valueOf_=''):
+ self.refid = refid
+ self.external = external
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if linkType.subclass:
+ return linkType.subclass(*args_, **kwargs_)
+ else:
+ return linkType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='linkType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='linkType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='linkType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='linkType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class linkType
+
+
+class listingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, codeline=None):
+ if codeline is None:
+ self.codeline = []
+ else:
+ self.codeline = codeline
+ def factory(*args_, **kwargs_):
+ if listingType.subclass:
+ return listingType.subclass(*args_, **kwargs_)
+ else:
+ return listingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_codeline(self): return self.codeline
+ def set_codeline(self, codeline): self.codeline = codeline
+ def add_codeline(self, value): self.codeline.append(value)
+ def insert_codeline(self, index, value): self.codeline[index] = value
+ def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='listingType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='listingType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='listingType'):
+ for codeline_ in self.codeline:
+ codeline_.export(outfile, level, namespace_, name_='codeline')
+ def hasContent_(self):
+ if (
+ self.codeline is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='listingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('codeline=[\n')
+ level += 1
+ for codeline in self.codeline:
+ showIndent(outfile, level)
+ outfile.write('model_.codeline(\n')
+ codeline.exportLiteral(outfile, level, name_='codeline')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'codeline':
+ obj_ = codelineType.factory()
+ obj_.build(child_)
+ self.codeline.append(obj_)
+# end class listingType
+
+
+class codelineType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
+ self.external = external
+ self.lineno = lineno
+ self.refkind = refkind
+ self.refid = refid
+ if highlight is None:
+ self.highlight = []
+ else:
+ self.highlight = highlight
+ def factory(*args_, **kwargs_):
+ if codelineType.subclass:
+ return codelineType.subclass(*args_, **kwargs_)
+ else:
+ return codelineType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_highlight(self): return self.highlight
+ def set_highlight(self, highlight): self.highlight = highlight
+ def add_highlight(self, value): self.highlight.append(value)
+ def insert_highlight(self, index, value): self.highlight[index] = value
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def get_lineno(self): return self.lineno
+ def set_lineno(self, lineno): self.lineno = lineno
+ def get_refkind(self): return self.refkind
+ def set_refkind(self, refkind): self.refkind = refkind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='codelineType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'):
+ if self.external is not None:
+ outfile.write(' external=%s' % (quote_attrib(self.external), ))
+ if self.lineno is not None:
+ outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno'))
+ if self.refkind is not None:
+ outfile.write(' refkind=%s' % (quote_attrib(self.refkind), ))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='codelineType'):
+ for highlight_ in self.highlight:
+ highlight_.export(outfile, level, namespace_, name_='highlight')
+ def hasContent_(self):
+ if (
+ self.highlight is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='codelineType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = "%s",\n' % (self.external,))
+ if self.lineno is not None:
+ showIndent(outfile, level)
+ outfile.write('lineno = %s,\n' % (self.lineno,))
+ if self.refkind is not None:
+ showIndent(outfile, level)
+ outfile.write('refkind = "%s",\n' % (self.refkind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('highlight=[\n')
+ level += 1
+ for highlight in self.highlight:
+ showIndent(outfile, level)
+ outfile.write('model_.highlight(\n')
+ highlight.exportLiteral(outfile, level, name_='highlight')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ if attrs.get('lineno'):
+ try:
+ self.lineno = int(attrs.get('lineno').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (lineno): %s' % exp)
+ if attrs.get('refkind'):
+ self.refkind = attrs.get('refkind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'highlight':
+ obj_ = highlightType.factory()
+ obj_.build(child_)
+ self.highlight.append(obj_)
+# end class codelineType
+
+
+class highlightType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None):
+ self.classxx = classxx
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if highlightType.subclass:
+ return highlightType.subclass(*args_, **kwargs_)
+ else:
+ return highlightType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_sp(self): return self.sp
+ def set_sp(self, sp): self.sp = sp
+ def add_sp(self, value): self.sp.append(value)
+ def insert_sp(self, index, value): self.sp[index] = value
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def add_ref(self, value): self.ref.append(value)
+ def insert_ref(self, index, value): self.ref[index] = value
+ def get_class(self): return self.classxx
+ def set_class(self, classxx): self.classxx = classxx
+ def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='highlightType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'):
+ if self.classxx is not None:
+ outfile.write(' class=%s' % (quote_attrib(self.classxx), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='highlightType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.sp is not None or
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='highlightType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.classxx is not None:
+ showIndent(outfile, level)
+ outfile.write('classxx = "%s",\n' % (self.classxx,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('class'):
+ self.classxx = attrs.get('class').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sp':
+ value_ = []
+ for text_ in child_.childNodes:
+ value_.append(text_.nodeValue)
+ valuestr_ = ''.join(value_)
+ obj_ = self.mixedclass_(MixedContainer.CategorySimple,
+ MixedContainer.TypeString, 'sp', valuestr_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class highlightType
+
+
+class sp(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if sp.subclass:
+ return sp.subclass(*args_, **kwargs_)
+ else:
+ return sp(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='sp')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='sp'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='sp'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='sp'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class sp
+
+
+class referenceType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
+ self.endline = endline
+ self.startline = startline
+ self.refid = refid
+ self.compoundref = compoundref
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if referenceType.subclass:
+ return referenceType.subclass(*args_, **kwargs_)
+ else:
+ return referenceType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_endline(self): return self.endline
+ def set_endline(self, endline): self.endline = endline
+ def get_startline(self): return self.startline
+ def set_startline(self, startline): self.startline = startline
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_compoundref(self): return self.compoundref
+ def set_compoundref(self, compoundref): self.compoundref = compoundref
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='referenceType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.endline is not None:
+ outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline'))
+ if self.startline is not None:
+ outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline'))
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.compoundref is not None:
+ outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='referenceType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='referenceType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.endline is not None:
+ showIndent(outfile, level)
+ outfile.write('endline = %s,\n' % (self.endline,))
+ if self.startline is not None:
+ showIndent(outfile, level)
+ outfile.write('startline = %s,\n' % (self.startline,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.compoundref is not None:
+ showIndent(outfile, level)
+ outfile.write('compoundref = %s,\n' % (self.compoundref,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('endline'):
+ try:
+ self.endline = int(attrs.get('endline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (endline): %s' % exp)
+ if attrs.get('startline'):
+ try:
+ self.startline = int(attrs.get('startline').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (startline): %s' % exp)
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('compoundref'):
+ self.compoundref = attrs.get('compoundref').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class referenceType
+
+
+class locationType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
+ self.bodystart = bodystart
+ self.line = line
+ self.bodyend = bodyend
+ self.bodyfile = bodyfile
+ self.file = file
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if locationType.subclass:
+ return locationType.subclass(*args_, **kwargs_)
+ else:
+ return locationType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_bodystart(self): return self.bodystart
+ def set_bodystart(self, bodystart): self.bodystart = bodystart
+ def get_line(self): return self.line
+ def set_line(self, line): self.line = line
+ def get_bodyend(self): return self.bodyend
+ def set_bodyend(self, bodyend): self.bodyend = bodyend
+ def get_bodyfile(self): return self.bodyfile
+ def set_bodyfile(self, bodyfile): self.bodyfile = bodyfile
+ def get_file(self): return self.file
+ def set_file(self, file): self.file = file
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='locationType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='locationType'):
+ if self.bodystart is not None:
+ outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart'))
+ if self.line is not None:
+ outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line'))
+ if self.bodyend is not None:
+ outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend'))
+ if self.bodyfile is not None:
+ outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), ))
+ if self.file is not None:
+ outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='locationType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='locationType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.bodystart is not None:
+ showIndent(outfile, level)
+ outfile.write('bodystart = %s,\n' % (self.bodystart,))
+ if self.line is not None:
+ showIndent(outfile, level)
+ outfile.write('line = %s,\n' % (self.line,))
+ if self.bodyend is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyend = %s,\n' % (self.bodyend,))
+ if self.bodyfile is not None:
+ showIndent(outfile, level)
+ outfile.write('bodyfile = %s,\n' % (self.bodyfile,))
+ if self.file is not None:
+ showIndent(outfile, level)
+ outfile.write('file = %s,\n' % (self.file,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('bodystart'):
+ try:
+ self.bodystart = int(attrs.get('bodystart').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodystart): %s' % exp)
+ if attrs.get('line'):
+ try:
+ self.line = int(attrs.get('line').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (line): %s' % exp)
+ if attrs.get('bodyend'):
+ try:
+ self.bodyend = int(attrs.get('bodyend').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (bodyend): %s' % exp)
+ if attrs.get('bodyfile'):
+ self.bodyfile = attrs.get('bodyfile').value
+ if attrs.get('file'):
+ self.file = attrs.get('file').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class locationType
+
+
+class docSect1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect1Type.subclass:
+ return docSect1Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect2 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect1Type
+
+
+class docSect2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect2Type.subclass:
+ return docSect2Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect3 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect2Type
+
+
+class docSect3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect3Type.subclass:
+ return docSect3Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect4(self): return self.sect4
+ def set_sect4(self, sect4): self.sect4 = sect4
+ def add_sect4(self, value): self.sect4.append(value)
+ def insert_sect4(self, index, value): self.sect4[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.sect4 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect4':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect4', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect3Type
+
+
+class docSect4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docSect4Type.subclass:
+ return docSect4Type.subclass(*args_, **kwargs_)
+ else:
+ return docSect4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSect4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSect4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ childobj_ = docTitleType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'title', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ childobj_ = docInternalS4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'internal', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docSect4Type
+
+
+class docInternalType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalType.subclass:
+ return docInternalType.subclass(*args_, **kwargs_)
+ else:
+ return docInternalType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ childobj_ = docSect1Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect1', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalType
+
+
+class docInternalS1Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS1Type.subclass:
+ return docInternalS1Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS1Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect2(self): return self.sect2
+ def set_sect2(self, sect2): self.sect2 = sect2
+ def add_sect2(self, value): self.sect2.append(value)
+ def insert_sect2(self, index, value): self.sect2[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect2 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS1Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect2':
+ childobj_ = docSect2Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect2', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS1Type
+
+
+class docInternalS2Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS2Type.subclass:
+ return docInternalS2Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS2Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS2Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect3Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS2Type
+
+
+class docInternalS3Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS3Type.subclass:
+ return docInternalS3Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS3Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect3(self): return self.sect3
+ def set_sect3(self, sect3): self.sect3 = sect3
+ def add_sect3(self, value): self.sect3.append(value)
+ def insert_sect3(self, index, value): self.sect3[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect3 is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS3Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect3':
+ childobj_ = docSect4Type.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'sect3', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS3Type
+
+
+class docInternalS4Type(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None, mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docInternalS4Type.subclass:
+ return docInternalS4Type.subclass(*args_, **kwargs_)
+ else:
+ return docInternalS4Type(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docInternalS4Type'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ childobj_ = docParaType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'para', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docInternalS4Type
+
+
+class docTitleType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTitleType.subclass:
+ return docTitleType.subclass(*args_, **kwargs_)
+ else:
+ return docTitleType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTitleType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTitleType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTitleType
+
+
+class docParaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParaType.subclass:
+ return docParaType.subclass(*args_, **kwargs_)
+ else:
+ return docParaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docParaType
+
+
+class docMarkupType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docMarkupType.subclass:
+ return docMarkupType.subclass(*args_, **kwargs_)
+ else:
+ return docMarkupType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docMarkupType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docMarkupType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docMarkupType
+
+
+class docURLLink(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
+ self.url = url
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docURLLink.subclass:
+ return docURLLink.subclass(*args_, **kwargs_)
+ else:
+ return docURLLink(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_url(self): return self.url
+ def set_url(self, url): self.url = url
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docURLLink')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.url is not None:
+ outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docURLLink'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.url is not None:
+ showIndent(outfile, level)
+ outfile.write('url = %s,\n' % (self.url,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('url'):
+ self.url = attrs.get('url').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docURLLink
+
+
+class docAnchorType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docAnchorType.subclass:
+ return docAnchorType.subclass(*args_, **kwargs_)
+ else:
+ return docAnchorType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docAnchorType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docAnchorType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docAnchorType
+
+
+class docFormulaType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docFormulaType.subclass:
+ return docFormulaType.subclass(*args_, **kwargs_)
+ else:
+ return docFormulaType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docFormulaType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docFormulaType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docFormulaType
+
+
+class docIndexEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, primaryie=None, secondaryie=None):
+ self.primaryie = primaryie
+ self.secondaryie = secondaryie
+ def factory(*args_, **kwargs_):
+ if docIndexEntryType.subclass:
+ return docIndexEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docIndexEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_primaryie(self): return self.primaryie
+ def set_primaryie(self, primaryie): self.primaryie = primaryie
+ def get_secondaryie(self): return self.secondaryie
+ def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie
+ def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'):
+ if self.primaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_))
+ if self.secondaryie is not None:
+ showIndent(outfile, level)
+ outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_))
+ def hasContent_(self):
+ if (
+ self.primaryie is not None or
+ self.secondaryie is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docIndexEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'primaryie':
+ primaryie_ = ''
+ for text__content_ in child_.childNodes:
+ primaryie_ += text__content_.nodeValue
+ self.primaryie = primaryie_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'secondaryie':
+ secondaryie_ = ''
+ for text__content_ in child_.childNodes:
+ secondaryie_ += text__content_.nodeValue
+ self.secondaryie = secondaryie_
+# end class docIndexEntryType
+
+
+class docListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, listitem=None):
+ if listitem is None:
+ self.listitem = []
+ else:
+ self.listitem = listitem
+ def factory(*args_, **kwargs_):
+ if docListType.subclass:
+ return docListType.subclass(*args_, **kwargs_)
+ else:
+ return docListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_listitem(self): return self.listitem
+ def set_listitem(self, listitem): self.listitem = listitem
+ def add_listitem(self, value): self.listitem.append(value)
+ def insert_listitem(self, index, value): self.listitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListType'):
+ for listitem_ in self.listitem:
+ listitem_.export(outfile, level, namespace_, name_='listitem')
+ def hasContent_(self):
+ if (
+ self.listitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('listitem=[\n')
+ level += 1
+ for listitem in self.listitem:
+ showIndent(outfile, level)
+ outfile.write('model_.listitem(\n')
+ listitem.exportLiteral(outfile, level, name_='listitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'listitem':
+ obj_ = docListItemType.factory()
+ obj_.build(child_)
+ self.listitem.append(obj_)
+# end class docListType
+
+
+class docListItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, para=None):
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docListItemType.subclass:
+ return docListItemType.subclass(*args_, **kwargs_)
+ else:
+ return docListItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docListItemType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docListItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docListItemType
+
+
+class docSimpleSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, title=None, para=None):
+ self.kind = kind
+ self.title = title
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docSimpleSectType.subclass:
+ return docSimpleSectType.subclass(*args_, **kwargs_)
+ else:
+ return docSimpleSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_title(self): return self.title
+ def set_title(self, title): self.title = title
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'):
+ if self.title:
+ self.title.export(outfile, level, namespace_, name_='title')
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.title is not None or
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docSimpleSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.title:
+ showIndent(outfile, level)
+ outfile.write('title=model_.docTitleType(\n')
+ self.title.exportLiteral(outfile, level, name_='title')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'title':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_title(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docSimpleSectType
+
+
+class docVarListEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, term=None):
+ self.term = term
+ def factory(*args_, **kwargs_):
+ if docVarListEntryType.subclass:
+ return docVarListEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docVarListEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_term(self): return self.term
+ def set_term(self, term): self.term = term
+ def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'):
+ if self.term:
+ self.term.export(outfile, level, namespace_, name_='term', )
+ def hasContent_(self):
+ if (
+ self.term is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVarListEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ if self.term:
+ showIndent(outfile, level)
+ outfile.write('term=model_.docTitleType(\n')
+ self.term.exportLiteral(outfile, level, name_='term')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'term':
+ obj_ = docTitleType.factory()
+ obj_.build(child_)
+ self.set_term(obj_)
+# end class docVarListEntryType
+
+
+class docVariableListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docVariableListType.subclass:
+ return docVariableListType.subclass(*args_, **kwargs_)
+ else:
+ return docVariableListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docVariableListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docVariableListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docVariableListType
+
+
+class docRefTextType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
+ self.refid = refid
+ self.kindref = kindref
+ self.external = external
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docRefTextType.subclass:
+ return docRefTextType.subclass(*args_, **kwargs_)
+ else:
+ return docRefTextType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def get_kindref(self): return self.kindref
+ def set_kindref(self, kindref): self.kindref = kindref
+ def get_external(self): return self.external
+ def set_external(self, external): self.external = external
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRefTextType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.refid is not None:
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ if self.kindref is not None:
+ outfile.write(' kindref=%s' % (quote_attrib(self.kindref), ))
+ if self.external is not None:
+ outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRefTextType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ if self.kindref is not None:
+ showIndent(outfile, level)
+ outfile.write('kindref = "%s",\n' % (self.kindref,))
+ if self.external is not None:
+ showIndent(outfile, level)
+ outfile.write('external = %s,\n' % (self.external,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ if attrs.get('kindref'):
+ self.kindref = attrs.get('kindref').value
+ if attrs.get('external'):
+ self.external = attrs.get('external').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docRefTextType
+
+
+class docTableType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, rows=None, cols=None, row=None, caption=None):
+ self.rows = rows
+ self.cols = cols
+ if row is None:
+ self.row = []
+ else:
+ self.row = row
+ self.caption = caption
+ def factory(*args_, **kwargs_):
+ if docTableType.subclass:
+ return docTableType.subclass(*args_, **kwargs_)
+ else:
+ return docTableType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_row(self): return self.row
+ def set_row(self, row): self.row = row
+ def add_row(self, value): self.row.append(value)
+ def insert_row(self, index, value): self.row[index] = value
+ def get_caption(self): return self.caption
+ def set_caption(self, caption): self.caption = caption
+ def get_rows(self): return self.rows
+ def set_rows(self, rows): self.rows = rows
+ def get_cols(self): return self.cols
+ def set_cols(self, cols): self.cols = cols
+ def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTableType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'):
+ if self.rows is not None:
+ outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows'))
+ if self.cols is not None:
+ outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTableType'):
+ for row_ in self.row:
+ row_.export(outfile, level, namespace_, name_='row')
+ if self.caption:
+ self.caption.export(outfile, level, namespace_, name_='caption')
+ def hasContent_(self):
+ if (
+ self.row is not None or
+ self.caption is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTableType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.rows is not None:
+ showIndent(outfile, level)
+ outfile.write('rows = %s,\n' % (self.rows,))
+ if self.cols is not None:
+ showIndent(outfile, level)
+ outfile.write('cols = %s,\n' % (self.cols,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('row=[\n')
+ level += 1
+ for row in self.row:
+ showIndent(outfile, level)
+ outfile.write('model_.row(\n')
+ row.exportLiteral(outfile, level, name_='row')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.caption:
+ showIndent(outfile, level)
+ outfile.write('caption=model_.docCaptionType(\n')
+ self.caption.exportLiteral(outfile, level, name_='caption')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('rows'):
+ try:
+ self.rows = int(attrs.get('rows').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (rows): %s' % exp)
+ if attrs.get('cols'):
+ try:
+ self.cols = int(attrs.get('cols').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (cols): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'row':
+ obj_ = docRowType.factory()
+ obj_.build(child_)
+ self.row.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'caption':
+ obj_ = docCaptionType.factory()
+ obj_.build(child_)
+ self.set_caption(obj_)
+# end class docTableType
+
+
+class docRowType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, entry=None):
+ if entry is None:
+ self.entry = []
+ else:
+ self.entry = entry
+ def factory(*args_, **kwargs_):
+ if docRowType.subclass:
+ return docRowType.subclass(*args_, **kwargs_)
+ else:
+ return docRowType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_entry(self): return self.entry
+ def set_entry(self, entry): self.entry = entry
+ def add_entry(self, value): self.entry.append(value)
+ def insert_entry(self, index, value): self.entry[index] = value
+ def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docRowType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docRowType'):
+ for entry_ in self.entry:
+ entry_.export(outfile, level, namespace_, name_='entry')
+ def hasContent_(self):
+ if (
+ self.entry is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docRowType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('entry=[\n')
+ level += 1
+ for entry in self.entry:
+ showIndent(outfile, level)
+ outfile.write('model_.entry(\n')
+ entry.exportLiteral(outfile, level, name_='entry')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'entry':
+ obj_ = docEntryType.factory()
+ obj_.build(child_)
+ self.entry.append(obj_)
+# end class docRowType
+
+
+class docEntryType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, thead=None, para=None):
+ self.thead = thead
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docEntryType.subclass:
+ return docEntryType.subclass(*args_, **kwargs_)
+ else:
+ return docEntryType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_thead(self): return self.thead
+ def set_thead(self, thead): self.thead = thead
+ def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEntryType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'):
+ if self.thead is not None:
+ outfile.write(' thead=%s' % (quote_attrib(self.thead), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEntryType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.thead is not None:
+ showIndent(outfile, level)
+ outfile.write('thead = "%s",\n' % (self.thead,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('thead'):
+ self.thead = attrs.get('thead').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docEntryType
+
+
+class docCaptionType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_='', mixedclass_=None, content_=None):
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docCaptionType.subclass:
+ return docCaptionType.subclass(*args_, **kwargs_)
+ else:
+ return docCaptionType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCaptionType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCaptionType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCaptionType
+
+
+class docHeadingType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
+ self.level = level
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docHeadingType.subclass:
+ return docHeadingType.subclass(*args_, **kwargs_)
+ else:
+ return docHeadingType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_level(self): return self.level
+ def set_level(self, level): self.level = level
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docHeadingType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.level is not None:
+ outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level'))
+ def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docHeadingType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.level is not None:
+ showIndent(outfile, level)
+ outfile.write('level = %s,\n' % (self.level,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('level'):
+ try:
+ self.level = int(attrs.get('level').value)
+ except ValueError, exp:
+ raise ValueError('Bad integer attribute (level): %s' % exp)
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docHeadingType
+
+
+class docImageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
+ self.width = width
+ self.type_ = type_
+ self.name = name
+ self.height = height
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docImageType.subclass:
+ return docImageType.subclass(*args_, **kwargs_)
+ else:
+ return docImageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_width(self): return self.width
+ def set_width(self, width): self.width = width
+ def get_type(self): return self.type_
+ def set_type(self, type_): self.type_ = type_
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_height(self): return self.height
+ def set_height(self, height): self.height = height
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docImageType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.width is not None:
+ outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), ))
+ if self.type_ is not None:
+ outfile.write(' type=%s' % (quote_attrib(self.type_), ))
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ if self.height is not None:
+ outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docImageType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docImageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.width is not None:
+ showIndent(outfile, level)
+ outfile.write('width = %s,\n' % (self.width,))
+ if self.type_ is not None:
+ showIndent(outfile, level)
+ outfile.write('type_ = "%s",\n' % (self.type_,))
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ if self.height is not None:
+ showIndent(outfile, level)
+ outfile.write('height = %s,\n' % (self.height,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('width'):
+ self.width = attrs.get('width').value
+ if attrs.get('type'):
+ self.type_ = attrs.get('type').value
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ if attrs.get('height'):
+ self.height = attrs.get('height').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docImageType
+
+
+class docDotFileType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
+ self.name = name
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docDotFileType.subclass:
+ return docDotFileType.subclass(*args_, **kwargs_)
+ else:
+ return docDotFileType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docDotFileType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.name is not None:
+ outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docDotFileType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('name = %s,\n' % (self.name,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('name'):
+ self.name = attrs.get('name').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docDotFileType
+
+
+class docTocItemType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
+ self.id = id
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docTocItemType.subclass:
+ return docTocItemType.subclass(*args_, **kwargs_)
+ else:
+ return docTocItemType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocItemType')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocItemType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docTocItemType
+
+
+class docTocListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, tocitem=None):
+ if tocitem is None:
+ self.tocitem = []
+ else:
+ self.tocitem = tocitem
+ def factory(*args_, **kwargs_):
+ if docTocListType.subclass:
+ return docTocListType.subclass(*args_, **kwargs_)
+ else:
+ return docTocListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_tocitem(self): return self.tocitem
+ def set_tocitem(self, tocitem): self.tocitem = tocitem
+ def add_tocitem(self, value): self.tocitem.append(value)
+ def insert_tocitem(self, index, value): self.tocitem[index] = value
+ def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docTocListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'):
+ for tocitem_ in self.tocitem:
+ tocitem_.export(outfile, level, namespace_, name_='tocitem')
+ def hasContent_(self):
+ if (
+ self.tocitem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docTocListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('tocitem=[\n')
+ level += 1
+ for tocitem in self.tocitem:
+ showIndent(outfile, level)
+ outfile.write('model_.tocitem(\n')
+ tocitem.exportLiteral(outfile, level, name_='tocitem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'tocitem':
+ obj_ = docTocItemType.factory()
+ obj_.build(child_)
+ self.tocitem.append(obj_)
+# end class docTocListType
+
+
+class docLanguageType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, langid=None, para=None):
+ self.langid = langid
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ def factory(*args_, **kwargs_):
+ if docLanguageType.subclass:
+ return docLanguageType.subclass(*args_, **kwargs_)
+ else:
+ return docLanguageType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_langid(self): return self.langid
+ def set_langid(self, langid): self.langid = langid
+ def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docLanguageType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'):
+ if self.langid is not None:
+ outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ def hasContent_(self):
+ if (
+ self.para is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docLanguageType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.langid is not None:
+ showIndent(outfile, level)
+ outfile.write('langid = %s,\n' % (self.langid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('langid'):
+ self.langid = attrs.get('langid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+# end class docLanguageType
+
+
+class docParamListType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, parameteritem=None):
+ self.kind = kind
+ if parameteritem is None:
+ self.parameteritem = []
+ else:
+ self.parameteritem = parameteritem
+ def factory(*args_, **kwargs_):
+ if docParamListType.subclass:
+ return docParamListType.subclass(*args_, **kwargs_)
+ else:
+ return docParamListType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameteritem(self): return self.parameteritem
+ def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem
+ def add_parameteritem(self, value): self.parameteritem.append(value)
+ def insert_parameteritem(self, index, value): self.parameteritem[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'):
+ if self.kind is not None:
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'):
+ for parameteritem_ in self.parameteritem:
+ parameteritem_.export(outfile, level, namespace_, name_='parameteritem')
+ def hasContent_(self):
+ if (
+ self.parameteritem is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameteritem=[\n')
+ level += 1
+ for parameteritem in self.parameteritem:
+ showIndent(outfile, level)
+ outfile.write('model_.parameteritem(\n')
+ parameteritem.exportLiteral(outfile, level, name_='parameteritem')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameteritem':
+ obj_ = docParamListItem.factory()
+ obj_.build(child_)
+ self.parameteritem.append(obj_)
+# end class docParamListType
+
+
+class docParamListItem(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parameternamelist=None, parameterdescription=None):
+ if parameternamelist is None:
+ self.parameternamelist = []
+ else:
+ self.parameternamelist = parameternamelist
+ self.parameterdescription = parameterdescription
+ def factory(*args_, **kwargs_):
+ if docParamListItem.subclass:
+ return docParamListItem.subclass(*args_, **kwargs_)
+ else:
+ return docParamListItem(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parameternamelist(self): return self.parameternamelist
+ def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist
+ def add_parameternamelist(self, value): self.parameternamelist.append(value)
+ def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value
+ def get_parameterdescription(self): return self.parameterdescription
+ def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription
+ def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamListItem')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'):
+ for parameternamelist_ in self.parameternamelist:
+ parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist')
+ if self.parameterdescription:
+ self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', )
+ def hasContent_(self):
+ if (
+ self.parameternamelist is not None or
+ self.parameterdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamListItem'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parameternamelist=[\n')
+ level += 1
+ for parameternamelist in self.parameternamelist:
+ showIndent(outfile, level)
+ outfile.write('model_.parameternamelist(\n')
+ parameternamelist.exportLiteral(outfile, level, name_='parameternamelist')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.parameterdescription:
+ showIndent(outfile, level)
+ outfile.write('parameterdescription=model_.descriptionType(\n')
+ self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameternamelist':
+ obj_ = docParamNameList.factory()
+ obj_.build(child_)
+ self.parameternamelist.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parameterdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_parameterdescription(obj_)
+# end class docParamListItem
+
+
+class docParamNameList(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, parametername=None):
+ if parametername is None:
+ self.parametername = []
+ else:
+ self.parametername = parametername
+ def factory(*args_, **kwargs_):
+ if docParamNameList.subclass:
+ return docParamNameList.subclass(*args_, **kwargs_)
+ else:
+ return docParamNameList(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_parametername(self): return self.parametername
+ def set_parametername(self, parametername): self.parametername = parametername
+ def add_parametername(self, value): self.parametername.append(value)
+ def insert_parametername(self, index, value): self.parametername[index] = value
+ def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamNameList')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'):
+ for parametername_ in self.parametername:
+ parametername_.export(outfile, level, namespace_, name_='parametername')
+ def hasContent_(self):
+ if (
+ self.parametername is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamNameList'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('parametername=[\n')
+ level += 1
+ for parametername in self.parametername:
+ showIndent(outfile, level)
+ outfile.write('model_.parametername(\n')
+ parametername.exportLiteral(outfile, level, name_='parametername')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'parametername':
+ obj_ = docParamName.factory()
+ obj_.build(child_)
+ self.parametername.append(obj_)
+# end class docParamNameList
+
+
+class docParamName(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
+ self.direction = direction
+ if mixedclass_ is None:
+ self.mixedclass_ = MixedContainer
+ else:
+ self.mixedclass_ = mixedclass_
+ if content_ is None:
+ self.content_ = []
+ else:
+ self.content_ = content_
+ def factory(*args_, **kwargs_):
+ if docParamName.subclass:
+ return docParamName.subclass(*args_, **kwargs_)
+ else:
+ return docParamName(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_ref(self): return self.ref
+ def set_ref(self, ref): self.ref = ref
+ def get_direction(self): return self.direction
+ def set_direction(self, direction): self.direction = direction
+ def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docParamName')
+ outfile.write('>')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'):
+ if self.direction is not None:
+ outfile.write(' direction=%s' % (quote_attrib(self.direction), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docParamName'):
+ for item_ in self.content_:
+ item_.export(outfile, level, item_.name, namespace_)
+ def hasContent_(self):
+ if (
+ self.ref is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docParamName'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.direction is not None:
+ showIndent(outfile, level)
+ outfile.write('direction = "%s",\n' % (self.direction,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('content_ = [\n')
+ for item_ in self.content_:
+ item_.exportLiteral(outfile, level, name_)
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('direction'):
+ self.direction = attrs.get('direction').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'ref':
+ childobj_ = docRefTextType.factory()
+ childobj_.build(child_)
+ obj_ = self.mixedclass_(MixedContainer.CategoryComplex,
+ MixedContainer.TypeNone, 'ref', childobj_)
+ self.content_.append(obj_)
+ elif child_.nodeType == Node.TEXT_NODE:
+ obj_ = self.mixedclass_(MixedContainer.CategoryText,
+ MixedContainer.TypeNone, '', child_.nodeValue)
+ self.content_.append(obj_)
+# end class docParamName
+
+
+class docXRefSectType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, id=None, xreftitle=None, xrefdescription=None):
+ self.id = id
+ if xreftitle is None:
+ self.xreftitle = []
+ else:
+ self.xreftitle = xreftitle
+ self.xrefdescription = xrefdescription
+ def factory(*args_, **kwargs_):
+ if docXRefSectType.subclass:
+ return docXRefSectType.subclass(*args_, **kwargs_)
+ else:
+ return docXRefSectType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_xreftitle(self): return self.xreftitle
+ def set_xreftitle(self, xreftitle): self.xreftitle = xreftitle
+ def add_xreftitle(self, value): self.xreftitle.append(value)
+ def insert_xreftitle(self, index, value): self.xreftitle[index] = value
+ def get_xrefdescription(self): return self.xrefdescription
+ def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription
+ def get_id(self): return self.id
+ def set_id(self, id): self.id = id
+ def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ if self.id is not None:
+ outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'):
+ for xreftitle_ in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_))
+ if self.xrefdescription:
+ self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', )
+ def hasContent_(self):
+ if (
+ self.xreftitle is not None or
+ self.xrefdescription is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docXRefSectType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.id is not None:
+ showIndent(outfile, level)
+ outfile.write('id = %s,\n' % (self.id,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('xreftitle=[\n')
+ level += 1
+ for xreftitle in self.xreftitle:
+ showIndent(outfile, level)
+ outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding))
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.xrefdescription:
+ showIndent(outfile, level)
+ outfile.write('xrefdescription=model_.descriptionType(\n')
+ self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('id'):
+ self.id = attrs.get('id').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xreftitle':
+ xreftitle_ = ''
+ for text__content_ in child_.childNodes:
+ xreftitle_ += text__content_.nodeValue
+ self.xreftitle.append(xreftitle_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'xrefdescription':
+ obj_ = descriptionType.factory()
+ obj_.build(child_)
+ self.set_xrefdescription(obj_)
+# end class docXRefSectType
+
+
+class docCopyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, link=None, para=None, sect1=None, internal=None):
+ self.link = link
+ if para is None:
+ self.para = []
+ else:
+ self.para = para
+ if sect1 is None:
+ self.sect1 = []
+ else:
+ self.sect1 = sect1
+ self.internal = internal
+ def factory(*args_, **kwargs_):
+ if docCopyType.subclass:
+ return docCopyType.subclass(*args_, **kwargs_)
+ else:
+ return docCopyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_para(self): return self.para
+ def set_para(self, para): self.para = para
+ def add_para(self, value): self.para.append(value)
+ def insert_para(self, index, value): self.para[index] = value
+ def get_sect1(self): return self.sect1
+ def set_sect1(self, sect1): self.sect1 = sect1
+ def add_sect1(self, value): self.sect1.append(value)
+ def insert_sect1(self, index, value): self.sect1[index] = value
+ def get_internal(self): return self.internal
+ def set_internal(self, internal): self.internal = internal
+ def get_link(self): return self.link
+ def set_link(self, link): self.link = link
+ def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCopyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'):
+ if self.link is not None:
+ outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'):
+ for para_ in self.para:
+ para_.export(outfile, level, namespace_, name_='para')
+ for sect1_ in self.sect1:
+ sect1_.export(outfile, level, namespace_, name_='sect1')
+ if self.internal:
+ self.internal.export(outfile, level, namespace_, name_='internal')
+ def hasContent_(self):
+ if (
+ self.para is not None or
+ self.sect1 is not None or
+ self.internal is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCopyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.link is not None:
+ showIndent(outfile, level)
+ outfile.write('link = %s,\n' % (self.link,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('para=[\n')
+ level += 1
+ for para in self.para:
+ showIndent(outfile, level)
+ outfile.write('model_.para(\n')
+ para.exportLiteral(outfile, level, name_='para')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ showIndent(outfile, level)
+ outfile.write('sect1=[\n')
+ level += 1
+ for sect1 in self.sect1:
+ showIndent(outfile, level)
+ outfile.write('model_.sect1(\n')
+ sect1.exportLiteral(outfile, level, name_='sect1')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ if self.internal:
+ showIndent(outfile, level)
+ outfile.write('internal=model_.docInternalType(\n')
+ self.internal.exportLiteral(outfile, level, name_='internal')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('link'):
+ self.link = attrs.get('link').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'para':
+ obj_ = docParaType.factory()
+ obj_.build(child_)
+ self.para.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'sect1':
+ obj_ = docSect1Type.factory()
+ obj_.build(child_)
+ self.sect1.append(obj_)
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'internal':
+ obj_ = docInternalType.factory()
+ obj_.build(child_)
+ self.set_internal(obj_)
+# end class docCopyType
+
+
+class docCharType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, char=None, valueOf_=''):
+ self.char = char
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docCharType.subclass:
+ return docCharType.subclass(*args_, **kwargs_)
+ else:
+ return docCharType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_char(self): return self.char
+ def set_char(self, char): self.char = char
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docCharType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.char is not None:
+ outfile.write(' char=%s' % (quote_attrib(self.char), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='docCharType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docCharType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.char is not None:
+ showIndent(outfile, level)
+ outfile.write('char = "%s",\n' % (self.char,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('char'):
+ self.char = attrs.get('char').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docCharType
+
+
+class docEmptyType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, valueOf_=''):
+ self.valueOf_ = valueOf_
+ def factory(*args_, **kwargs_):
+ if docEmptyType.subclass:
+ return docEmptyType.subclass(*args_, **kwargs_)
+ else:
+ return docEmptyType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def getValueOf_(self): return self.valueOf_
+ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_
+ def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='docEmptyType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'):
+ pass
+ def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'):
+ if self.valueOf_.find('![CDATA')>-1:
+ value=quote_xml('%s' % self.valueOf_)
+ value=value.replace('![CDATA','<![CDATA')
+ value=value.replace(']]',']]>')
+ outfile.write(value)
+ else:
+ outfile.write(quote_xml('%s' % self.valueOf_))
+ def hasContent_(self):
+ if (
+ self.valueOf_ is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='docEmptyType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ pass
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ self.valueOf_ = ''
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ pass
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.TEXT_NODE:
+ self.valueOf_ += child_.nodeValue
+ elif child_.nodeType == Node.CDATA_SECTION_NODE:
+ self.valueOf_ += '![CDATA['+child_.nodeValue+']]'
+# end class docEmptyType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygen",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from compound import *\n\n')
+ sys.stdout.write('rootObj = doxygen(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygen")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/index.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/index.py
new file mode 100644
index 0000000..7a70e14
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/index.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+"""
+Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
+"""
+
+from xml.dom import minidom
+
+import os
+import sys
+import compound
+
+import indexsuper as supermod
+
+class DoxygenTypeSub(supermod.DoxygenType):
+ def __init__(self, version=None, compound=None):
+ supermod.DoxygenType.__init__(self, version, compound)
+
+ def find_compounds_and_members(self, details):
+ """
+ Returns a list of all compounds and their members which match details
+ """
+
+ results = []
+ for compound in self.compound:
+ members = compound.find_members(details)
+ if members:
+ results.append([compound, members])
+ else:
+ if details.match(compound):
+ results.append([compound, []])
+
+ return results
+
+supermod.DoxygenType.subclass = DoxygenTypeSub
+# end class DoxygenTypeSub
+
+
+class CompoundTypeSub(supermod.CompoundType):
+ def __init__(self, kind=None, refid=None, name='', member=None):
+ supermod.CompoundType.__init__(self, kind, refid, name, member)
+
+ def find_members(self, details):
+ """
+ Returns a list of all members which match details
+ """
+
+ results = []
+
+ for member in self.member:
+ if details.match(member):
+ results.append(member)
+
+ return results
+
+supermod.CompoundType.subclass = CompoundTypeSub
+# end class CompoundTypeSub
+
+
+class MemberTypeSub(supermod.MemberType):
+
+ def __init__(self, kind=None, refid=None, name=''):
+ supermod.MemberType.__init__(self, kind, refid, name)
+
+supermod.MemberType.subclass = MemberTypeSub
+# end class MemberTypeSub
+
+
+def parse(inFilename):
+
+ doc = minidom.parse(inFilename)
+ rootNode = doc.documentElement
+ rootObj = supermod.DoxygenType.factory()
+ rootObj.build(rootNode)
+
+ return rootObj
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/indexsuper.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/indexsuper.py
new file mode 100644
index 0000000..a991530
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+
+#
+# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
+#
+
+import sys
+import getopt
+from string import lower as str_lower
+from xml.dom import minidom
+from xml.dom import Node
+
+#
+# User methods
+#
+# Calls to the methods in these classes are generated by generateDS.py.
+# You can replace these methods by re-implementing the following class
+# in a module named generatedssuper.py.
+
+try:
+ from generatedssuper import GeneratedsSuper
+except ImportError, exp:
+
+ class GeneratedsSuper:
+ def format_string(self, input_data, input_name=''):
+ return input_data
+ def format_integer(self, input_data, input_name=''):
+ return '%d' % input_data
+ def format_float(self, input_data, input_name=''):
+ return '%f' % input_data
+ def format_double(self, input_data, input_name=''):
+ return '%e' % input_data
+ def format_boolean(self, input_data, input_name=''):
+ return '%s' % input_data
+
+
+#
+# If you have installed IPython you can uncomment and use the following.
+# IPython is available from http://ipython.scipy.org/.
+#
+
+## from IPython.Shell import IPShellEmbed
+## args = ''
+## ipshell = IPShellEmbed(args,
+## banner = 'Dropping into IPython',
+## exit_msg = 'Leaving Interpreter, back to program.')
+
+# Then use the following line where and when you want to drop into the
+# IPython shell:
+# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
+
+#
+# Globals
+#
+
+ExternalEncoding = 'ascii'
+
+#
+# Support/utility functions.
+#
+
+def showIndent(outfile, level):
+ for idx in range(level):
+ outfile.write(' ')
+
+def quote_xml(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ return s1
+
+def quote_attrib(inStr):
+ s1 = (isinstance(inStr, basestring) and inStr or
+ '%s' % inStr)
+ s1 = s1.replace('&', '&amp;')
+ s1 = s1.replace('<', '&lt;')
+ s1 = s1.replace('>', '&gt;')
+ if '"' in s1:
+ if "'" in s1:
+ s1 = '"%s"' % s1.replace('"', "&quot;")
+ else:
+ s1 = "'%s'" % s1
+ else:
+ s1 = '"%s"' % s1
+ return s1
+
+def quote_python(inStr):
+ s1 = inStr
+ if s1.find("'") == -1:
+ if s1.find('\n') == -1:
+ return "'%s'" % s1
+ else:
+ return "'''%s'''" % s1
+ else:
+ if s1.find('"') != -1:
+ s1 = s1.replace('"', '\\"')
+ if s1.find('\n') == -1:
+ return '"%s"' % s1
+ else:
+ return '"""%s"""' % s1
+
+
+class MixedContainer:
+ # Constants for category:
+ CategoryNone = 0
+ CategoryText = 1
+ CategorySimple = 2
+ CategoryComplex = 3
+ # Constants for content_type:
+ TypeNone = 0
+ TypeText = 1
+ TypeString = 2
+ TypeInteger = 3
+ TypeFloat = 4
+ TypeDecimal = 5
+ TypeDouble = 6
+ TypeBoolean = 7
+ def __init__(self, category, content_type, name, value):
+ self.category = category
+ self.content_type = content_type
+ self.name = name
+ self.value = value
+ def getCategory(self):
+ return self.category
+ def getContenttype(self, content_type):
+ return self.content_type
+ def getValue(self):
+ return self.value
+ def getName(self):
+ return self.name
+ def export(self, outfile, level, name, namespace):
+ if self.category == MixedContainer.CategoryText:
+ outfile.write(self.value)
+ elif self.category == MixedContainer.CategorySimple:
+ self.exportSimple(outfile, level, name)
+ else: # category == MixedContainer.CategoryComplex
+ self.value.export(outfile, level, namespace,name)
+ def exportSimple(self, outfile, level, name):
+ if self.content_type == MixedContainer.TypeString:
+ outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeInteger or \
+ self.content_type == MixedContainer.TypeBoolean:
+ outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeFloat or \
+ self.content_type == MixedContainer.TypeDecimal:
+ outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
+ elif self.content_type == MixedContainer.TypeDouble:
+ outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
+ def exportLiteral(self, outfile, level, name):
+ if self.category == MixedContainer.CategoryText:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ elif self.category == MixedContainer.CategorySimple:
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \
+ (self.category, self.content_type, self.name, self.value))
+ else: # category == MixedContainer.CategoryComplex
+ showIndent(outfile, level)
+ outfile.write('MixedContainer(%d, %d, "%s",\n' % \
+ (self.category, self.content_type, self.name,))
+ self.value.exportLiteral(outfile, level + 1)
+ showIndent(outfile, level)
+ outfile.write(')\n')
+
+
+class _MemberSpec(object):
+ def __init__(self, name='', data_type='', container=0):
+ self.name = name
+ self.data_type = data_type
+ self.container = container
+ def set_name(self, name): self.name = name
+ def get_name(self): return self.name
+ def set_data_type(self, data_type): self.data_type = data_type
+ def get_data_type(self): return self.data_type
+ def set_container(self, container): self.container = container
+ def get_container(self): return self.container
+
+
+#
+# Data representation classes.
+#
+
+class DoxygenType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, version=None, compound=None):
+ self.version = version
+ if compound is None:
+ self.compound = []
+ else:
+ self.compound = compound
+ def factory(*args_, **kwargs_):
+ if DoxygenType.subclass:
+ return DoxygenType.subclass(*args_, **kwargs_)
+ else:
+ return DoxygenType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_compound(self): return self.compound
+ def set_compound(self, compound): self.compound = compound
+ def add_compound(self, value): self.compound.append(value)
+ def insert_compound(self, index, value): self.compound[index] = value
+ def get_version(self): return self.version
+ def set_version(self, version): self.version = version
+ def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
+ outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
+ for compound_ in self.compound:
+ compound_.export(outfile, level, namespace_, name_='compound')
+ def hasContent_(self):
+ if (
+ self.compound is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='DoxygenType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.version is not None:
+ showIndent(outfile, level)
+ outfile.write('version = %s,\n' % (self.version,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('compound=[\n')
+ level += 1
+ for compound in self.compound:
+ showIndent(outfile, level)
+ outfile.write('model_.compound(\n')
+ compound.exportLiteral(outfile, level, name_='compound')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('version'):
+ self.version = attrs.get('version').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'compound':
+ obj_ = CompoundType.factory()
+ obj_.build(child_)
+ self.compound.append(obj_)
+# end class DoxygenType
+
+
+class CompoundType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None, member=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ if member is None:
+ self.member = []
+ else:
+ self.member = member
+ def factory(*args_, **kwargs_):
+ if CompoundType.subclass:
+ return CompoundType.subclass(*args_, **kwargs_)
+ else:
+ return CompoundType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_member(self): return self.member
+ def set_member(self, member): self.member = member
+ def add_member(self, value): self.member.append(value)
+ def insert_member(self, index, value): self.member[index] = value
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='CompoundType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ for member_ in self.member:
+ member_.export(outfile, level, namespace_, name_='member')
+ def hasContent_(self):
+ if (
+ self.name is not None or
+ self.member is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='CompoundType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ showIndent(outfile, level)
+ outfile.write('member=[\n')
+ level += 1
+ for member in self.member:
+ showIndent(outfile, level)
+ outfile.write('model_.member(\n')
+ member.exportLiteral(outfile, level, name_='member')
+ showIndent(outfile, level)
+ outfile.write('),\n')
+ level -= 1
+ showIndent(outfile, level)
+ outfile.write('],\n')
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+ elif child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'member':
+ obj_ = MemberType.factory()
+ obj_.build(child_)
+ self.member.append(obj_)
+# end class CompoundType
+
+
+class MemberType(GeneratedsSuper):
+ subclass = None
+ superclass = None
+ def __init__(self, kind=None, refid=None, name=None):
+ self.kind = kind
+ self.refid = refid
+ self.name = name
+ def factory(*args_, **kwargs_):
+ if MemberType.subclass:
+ return MemberType.subclass(*args_, **kwargs_)
+ else:
+ return MemberType(*args_, **kwargs_)
+ factory = staticmethod(factory)
+ def get_name(self): return self.name
+ def set_name(self, name): self.name = name
+ def get_kind(self): return self.kind
+ def set_kind(self, kind): self.kind = kind
+ def get_refid(self): return self.refid
+ def set_refid(self, refid): self.refid = refid
+ def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''):
+ showIndent(outfile, level)
+ outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
+ self.exportAttributes(outfile, level, namespace_, name_='MemberType')
+ if self.hasContent_():
+ outfile.write('>\n')
+ self.exportChildren(outfile, level + 1, namespace_, name_)
+ showIndent(outfile, level)
+ outfile.write('</%s%s>\n' % (namespace_, name_))
+ else:
+ outfile.write(' />\n')
+ def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'):
+ outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
+ outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), ))
+ def exportChildren(self, outfile, level, namespace_='', name_='MemberType'):
+ if self.name is not None:
+ showIndent(outfile, level)
+ outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
+ def hasContent_(self):
+ if (
+ self.name is not None
+ ):
+ return True
+ else:
+ return False
+ def exportLiteral(self, outfile, level, name_='MemberType'):
+ level += 1
+ self.exportLiteralAttributes(outfile, level, name_)
+ if self.hasContent_():
+ self.exportLiteralChildren(outfile, level, name_)
+ def exportLiteralAttributes(self, outfile, level, name_):
+ if self.kind is not None:
+ showIndent(outfile, level)
+ outfile.write('kind = "%s",\n' % (self.kind,))
+ if self.refid is not None:
+ showIndent(outfile, level)
+ outfile.write('refid = %s,\n' % (self.refid,))
+ def exportLiteralChildren(self, outfile, level, name_):
+ showIndent(outfile, level)
+ outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding))
+ def build(self, node_):
+ attrs = node_.attributes
+ self.buildAttributes(attrs)
+ for child_ in node_.childNodes:
+ nodeName_ = child_.nodeName.split(':')[-1]
+ self.buildChildren(child_, nodeName_)
+ def buildAttributes(self, attrs):
+ if attrs.get('kind'):
+ self.kind = attrs.get('kind').value
+ if attrs.get('refid'):
+ self.refid = attrs.get('refid').value
+ def buildChildren(self, child_, nodeName_):
+ if child_.nodeType == Node.ELEMENT_NODE and \
+ nodeName_ == 'name':
+ name_ = ''
+ for text__content_ in child_.childNodes:
+ name_ += text__content_.nodeValue
+ self.name = name_
+# end class MemberType
+
+
+USAGE_TEXT = """
+Usage: python <Parser>.py [ -s ] <in_xml_file>
+Options:
+ -s Use the SAX parser, not the minidom parser.
+"""
+
+def usage():
+ print USAGE_TEXT
+ sys.exit(1)
+
+
+def parse(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseString(inString):
+ doc = minidom.parseString(inString)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('<?xml version="1.0" ?>\n')
+ rootObj.export(sys.stdout, 0, name_="doxygenindex",
+ namespacedef_='')
+ return rootObj
+
+
+def parseLiteral(inFileName):
+ doc = minidom.parse(inFileName)
+ rootNode = doc.documentElement
+ rootObj = DoxygenType.factory()
+ rootObj.build(rootNode)
+ # Enable Python to collect the space used by the DOM.
+ doc = None
+ sys.stdout.write('from index import *\n\n')
+ sys.stdout.write('rootObj = doxygenindex(\n')
+ rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex")
+ sys.stdout.write(')\n')
+ return rootObj
+
+
+def main():
+ args = sys.argv[1:]
+ if len(args) == 1:
+ parse(args[0])
+ else:
+ usage()
+
+
+
+
+if __name__ == '__main__':
+ main()
+ #import pdb
+ #pdb.run('main()')
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/doxyxml/text.py b/op25/gr-op25_repeater/docs/doxygen/doxyxml/text.py
new file mode 100644
index 0000000..629edd1
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/doxyxml/text.py
@@ -0,0 +1,56 @@
+#
+# 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.
+#
+"""
+Utilities for extracting text from generated classes.
+"""
+
+def is_string(txt):
+ if isinstance(txt, str):
+ return True
+ try:
+ if isinstance(txt, unicode):
+ return True
+ except NameError:
+ pass
+ return False
+
+def description(obj):
+ if obj is None:
+ return None
+ return description_bit(obj).strip()
+
+def description_bit(obj):
+ if hasattr(obj, 'content'):
+ contents = [description_bit(item) for item in obj.content]
+ result = ''.join(contents)
+ elif hasattr(obj, 'content_'):
+ contents = [description_bit(item) for item in obj.content_]
+ result = ''.join(contents)
+ elif hasattr(obj, 'value'):
+ result = description_bit(obj.value)
+ elif is_string(obj):
+ return obj
+ else:
+ raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ # If this bit is a paragraph then add one some line breaks.
+ if hasattr(obj, 'name') and obj.name == 'para':
+ result += "\n\n"
+ return result
diff --git a/op25/gr-op25_repeater/docs/doxygen/other/group_defs.dox b/op25/gr-op25_repeater/docs/doxygen/other/group_defs.dox
new file mode 100644
index 0000000..f2659f8
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/other/group_defs.dox
@@ -0,0 +1,7 @@
+/*!
+ * \defgroup block GNU Radio OP25_REPEATER C++ Signal Processing Blocks
+ * \brief All C++ blocks that can be used from the OP25_REPEATER GNU Radio
+ * module are listed here or in the subcategories below.
+ *
+ */
+
diff --git a/op25/gr-op25_repeater/docs/doxygen/other/main_page.dox b/op25/gr-op25_repeater/docs/doxygen/other/main_page.dox
new file mode 100644
index 0000000..c8b9462
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/other/main_page.dox
@@ -0,0 +1,10 @@
+/*! \mainpage
+
+Welcome to the GNU Radio OP25_REPEATER Block
+
+This is the intro page for the Doxygen manual generated for the OP25_REPEATER
+block (docs/doxygen/other/main_page.dox). Edit it to add more detailed
+documentation about the new GNU Radio modules contained in this
+project.
+
+*/
diff --git a/op25/gr-op25_repeater/docs/doxygen/swig_doc.py b/op25/gr-op25_repeater/docs/doxygen/swig_doc.py
new file mode 100644
index 0000000..4e1ce2e
--- /dev/null
+++ b/op25/gr-op25_repeater/docs/doxygen/swig_doc.py
@@ -0,0 +1,255 @@
+#
+# 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.
+#
+"""
+Creates the swig_doc.i SWIG interface file.
+Execute using: python swig_doc.py xml_path outputfilename
+
+The file instructs SWIG to transfer the doxygen comments into the
+python docstrings.
+
+"""
+
+import sys
+
+try:
+ from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
+except ImportError:
+ from gnuradio.doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile, base
+
+
+def py_name(name):
+ bits = name.split('_')
+ return '_'.join(bits[1:])
+
+def make_name(name):
+ bits = name.split('_')
+ return bits[0] + '_make_' + '_'.join(bits[1:])
+
+
+class Block(object):
+ """
+ Checks if doxyxml produced objects correspond to a gnuradio block.
+ """
+
+ @classmethod
+ def includes(cls, item):
+ if not isinstance(item, DoxyClass):
+ return False
+ # Check for a parsing error.
+ if item.error():
+ return False
+ return item.has_member(make_name(item.name()), DoxyFriend)
+
+
+def utoascii(text):
+ """
+ Convert unicode text into ascii and escape quotes.
+ """
+ if text is None:
+ return ''
+ out = text.encode('ascii', 'replace')
+ out = out.replace('"', '\\"')
+ return out
+
+
+def combine_descriptions(obj):
+ """
+ Combines the brief and detailed descriptions of an object together.
+ """
+ description = []
+ bd = obj.brief_description.strip()
+ dd = obj.detailed_description.strip()
+ if bd:
+ description.append(bd)
+ if dd:
+ description.append(dd)
+ return utoascii('\n\n'.join(description)).strip()
+
+
+entry_templ = '%feature("docstring") {name} "{docstring}"'
+def make_entry(obj, name=None, templ="{description}", description=None):
+ """
+ Create a docstring entry for a swig interface file.
+
+ obj - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to obj.name())
+ templ - an optional template for the docstring containing only one
+ variable named 'description'.
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from obj.
+ """
+ if name is None:
+ name=obj.name()
+ if "operator " in name:
+ return ''
+ if description is None:
+ description = combine_descriptions(obj)
+ docstring = templ.format(description=description)
+ if not docstring:
+ return ''
+ return entry_templ.format(
+ name=name,
+ docstring=docstring,
+ )
+
+
+def make_func_entry(func, name=None, description=None, params=None):
+ """
+ Create a function docstring entry for a swig interface file.
+
+ func - a doxyxml object from which documentation will be extracted.
+ name - the name of the C object (defaults to func.name())
+ description - if this optional variable is set then it's value is
+ used as the description instead of extracting it from func.
+ params - a parameter list that overrides using func.params.
+ """
+ if params is None:
+ params = func.params
+ params = [prm.declname for prm in params]
+ if params:
+ sig = "Params: (%s)" % ", ".join(params)
+ else:
+ sig = "Params: (NONE)"
+ templ = "{description}\n\n" + sig
+ return make_entry(func, name=name, templ=utoascii(templ),
+ description=description)
+
+
+def make_class_entry(klass, description=None):
+ """
+ Create a class docstring for a swig interface file.
+ """
+ output = []
+ output.append(make_entry(klass, description=description))
+ for func in klass.in_category(DoxyFunction):
+ name = klass.name() + '::' + func.name()
+ output.append(make_func_entry(func, name=name))
+ return "\n\n".join(output)
+
+
+def make_block_entry(di, block):
+ """
+ Create class and function docstrings of a gnuradio block for a
+ swig interface file.
+ """
+ descriptions = []
+ # Get the documentation associated with the class.
+ class_desc = combine_descriptions(block)
+ if class_desc:
+ descriptions.append(class_desc)
+ # Get the documentation associated with the make function
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_func_desc = combine_descriptions(make_func)
+ if make_func_desc:
+ descriptions.append(make_func_desc)
+ # Get the documentation associated with the file
+ try:
+ block_file = di.get_member(block.name() + ".h", DoxyFile)
+ file_desc = combine_descriptions(block_file)
+ if file_desc:
+ descriptions.append(file_desc)
+ except base.Base.NoSuchMember:
+ # Don't worry if we can't find a matching file.
+ pass
+ # And join them all together to make a super duper description.
+ super_description = "\n\n".join(descriptions)
+ # Associate the combined description with the class and
+ # the make function.
+ output = []
+ output.append(make_class_entry(block, description=super_description))
+ creator = block.get_member(block.name(), DoxyFunction)
+ output.append(make_func_entry(make_func, description=super_description,
+ params=creator.params))
+ return "\n\n".join(output)
+
+
+def make_swig_interface_file(di, swigdocfilename, custom_output=None):
+
+ output = ["""
+/*
+ * This file was automatically generated using swig_doc.py.
+ *
+ * Any changes to it will be lost next time it is regenerated.
+ */
+"""]
+
+ if custom_output is not None:
+ output.append(custom_output)
+
+ # Create docstrings for the blocks.
+ blocks = di.in_category(Block)
+ make_funcs = set([])
+ for block in blocks:
+ try:
+ make_func = di.get_member(make_name(block.name()), DoxyFunction)
+ make_funcs.add(make_func.name())
+ output.append(make_block_entry(di, block))
+ except block.ParsingError:
+ print('Parsing error for block %s' % block.name())
+
+ # Create docstrings for functions
+ # Don't include the make functions since they have already been dealt with.
+ funcs = [f for f in di.in_category(DoxyFunction) if f.name() not in make_funcs]
+ for f in funcs:
+ try:
+ output.append(make_func_entry(f))
+ except f.ParsingError:
+ print('Parsing error for function %s' % f.name())
+
+ # Create docstrings for classes
+ block_names = [block.name() for block in blocks]
+ klasses = [k for k in di.in_category(DoxyClass) if k.name() not in block_names]
+ for k in klasses:
+ try:
+ output.append(make_class_entry(k))
+ except k.ParsingError:
+ print('Parsing error for class %s' % k.name())
+
+ # Docstrings are not created for anything that is not a function or a class.
+ # If this excludes anything important please add it here.
+
+ output = "\n\n".join(output)
+
+ swig_doc = file(swigdocfilename, 'w')
+ swig_doc.write(output)
+ swig_doc.close()
+
+if __name__ == "__main__":
+ # Parse command line options and set up doxyxml.
+ err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
+ if len(sys.argv) != 3:
+ raise StandardError(err_msg)
+ xml_path = sys.argv[1]
+ swigdocfilename = sys.argv[2]
+ di = DoxyIndex(xml_path)
+
+ # gnuradio.gr.msq_queue.insert_tail and delete_head create errors unless docstrings are defined!
+ # This is presumably a bug in SWIG.
+ #msg_q = di.get_member(u'gr_msg_queue', DoxyClass)
+ #insert_tail = msg_q.get_member(u'insert_tail', DoxyFunction)
+ #delete_head = msg_q.get_member(u'delete_head', DoxyFunction)
+ output = []
+ #output.append(make_func_entry(insert_tail, name='gr_py_msg_queue__insert_tail'))
+ #output.append(make_func_entry(delete_head, name='gr_py_msg_queue__delete_head'))
+ custom_output = "\n\n".join(output)
+
+ # Generate the docstrings interface file.
+ make_swig_interface_file(di, swigdocfilename, custom_output=custom_output)
diff --git a/op25/gr-op25_repeater/grc/CMakeLists.txt b/op25/gr-op25_repeater/grc/CMakeLists.txt
new file mode 100644
index 0000000..f0389b4
--- /dev/null
+++ b/op25/gr-op25_repeater/grc/CMakeLists.txt
@@ -0,0 +1,24 @@
+# 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.
+install(FILES
+ op25_repeater_vocoder.xml
+ op25_repeater_gardner_costas_cc.xml
+ op25_repeater_p25_frame_assembler.xml
+ op25_repeater_fsk4_slicer_fb.xml DESTINATION share/gnuradio/grc/blocks
+)
diff --git a/op25/gr-op25_repeater/grc/op25_repeater_fsk4_slicer_fb.xml b/op25/gr-op25_repeater/grc/op25_repeater_fsk4_slicer_fb.xml
new file mode 100644
index 0000000..403e89e
--- /dev/null
+++ b/op25/gr-op25_repeater/grc/op25_repeater_fsk4_slicer_fb.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<block>
+ <name>fsk4_slicer_fb</name>
+ <key>op25_repeater_fsk4_slicer_fb</key>
+ <category>op25_repeater</category>
+ <import>import op25_repeater</import>
+ <make>op25_repeater.fsk4_slicer_fb($&slice_levels)</make>
+ <!-- Make one 'param' node for every Parameter you want settable from the GUI.
+ Sub-nodes:
+ * name
+ * key (makes the value accessible as $keyname, e.g. in the make node)
+ * type -->
+ <param>
+ <name>...</name>
+ <key>...</key>
+ <type>...</type>
+ </param>
+
+ <!-- Make one 'sink' node per input. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <sink>
+ <name>in</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </sink>
+
+ <!-- Make one 'source' node per output. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <source>
+ <name>out</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </source>
+</block>
diff --git a/op25/gr-op25_repeater/grc/op25_repeater_gardner_costas_cc.xml b/op25/gr-op25_repeater/grc/op25_repeater_gardner_costas_cc.xml
new file mode 100644
index 0000000..313ed4b
--- /dev/null
+++ b/op25/gr-op25_repeater/grc/op25_repeater_gardner_costas_cc.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<block>
+ <name>gardner_costas_cc</name>
+ <key>op25_repeater_gardner_costas_cc</key>
+ <category>op25_repeater</category>
+ <import>import op25_repeater</import>
+ <make>op25_repeater.gardner_costas_cc($samples_per_symbol, $gain_mu, $gain_omega, $alpha, $beta, $max_freq, $min_freq)</make>
+ <!-- Make one 'param' node for every Parameter you want settable from the GUI.
+ Sub-nodes:
+ * name
+ * key (makes the value accessible as $keyname, e.g. in the make node)
+ * type -->
+ <param>
+ <name>Samples Per Symbol</name>
+ <key>samples_per_symbol</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Gain Mu</name>
+ <key>gain_mu</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Gain Omega</name>
+ <key>gain_omega</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Beta</name>
+ <key>beta</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Maximum Frequency</name>
+ <key>max_freq</key>
+ <type>float</type>
+ </param>
+ <param>
+ <name>Mininum Frequency</name>
+ <key>min_freq</key>
+ <type>float</type>
+ </param>
+
+ <!-- Make one 'sink' node per input. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+
+ <!-- Make one 'source' node per output. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
diff --git a/op25/gr-op25_repeater/grc/op25_repeater_p25_frame_assembler.xml b/op25/gr-op25_repeater/grc/op25_repeater_p25_frame_assembler.xml
new file mode 100644
index 0000000..bbff967
--- /dev/null
+++ b/op25/gr-op25_repeater/grc/op25_repeater_p25_frame_assembler.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<block>
+ <name>p25_frame_assembler</name>
+ <key>op25_repeater_p25_frame_assembler</key>
+ <category>op25_repeater</category>
+ <import>import op25_repeater</import>
+ <make>op25_repeater.p25_frame_assembler($udp_host, $port, $debug, $do_imbe, $do_output, $do_msgq, $queue)</make>
+ <!-- Make one 'param' node for every Parameter you want settable from the GUI.
+ Sub-nodes:
+ * name
+ * key (makes the value accessible as $keyname, e.g. in the make node)
+ * type -->
+ <param>
+ <name>...</name>
+ <key>...</key>
+ <type>...</type>
+ </param>
+
+ <!-- Make one 'sink' node per input. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <sink>
+ <name>in</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </sink>
+
+ <!-- Make one 'source' node per output. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <source>
+ <name>out</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </source>
+</block>
diff --git a/op25/gr-op25_repeater/grc/op25_repeater_vocoder.xml b/op25/gr-op25_repeater/grc/op25_repeater_vocoder.xml
new file mode 100644
index 0000000..9a31cd5
--- /dev/null
+++ b/op25/gr-op25_repeater/grc/op25_repeater_vocoder.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<block>
+ <name>vocoder</name>
+ <key>op25_repeater_vocoder</key>
+ <category>op25_repeater</category>
+ <import>import op25_repeater</import>
+ <make>op25_repeater.vocoder($encode_flag, $verbose_flag, $stretch_amt, $udp_host, $udp_port, $raw_vectors_flag)</make>
+ <!-- Make one 'param' node for every Parameter you want settable from the GUI.
+ Sub-nodes:
+ * name
+ * key (makes the value accessible as $keyname, e.g. in the make node)
+ * type -->
+ <param>
+ <name>...</name>
+ <key>...</key>
+ <type>...</type>
+ </param>
+
+ <!-- Make one 'sink' node per input. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <sink>
+ <name>in</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </sink>
+
+ <!-- Make one 'source' node per output. Sub-nodes:
+ * name (an identifier for the GUI)
+ * type
+ * vlen
+ * optional (set to 1 for optional inputs) -->
+ <source>
+ <name>out</name>
+ <type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
+ </source>
+</block>
diff --git a/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt b/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt
new file mode 100644
index 0000000..49f75d2
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright 2011,2012 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 public header files
+########################################################################
+install(FILES
+ api.h
+ vocoder.h
+ gardner_costas_cc.h
+ p25_frame_assembler.h
+ fsk4_slicer_fb.h DESTINATION include/op25_repeater
+)
diff --git a/op25/gr-op25_repeater/include/op25_repeater/api.h b/op25/gr-op25_repeater/include/op25_repeater/api.h
new file mode 100644
index 0000000..96c94b8
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/api.h
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+#ifndef INCLUDED_OP25_REPEATER_API_H
+#define INCLUDED_OP25_REPEATER_API_H
+
+#include <gnuradio/attributes.h>
+
+#ifdef gnuradio_op25_repeater_EXPORTS
+# define OP25_REPEATER_API __GR_ATTR_EXPORT
+#else
+# define OP25_REPEATER_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_OP25_REPEATER_API_H */
diff --git a/op25/gr-op25_repeater/include/op25_repeater/fsk4_slicer_fb.h b/op25/gr-op25_repeater/include/op25_repeater/fsk4_slicer_fb.h
new file mode 100644
index 0000000..52e467b
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/fsk4_slicer_fb.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_H
+#define INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_H
+
+#include <op25_repeater/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup op25_repeater
+ *
+ */
+ class OP25_REPEATER_API fsk4_slicer_fb : virtual public gr::sync_block
+ {
+ public:
+ typedef boost::shared_ptr<fsk4_slicer_fb> sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of op25_repeater::fsk4_slicer_fb.
+ *
+ * To avoid accidental use of raw pointers, op25_repeater::fsk4_slicer_fb's
+ * constructor is in a private implementation
+ * class. op25_repeater::fsk4_slicer_fb::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(const std::vector<float> &slice_levels);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_H */
+
diff --git a/op25/gr-op25_repeater/include/op25_repeater/gardner_costas_cc.h b/op25/gr-op25_repeater/include/op25_repeater/gardner_costas_cc.h
new file mode 100644
index 0000000..0bfea31
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/gardner_costas_cc.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_H
+#define INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_H
+
+#include <op25_repeater/api.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup op25_repeater
+ *
+ */
+ class OP25_REPEATER_API gardner_costas_cc : virtual public gr::block
+ {
+ public:
+ typedef boost::shared_ptr<gardner_costas_cc> sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of op25_repeater::gardner_costas_cc.
+ *
+ * To avoid accidental use of raw pointers, op25_repeater::gardner_costas_cc's
+ * constructor is in a private implementation
+ * class. op25_repeater::gardner_costas_cc::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(float samples_per_symbol, float gain_mu, float gain_omega, float alpha, float beta, float max_freq, float min_freq);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_H */
+
diff --git a/op25/gr-op25_repeater/include/op25_repeater/p25_frame_assembler.h b/op25/gr-op25_repeater/include/op25_repeater/p25_frame_assembler.h
new file mode 100644
index 0000000..a5c608a
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/p25_frame_assembler.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_H
+#define INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_H
+
+#include <op25_repeater/api.h>
+#include <gnuradio/block.h>
+#include <gnuradio/msg_queue.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup op25_repeater
+ *
+ */
+ class OP25_REPEATER_API p25_frame_assembler : virtual public gr::block
+ {
+ public:
+ typedef boost::shared_ptr<p25_frame_assembler> sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of op25_repeater::p25_frame_assembler.
+ *
+ * To avoid accidental use of raw pointers, op25_repeater::p25_frame_assembler's
+ * constructor is in a private implementation
+ * class. op25_repeater::p25_frame_assembler::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_H */
+
diff --git a/op25/gr-op25_repeater/include/op25_repeater/vocoder.h b/op25/gr-op25_repeater/include/op25_repeater/vocoder.h
new file mode 100644
index 0000000..4285202
--- /dev/null
+++ b/op25/gr-op25_repeater/include/op25_repeater/vocoder.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2013 <+YOU OR YOUR COMPANY+>.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_OP25_REPEATER_VOCODER_H
+#define INCLUDED_OP25_REPEATER_VOCODER_H
+
+#include <op25_repeater/api.h>
+#include <gnuradio/block.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup op25_repeater
+ *
+ */
+ class OP25_REPEATER_API vocoder : virtual public gr::block
+ {
+ public:
+ typedef boost::shared_ptr<vocoder> sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of op25_repeater::vocoder.
+ *
+ * To avoid accidental use of raw pointers, op25_repeater::vocoder's
+ * constructor is in a private implementation
+ * class. op25_repeater::vocoder::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_VOCODER_H */
+
diff --git a/op25/gr-op25_repeater/lib/CMakeLists.txt b/op25/gr-op25_repeater/lib/CMakeLists.txt
new file mode 100644
index 0000000..39c3fa8
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/CMakeLists.txt
@@ -0,0 +1,80 @@
+# Copyright 2011,2012 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 library
+########################################################################
+include(GrPlatform) #define LIB_SUFFIX
+
+include_directories(${Boost_INCLUDE_DIR})
+link_directories(${Boost_LIBRARY_DIRS})
+list(APPEND op25_repeater_sources
+ vocoder_impl.cc
+ gardner_costas_cc_impl.cc
+ p25_frame_assembler_impl.cc
+ fsk4_slicer_fb_impl.cc )
+
+list(APPEND op25_repeater_sources
+ bch.cc
+ rs.cc
+ p25_framer.cc
+ imbe_decoder.cc
+ software_imbe_decoder.cc
+)
+
+add_library(gnuradio-op25_repeater SHARED ${op25_repeater_sources})
+find_library(GR_FILTER_LIBRARY libgnuradio-filter.so )
+set(GR_FILTER_LIBRARIES ${GR_FILTER_LIBRARY})
+target_link_libraries(gnuradio-op25_repeater ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GR_FILTER_LIBRARIES} imbe_vocoder)
+set_target_properties(gnuradio-op25_repeater PROPERTIES DEFINE_SYMBOL "gnuradio_op25_repeater_EXPORTS")
+
+########################################################################
+# Install built library files
+########################################################################
+install(TARGETS gnuradio-op25_repeater
+ LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
+ ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
+ RUNTIME DESTINATION bin # .dll file
+)
+
+########################################################################
+# Build and register unit test
+########################################################################
+include(GrTest)
+
+include_directories(${CPPUNIT_INCLUDE_DIRS})
+
+list(APPEND test_op25_repeater_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_op25_repeater.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/qa_op25_repeater.cc
+)
+
+add_executable(test-op25_repeater ${test_op25_repeater_sources})
+
+target_link_libraries(
+ test-op25_repeater
+ ${GNURADIO_RUNTIME_LIBRARIES}
+ ${Boost_LIBRARIES}
+ ${CPPUNIT_LIBRARIES}
+ gnuradio-op25_repeater
+)
+
+GR_ADD_TEST(test_op25_repeater test-op25_repeater)
+
+add_subdirectory(imbe_vocoder)
diff --git a/op25/gr-op25_repeater/lib/bch.cc b/op25/gr-op25_repeater/lib/bch.cc
new file mode 100644
index 0000000..7ff4faf
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/bch.cc
@@ -0,0 +1,162 @@
+
+#include <stdio.h>
+#include <vector>
+#include <bch.h>
+/*
+ * Copyright 2010, KA1RBI
+ */
+static const int bchGFexp[64] = {
+ 1, 2, 4, 8, 16, 32, 3, 6, 12, 24, 48, 35, 5, 10, 20, 40,
+ 19, 38, 15, 30, 60, 59, 53, 41, 17, 34, 7, 14, 28, 56, 51, 37,
+ 9, 18, 36, 11, 22, 44, 27, 54, 47, 29, 58, 55, 45, 25, 50, 39,
+ 13, 26, 52, 43, 21, 42, 23, 46, 31, 62, 63, 61, 57, 49, 33, 0
+};
+
+static const int bchGFlog[64] = {
+ -1, 0, 1, 6, 2, 12, 7, 26, 3, 32, 13, 35, 8, 48, 27, 18,
+ 4, 24, 33, 16, 14, 52, 36, 54, 9, 45, 49, 38, 28, 41, 19, 56,
+ 5, 62, 25, 11, 34, 31, 17, 47, 15, 23, 53, 51, 37, 44, 55, 40,
+ 10, 61, 46, 30, 50, 22, 39, 43, 29, 60, 42, 21, 20, 59, 57, 58
+};
+
+static const int bchG[48] = {
+ 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0,
+ 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,
+ 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1
+};
+
+int bchDec(bit_vector& Codeword)
+{
+
+ int elp[24][ 22], S[23];
+ int D[23], L[24], uLu[24];
+ int root[11], locn[11], reg[12];
+ int i,j,U,q,count;
+ int SynError, CantDecode;
+
+ SynError = 0; CantDecode = 0;
+
+ for(i = 1; i <= 22; i++) {
+ S[i] = 0;
+ // FOR j = 0 TO 62
+ for(j = 0; j <= 62; j++) {
+ if( Codeword[j]) { S[i] = S[i] ^ bchGFexp[(i * j) % 63]; }
+ }
+ if( S[i]) { SynError = 1; }
+ S[i] = bchGFlog[S[i]];
+ // printf("S[%d] %d\n", i, S[i]);
+ }
+
+ if( SynError) { //if there are errors, try to correct them
+ L[0] = 0; uLu[0] = -1; D[0] = 0; elp[0][ 0] = 0;
+ L[1] = 0; uLu[1] = 0; D[1] = S[1]; elp[1][ 0] = 1;
+ //FOR i = 1 TO 21
+ for(i = 1; i <= 21; i++) {
+ elp[0][ i] = -1; elp[1][ i] = 0;
+ }
+ U = 0;
+
+ do {
+ U = U + 1;
+ if( D[U] == -1) {
+ L[U + 1] = L[U];
+ // FOR i = 0 TO L[U]
+ for(i = 0; i <= L[U]; i++) {
+ elp[U + 1][ i] = elp[U][ i]; elp[U][ i] = bchGFlog[elp[U][ i]];
+ }
+ } else {
+ //search for words with greatest uLu(q) for which d(q)!=0
+ q = U - 1;
+ while((D[q] == -1) &&(q > 0)) { q = q - 1; }
+ //have found first non-zero d(q)
+ if( q > 0) {
+ j = q;
+ do { j = j - 1; if((D[j] != -1) &&(uLu[q] < uLu[j])) { q = j; }
+ } while( j > 0) ;
+ }
+
+ //store degree of new elp polynomial
+ if( L[U] > L[q] + U - q) {
+ L[U + 1] = L[U] ;
+ } else {
+ L[U + 1] = L[q] + U - q;
+ }
+
+ ///* form new elp(x) */
+ // FOR i = 0 TO 21
+ for(i = 0; i <= 21; i++) {
+ elp[U + 1][ i] = 0;
+ }
+ // FOR i = 0 TO L(q)
+ for(i = 0; i <= L[q]; i++) {
+ if( elp[q][ i] != -1) {
+ elp[U + 1][ i + U - q] = bchGFexp[(D[U] + 63 - D[q] + elp[q][ i]) % 63];
+ }
+ }
+ // FOR i = 0 TO L(U)
+ for(i = 0; i <= L[U]; i++) {
+ elp[U + 1][ i] = elp[U + 1][ i] ^ elp[U][ i];
+ elp[U][ i] = bchGFlog[elp[U][ i]];
+ }
+ }
+ uLu[U + 1] = U - L[U + 1];
+
+ //form(u+1)th discrepancy
+ if( U < 22) {
+ //no discrepancy computed on last iteration
+ if( S[U + 1] != -1) { D[U + 1] = bchGFexp[S[U + 1]]; } else { D[U + 1] = 0; }
+ // FOR i = 1 TO L(U + 1)
+ for(i = 1; i <= L[U + 1]; i++) {
+ if((S[U + 1 - i] != -1) &&(elp[U + 1][ i] != 0)) {
+ D[U + 1] = D[U + 1] ^ bchGFexp[(S[U + 1 - i] + bchGFlog[elp[U + 1][ i]]) % 63];
+ }
+ }
+ //put d(u+1) into index form */
+ D[U + 1] = bchGFlog[D[U + 1]];
+ }
+ } while((U < 22) &&(L[U + 1] <= 11));
+
+ U = U + 1;
+ if( L[U] <= 11) { // /* Can correct errors */
+ //put elp into index form
+ // FOR i = 0 TO L[U]
+ for(i = 0; i <= L[U]; i++) {
+ elp[U][ i] = bchGFlog[elp[U][ i]];
+ }
+
+ //Chien search: find roots of the error location polynomial
+ // FOR i = 1 TO L(U)
+ for(i = 1; i <= L[U]; i++) {
+ reg[i] = elp[U][ i];
+ }
+ count = 0;
+ // FOR i = 1 TO 63
+ for(i = 1; i <= 63; i++) {
+ q = 1;
+ //FOR j = 1 TO L(U)
+ for(j = 1; j <= L[U]; j++) {
+ if( reg[j] != -1) {
+ reg[j] =(reg[j] + j) % 63; q = q ^ bchGFexp[reg[j]];
+ }
+ }
+ if( q == 0) { //store root and error location number indices
+ root[count] = i; locn[count] = 63 - i; count = count + 1;
+ }
+ }
+ if( count == L[U]) {
+ //no. roots = degree of elp hence <= t errors
+ //FOR i = 0 TO L[U] - 1
+ for(i = 0; i <= L[U]-1; i++) {
+ Codeword[locn[i]] = Codeword[locn[i]] ^ 1;
+ }
+ CantDecode = count;
+ } else { //elp has degree >t hence cannot solve
+ CantDecode = -1;
+ }
+ } else {
+ CantDecode = -2;
+ }
+ }
+ return CantDecode;
+}
+
diff --git a/op25/gr-op25_repeater/lib/bch.h b/op25/gr-op25_repeater/lib/bch.h
new file mode 100644
index 0000000..d151405
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/bch.h
@@ -0,0 +1,4 @@
+#include <vector>
+typedef std::vector<bool> bit_vector;
+int bchDec(bit_vector& Codeword);
+
diff --git a/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.cc b/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.cc
new file mode 100644
index 0000000..4797d87
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.cc
@@ -0,0 +1,108 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "fsk4_slicer_fb_impl.h"
+#include <stdio.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ fsk4_slicer_fb::sptr
+ fsk4_slicer_fb::make(const std::vector<float> &slice_levels)
+ {
+ return gnuradio::get_initial_sptr
+ (new fsk4_slicer_fb_impl(slice_levels));
+ }
+
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+static const int MIN_OUT = 1; // minimum number of output streams
+static const int MAX_OUT = 1; // maximum number of output streams
+
+ /*
+ * The private constructor
+ */
+ fsk4_slicer_fb_impl::fsk4_slicer_fb_impl(const std::vector<float> &slice_levels)
+ : gr::sync_block("fsk4_slicer_fb",
+ gr::io_signature::make (MIN_IN, MAX_IN, sizeof (float)),
+ gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (unsigned char)))
+{
+ d_slice_levels[0] = slice_levels[0];
+ d_slice_levels[1] = slice_levels[1];
+ d_slice_levels[2] = slice_levels[2];
+ d_slice_levels[3] = slice_levels[3];
+}
+
+ /*
+ * Our virtual destructor.
+ */
+ fsk4_slicer_fb_impl::~fsk4_slicer_fb_impl()
+ {
+ }
+
+int
+fsk4_slicer_fb_impl::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ unsigned char *out = (unsigned char *) output_items[0];
+
+ for (int i = 0; i < noutput_items; i++){
+#if 0
+ if (in[i] < -2.0) {
+ out[i] = 3;
+ } else if (in[i] < 0.0) {
+ out[i] = 2;
+ } else if (in[i] < 2.0) {
+ out[i] = 0;
+ } else {
+ out[i] = 1;
+ }
+#endif
+ uint8_t dibit;
+ float sym = in[i];
+ if (d_slice_levels[3] < 0) {
+ dibit = 1;
+ if (d_slice_levels[3] <= sym && sym < d_slice_levels[0])
+ dibit = 3;
+ } else {
+ dibit = 3;
+ if (d_slice_levels[2] <= sym && sym < d_slice_levels[3])
+ dibit = 1;
+ }
+ if (d_slice_levels[0] <= sym && sym < d_slice_levels[1])
+ dibit = 2;
+ if (d_slice_levels[1] <= sym && sym < d_slice_levels[2])
+ dibit = 0;
+ out[i] = dibit;
+ }
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+}
+
+ } /* namespace op25_repeater */
+} /* namespace gr */
diff --git a/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.h b/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.h
new file mode 100644
index 0000000..e2bbd5a
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/fsk4_slicer_fb_impl.h
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_IMPL_H
+#define INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_IMPL_H
+
+#include <op25_repeater/fsk4_slicer_fb.h>
+
+namespace gr {
+ namespace op25_repeater {
+
+ class fsk4_slicer_fb_impl : public fsk4_slicer_fb
+ {
+ private:
+ float d_slice_levels[4];
+
+ public:
+ fsk4_slicer_fb_impl(const std::vector<float> &slice_levels);
+ ~fsk4_slicer_fb_impl();
+
+ // Where all the action really happens
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_FSK4_SLICER_FB_IMPL_H */
+
diff --git a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc
new file mode 100644
index 0000000..e73cd26
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.cc
@@ -0,0 +1,250 @@
+/* -*- c++ -*- */
+/*
+ * Gardner symbol recovery block for GR - Copyright 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This file is part of OP25
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "gardner_costas_cc_impl.h"
+
+#include <gnuradio/math.h>
+#include <gnuradio/expj.h>
+#include <gnuradio/filter/mmse_fir_interpolator_cc.h>
+#include <stdexcept>
+#include <cstdio>
+#include <string.h>
+
+#define ENABLE_COSTAS_CQPSK_HACK 0
+
+static const float M_TWOPI = 2 * M_PI;
+#define VERBOSE_GARDNER 0 // Used for debugging symbol timing loop
+#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
+static const gr_complex PT_45 = gr_expj( M_PI / 4.0 );
+
+namespace gr {
+ namespace op25_repeater {
+
+ gardner_costas_cc::sptr
+ gardner_costas_cc::make(float samples_per_symbol, float gain_mu, float gain_omega, float alpha, float beta, float max_freq, float min_freq)
+ {
+ return gnuradio::get_initial_sptr
+ (new gardner_costas_cc_impl(samples_per_symbol, gain_mu, gain_omega, alpha, beta, max_freq, min_freq));
+ }
+
+ /*
+ * The private constructor
+ */
+ gardner_costas_cc_impl::gardner_costas_cc_impl(float samples_per_symbol, float gain_mu, float gain_omega, float alpha, float beta, float max_freq, float min_freq)
+ : gr::block("gardner_costas_cc",
+ gr::io_signature::make(1, 1, sizeof(gr_complex)),
+ gr::io_signature::make(1, 1, sizeof(gr_complex))),
+ d_mu(0),
+ d_gain_omega(gain_omega),
+ d_gain_mu(gain_mu),
+ d_last_sample(0), d_interp(new gr::filter::mmse_fir_interpolator_cc()),
+ //d_verbose(gr::prefs::singleton()->get_bool("gardner_costas_cc", "verbose", false)),
+ d_verbose(false),
+ d_dl(0),
+ d_dl_index(0),
+ d_alpha(alpha), d_beta(beta),
+ d_interp_counter(0),
+ d_theta(M_PI / 4.0), d_phase(0), d_freq(0), d_max_freq(max_freq)
+ {
+ set_omega(samples_per_symbol);
+ set_relative_rate (1.0 / d_omega);
+ set_history(d_twice_sps); // ensure extra input is available
+ }
+
+ /*
+ * Our virtual destructor.
+ */
+ gardner_costas_cc_impl::~gardner_costas_cc_impl()
+ {
+ delete d_interp;
+ if (d_dl) {
+ delete d_dl;
+ d_dl = 0;
+ }
+ }
+
+void gardner_costas_cc_impl::set_omega (float omega) {
+ if (d_dl) {
+ delete d_dl;
+ d_dl = 0;
+ }
+ assert (omega >= 2.0);
+ d_omega = omega;
+ d_min_omega = omega*(1.0 - d_omega_rel);
+ d_max_omega = omega*(1.0 + d_omega_rel);
+ d_omega_mid = 0.5*(d_min_omega+d_max_omega);
+ d_twice_sps = 2 * (int) ceilf(d_omega);
+ int num_complex = std::max(d_twice_sps*2, 16);
+ d_dl = new gr_complex[num_complex];
+ memset(d_dl, 0, num_complex * sizeof(gr_complex));
+}
+
+
+void
+gardner_costas_cc_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+{
+ unsigned ninputs = ninput_items_required.size();
+ for (unsigned i=0; i < ninputs; i++)
+ ninput_items_required[i] =
+ (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
+}
+
+float // for QPSK
+gardner_costas_cc_impl::phase_error_detector_qpsk(gr_complex sample)
+{
+ float phase_error = 0;
+ if(fabsf(sample.real()) > fabsf(sample.imag())) {
+ if(sample.real() > 0)
+ phase_error = -sample.imag();
+ else
+ phase_error = sample.imag();
+ }
+ else {
+ if(sample.imag() > 0)
+ phase_error = sample.real();
+ else
+ phase_error = -sample.real();
+ }
+
+ return phase_error;
+}
+
+void
+gardner_costas_cc_impl::phase_error_tracking(gr_complex sample)
+{
+ float phase_error = 0;
+#if ENABLE_COSTAS_CQPSK_HACK
+ if (d_interp_counter & 1) // every other symbol
+ sample = sample * PT_45; // rotate by +45 deg
+ d_interp_counter++;
+#endif /* ENABLE_COSTAS_CQPSK_HACK */
+
+ // Make phase and frequency corrections based on sampled value
+ phase_error = -phase_error_detector_qpsk(sample);
+
+ d_freq += d_beta*phase_error*abs(sample); // adjust frequency based on error
+ d_phase += d_freq + d_alpha*phase_error*abs(sample); // adjust phase based on error
+
+ // Make sure we stay within +-2pi
+ while(d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
+
+ // Limit the frequency range
+ d_freq = gr::branchless_clip(d_freq, d_max_freq);
+
+#if VERBOSE_COSTAS
+ printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
+ phase_error, d_phase, d_freq, sample.real(), sample.imag(),
+ d_constellation[d_current_const_point].real(), d_constellation[d_current_const_point].imag());
+#endif
+}
+
+int
+gardner_costas_cc_impl::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ int i=0, o=0;
+ gr_complex symbol, sample, nco;
+
+ while((o < noutput_items) && (i < ninput_items[0])) {
+ while((d_mu > 1.0) && (i < ninput_items[0])) {
+ d_mu --;
+
+ d_phase += d_freq;
+ // Keep phase clamped and not walk to infinity
+ while(d_phase > M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase < -M_TWOPI)
+ d_phase += M_TWOPI;
+
+ nco = gr_expj(d_phase+d_theta); // get the NCO value for derotating the curr
+ symbol = in[i];
+ sample = nco*symbol; // get the downconverted symbol
+
+ d_dl[d_dl_index] = sample;
+ d_dl[d_dl_index + d_twice_sps] = sample;
+ d_dl_index ++;
+ d_dl_index = d_dl_index % d_twice_sps;
+
+ i++;
+ }
+
+ if(i < ninput_items[0]) {
+ float half_omega = d_omega / 2.0;
+ int half_sps = (int) floorf(half_omega);
+ float half_mu = d_mu + half_omega - (float) half_sps;
+ if (half_mu > 1.0) {
+ half_mu -= 1.0;
+ half_sps += 1;
+ }
+ // at this point half_sps represents the whole part, and
+ // half_mu the fractional part, of the halfway mark.
+ // locate two points, separated by half of one symbol time
+ // interp_samp is (we hope) at the optimum sampling point
+ gr_complex interp_samp_mid = d_interp->interpolate(&d_dl[ d_dl_index ], d_mu);
+ gr_complex interp_samp = d_interp->interpolate(&d_dl[ d_dl_index + half_sps], half_mu);
+
+ float error_real = (d_last_sample.real() - interp_samp.real()) * interp_samp_mid.real();
+ float error_imag = (d_last_sample.imag() - interp_samp.imag()) * interp_samp_mid.imag();
+ gr_complex diffdec = interp_samp * conj(d_last_sample);
+ d_last_sample = interp_samp; // save for next time
+ float symbol_error = error_real + error_imag; // Gardner loop error
+ if (isnan(symbol_error)) symbol_error = 0.0;
+ if (symbol_error < -1.0) symbol_error = -1.0;
+ if (symbol_error > 1.0) symbol_error = 1.0;
+
+ d_omega = d_omega + d_gain_omega * symbol_error * abs(interp_samp); // update omega based on loop error
+ d_omega = d_omega_mid + gr::branchless_clip(d_omega-d_omega_mid, d_omega_rel); // make sure we don't walk away
+#if VERBOSE_GARDNER
+ printf("%f\t%f\t%f\t%f\t%f\n", symbol_error, d_mu, d_omega, error_real, error_imag);
+#endif
+ d_mu += d_omega + d_gain_mu * symbol_error; // update mu based on loop error
+
+ phase_error_tracking(diffdec);
+
+ out[o++] = interp_samp;
+ }
+ }
+
+ #if 0
+ printf("ninput_items: %d noutput_items: %d consuming: %d returning: %d\n",
+ ninput_items[0], noutput_items, i, o);
+ #endif
+
+ consume_each(i);
+ return o;
+}
+
+ } /* namespace op25_repeater */
+} /* namespace gr */
diff --git a/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h
new file mode 100644
index 0000000..feec836
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/gardner_costas_cc_impl.h
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Gardner symbol recovery block for GR - Copyright 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This file is part of OP25
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_IMPL_H
+#define INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_IMPL_H
+
+#include <op25_repeater/gardner_costas_cc.h>
+
+#include <gnuradio/gr_complex.h>
+#include <gnuradio/math.h>
+
+#include <gnuradio/filter/mmse_fir_interpolator_cc.h>
+// class gr::filter::mmse_fir_interpolator_cc;
+
+namespace gr {
+ namespace op25_repeater {
+
+ class gardner_costas_cc_impl : public gardner_costas_cc
+ {
+ private:
+ // Nothing to declare in this block.
+
+ public:
+ gardner_costas_cc_impl(float samples_per_symbol, float gain_mu, float gain_omega, float alpha, float beta, float max_freq, float min_freq);
+
+/*!
+ * \brief Gardner based repeater gardner_costas_cc block with complex input, complex output.
+ * \ingroup sync_blk
+ *
+ * This implements a Gardner discrete-time error-tracking synchronizer.
+ *
+ * input samples should be within normalized range of -1.0 thru +1.0
+ *
+ * includes some simplifying approximations KA1RBI
+ */
+ ~gardner_costas_cc_impl();
+
+ // Where all the action really happens
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ void set_verbose (bool verbose) { d_verbose = verbose; }
+
+ //! Sets value of omega and its min and max values
+ void set_omega (float omega);
+
+protected:
+ bool input_sample0(gr_complex, gr_complex& outp);
+ bool input_sample(gr_complex, gr_complex& outp);
+
+ private:
+
+ float d_mu;
+ float d_omega, d_gain_omega, d_omega_rel, d_max_omega, d_min_omega, d_omega_mid;
+ float d_gain_mu;
+
+ gr_complex d_last_sample;
+ gr::filter::mmse_fir_interpolator_cc *d_interp;
+ bool d_verbose;
+
+ gr_complex *d_dl;
+ int d_dl_index;
+
+ int d_twice_sps;
+
+ float d_timing_error;
+
+ float d_alpha;
+ float d_beta;
+ uint32_t d_interp_counter;
+
+ float d_theta;
+ float d_phase;
+ float d_freq;
+ float d_max_freq;
+
+ float phase_error_detector_qpsk(gr_complex sample);
+ void phase_error_tracking(gr_complex sample);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_GARDNER_COSTAS_CC_IMPL_H */
diff --git a/op25/gr-op25_repeater/lib/imbe_decoder.cc b/op25/gr-op25_repeater/lib/imbe_decoder.cc
new file mode 100644
index 0000000..faa4669
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_decoder.cc
@@ -0,0 +1,16 @@
+#include "imbe_decoder.h"
+
+imbe_decoder::~imbe_decoder()
+{
+}
+
+imbe_decoder::imbe_decoder() :
+ d_audio()
+{
+}
+
+audio_samples*
+imbe_decoder::audio()
+{
+ return &d_audio;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_decoder.h b/op25/gr-op25_repeater/lib/imbe_decoder.h
new file mode 100644
index 0000000..e7645f0
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_decoder.h
@@ -0,0 +1,90 @@
+/* -*- C++ -*- */
+
+/*
+ * Copyright 2008 Steve Glass
+ *
+ * This file is part of OP25.
+ *
+ * OP25 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.
+ *
+ * OP25 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 OP25; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_IMBE_DECODER_H
+#define INCLUDED_IMBE_DECODER_H
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <deque>
+#include <vector>
+
+typedef std::deque<float> audio_samples;
+typedef std::vector<bool> voice_codeword;
+
+typedef boost::shared_ptr<class imbe_decoder> imbe_decoder_sptr;
+
+/**
+ * imbe_decoder is the interface to the various mechanisms for
+ * translating P25 voice codewords into audio samples.
+ */
+class imbe_decoder : public boost::noncopyable {
+public:
+
+ /**
+ * imbe_decoder (virtual) constructor. The exact subclass
+ * instantiated depends on some yet-to-be-decided magic.
+ *
+ * \return A shared_ptr to an imbe_decoder.
+ */
+ static imbe_decoder_sptr make();
+
+ /**
+ * imbe_decoder (virtual) destructor.
+ */
+ virtual ~imbe_decoder();
+
+ /**
+ * Decode the compressed IMBE audio.
+ *
+ * \param cw IMBE codeword (including parity check bits).
+ */
+ virtual void decode(const voice_codeword& cw) = 0;
+
+ /**
+ * Returns the audio_samples samples. These are mono samples at
+ * 8KS/s represented as a float in the range -1.0 .. +1.0.
+ *
+ * \return A non-null pointer to a deque<float> of audio samples.
+ */
+ audio_samples *audio();
+
+protected:
+
+ /**
+ * Construct an instance of imbe_decoder. Access is protected
+ * because this is an abstract class and users should call
+ * make_imbe_decoder to construct concrete instances.
+ */
+ imbe_decoder();
+
+private:
+
+ /**
+ * The audio samples produced by the IMBE decoder.
+ */
+ audio_samples d_audio;
+
+};
+
+#endif /* INCLUDED_IMBE_DECODER_H */
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/CMakeLists.txt b/op25/gr-op25_repeater/lib/imbe_vocoder/CMakeLists.txt
new file mode 100644
index 0000000..2d14a9a
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 2.6)
+
+SET( MORE_FLAGS "-fPIC")
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MORE_FLAGS}" )
+
+list(APPEND imbe_vocoder_sources
+ aux_sub.cc
+ basicop2.cc
+ ch_decode.cc
+ ch_encode.cc
+ dc_rmv.cc
+ decode.cc
+ dsp_sub.cc
+ encode.cc
+ imbe_vocoder.cc
+ math_sub.cc
+ pe_lpf.cc
+ pitch_est.cc
+ pitch_ref.cc
+ qnt_sub.cc
+ rand_gen.cc
+ sa_decode.cc
+ sa_encode.cc
+ sa_enh.cc
+ tbls.cc
+ uv_synt.cc
+ v_synt.cc
+ v_uv_det.cc
+)
+
+add_library(imbe_vocoder ${imbe_vocoder_sources})
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.cc
new file mode 100644
index 0000000..1bfa300
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.cc
@@ -0,0 +1,182 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+#include "typedef.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "aux_sub.h"
+#include "tbls.h"
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Return pointer to bit allocation array
+// according to the number of harmonics
+//
+// INPUT:
+// num_harms - The number of harmonics
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Pointer to bits allocation array
+//
+//-----------------------------------------------------------------------------
+const Word16 *get_bit_allocation_arr(Word16 num_harms)
+{
+ Word16 offset_in_word, index;
+
+ if(num_harms == NUM_HARMS_MIN)
+ return &bit_allocation_tbl[0];
+ else
+ {
+ index = num_harms - NUM_HARMS_MIN - 1;
+ offset_in_word = bit_allocation_offset_tbl[index >> 2] + ((3 + (index >> 2)) * (index & 0x3));
+ return &bit_allocation_tbl[offset_in_word];
+ }
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Unpack bit allocation table's item
+//
+// INPUT:
+// num_harms - The number of harmonics
+// ptr - Pointer to buffer to place bit allocation data
+//
+// OUTPUT:
+// Unpacked bit allocation table
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void get_bit_allocation(Word16 num_harms, Word16 *ptr)
+{
+ const Word16 *bat_ptr;
+ Word16 i, tmp;
+
+ bat_ptr = get_bit_allocation_arr(num_harms);
+
+ for(i = 0; i < num_harms - 1; i += 4)
+ {
+ tmp = *bat_ptr++;
+ ptr[3] = tmp & 0xF; tmp >>= 4;
+ ptr[2] = tmp & 0xF; tmp >>= 4;
+ ptr[1] = tmp & 0xF; tmp >>= 4;
+ ptr[0] = tmp & 0xF;
+ ptr += 4;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Set the elements of a 16 bit input vector to zero.
+//
+// INPUT:
+// vec - Pointer to vector
+// n - size of vec
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_zap(Word16 *vec, Word16 n)
+{
+ while(n--)
+ *vec++ = 0;
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Copy the contents of one 16 bit input vector to another
+//
+// INPUT:
+// vec1 - Pointer to the destination vector
+// vec2 - Pointer to the source vector
+// n - size of data should be copied
+//
+// OUTPUT:
+// Copy of the source vector
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_equ(Word16 *vec1, Word16 *vec2, Word16 n)
+{
+ while(n--)
+ *vec1++ = *vec2++;
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Compute the sum of square magnitude of a 16 bit input vector
+// with saturation and truncation. Output is a 32 bit number.
+//
+// INPUT:
+// vec - Pointer to the vector
+// n - size of input vectors
+//
+// OUTPUT:
+// none
+//
+// RETURN:
+// 32 bit long signed integer result
+//
+//-----------------------------------------------------------------------------
+Word32 L_v_magsq(Word16 *vec, Word16 n)
+{
+ Word32 L_magsq = 0;
+
+ while(n--)
+ {
+ L_magsq = L_mac(L_magsq, *vec, *vec);
+ vec++;
+ }
+ return L_magsq;
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Copy the contents of one 16 bit input vector to another with shift
+//
+// INPUT:
+// vec1 - Pointer to the destination vector
+// vec2 - Pointer to the source vector
+// scale - right shift factor
+// n - size of data should be copied
+//
+// OUTPUT:
+// Copy of the source vector
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_equ_shr(Word16 *vec1, Word16 *vec2, Word16 scale, Word16 n)
+{
+ while(n--)
+ *vec1++ = shr(*vec2++,scale);
+}
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.h b/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.h
new file mode 100644
index 0000000..dca74ee
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/aux_sub.h
@@ -0,0 +1,133 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _AUX_SUB
+#define _AUX_SUB
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Return pointer to bit allocation array
+// according to the number of harmonics
+//
+// INPUT:
+// num_harms - The number of harmonics
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Pointer to bits allocation array
+//
+//-----------------------------------------------------------------------------
+const Word16 *get_bit_allocation_arr(Word16 num_harms);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Unpack bit allocation table's item
+//
+// INPUT:
+// num_harms - The number of harmonics
+// ptr - Pointer to buffer to place bit allocation data
+//
+// OUTPUT:
+// Unpacked bit allocation table
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void get_bit_allocation(Word16 num_harms, Word16 *ptr);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Set the elements of a 16 bit input vector to zero.
+//
+// INPUT:
+// vec - Pointer to vector
+// n - size of vec
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_zap(Word16 *vec, Word16 n);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Copy the contents of one 16 bit input vector to another
+//
+// INPUT:
+// vec1 - Pointer to the destination vector
+// vec2 - Pointer to the source vector
+// n - size of data should be copied
+//
+// OUTPUT:
+// Copy of the source vector
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_equ(Word16 *vec1, Word16 *vec2, Word16 n);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Compute the sum of square magnitude of a 16 bit input vector
+// with saturation and truncation. Output is a 32 bit number.
+//
+// INPUT:
+// vec - Pointer to the vector
+// n - size of input vectors
+//
+// OUTPUT:
+// none
+//
+// RETURN:
+// 32 bit long signed integer result
+//
+//-----------------------------------------------------------------------------
+Word32 L_v_magsq(Word16 *vec, Word16 n);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Copy the contents of one 16 bit input vector to another with shift
+//
+// INPUT:
+// vec1 - Pointer to the destination vector
+// vec2 - Pointer to the source vector
+// scale - right shift factor
+// n - size of data should be copied
+//
+// OUTPUT:
+// Copy of the source vector
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void v_equ_shr(Word16 *vec1, Word16 *vec2, Word16 scale, Word16 n);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/basic_op.h b/op25/gr-op25_repeater/lib/imbe_vocoder/basic_op.h
new file mode 100644
index 0000000..9132ba1
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/basic_op.h
@@ -0,0 +1,85 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+/*___________________________________________________________________________
+ | |
+ | Constants and Globals |
+ | |
+ | $Id $
+ |___________________________________________________________________________|
+*/
+extern Flag Overflow;
+extern Flag Carry;
+
+#define MAX_32 (Word32)0x7fffffffL
+#define MIN_32 (Word32)0x80000000L
+
+#define MAX_16 (Word16)0x7fff
+#define MIN_16 (Word16)0x8000
+
+/*___________________________________________________________________________
+ | |
+ | Prototypes for basic arithmetic operators |
+ |___________________________________________________________________________|
+*/
+
+Word16 add (Word16 var1, Word16 var2); /* Short add, 1 */
+Word16 sub (Word16 var1, Word16 var2); /* Short sub, 1 */
+Word16 abs_s (Word16 var1); /* Short abs, 1 */
+Word16 shl (Word16 var1, Word16 var2); /* Short shift left, 1 */
+Word16 shr (Word16 var1, Word16 var2); /* Short shift right, 1 */
+Word16 mult (Word16 var1, Word16 var2); /* Short mult, 1 */
+Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */
+Word16 negate (Word16 var1); /* Short negate, 1 */
+Word16 extract_h (Word32 L_var1); /* Extract high, 1 */
+Word16 extract_l (Word32 L_var1); /* Extract low, 1 */
+Word16 round (Word32 L_var1); /* Round, 1 */
+Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */
+Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */
+Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without
+ sat, 1 */
+Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2); /* Msu without
+ sat, 1 */
+Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */
+Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */
+Word32 L_add_c (Word32 L_var1, Word32 L_var2); /* Long add with c, 2 */
+Word32 L_sub_c (Word32 L_var1, Word32 L_var2); /* Long sub with c, 2 */
+Word32 L_negate (Word32 L_var1); /* Long negate, 2 */
+Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */
+Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */
+Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/
+Word16 shr_r (Word16 var1, Word16 var2); /* Shift right with
+ round, 2 */
+Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2); /* Mac with
+ rounding,2 */
+Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2); /* Msu with
+ rounding,2 */
+Word32 L_deposit_h (Word16 var1); /* 16 bit var1 -> MSB, 2 */
+Word32 L_deposit_l (Word16 var1); /* 16 bit var1 -> LSB, 2 */
+
+Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with
+ round, 3 */
+Word32 L_abs (Word32 L_var1); /* Long abs, 3 */
+Word32 L_sat (Word32 L_var1); /* Long saturation, 4 */
+Word16 norm_s (Word16 var1); /* Short norm, 15 */
+Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */
+Word16 norm_l (Word32 L_var1); /* Long norm, 30 */
+
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/basicop2.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/basicop2.cc
new file mode 100644
index 0000000..66f44a3
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/basicop2.cc
@@ -0,0 +1,2157 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+/*___________________________________________________________________________
+ | |
+ | Basic arithmetic operators. |
+ | |
+ | $Id $
+ |___________________________________________________________________________|
+*/
+
+/*___________________________________________________________________________
+ | |
+ | Include-Files |
+ |___________________________________________________________________________|
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "typedef.h"
+#include "basic_op.h"
+
+#if (WMOPS)
+#include "count.h"
+extern BASIC_OP multiCounter[MAXCOUNTERS];
+extern int currCounter;
+
+#endif
+
+/*___________________________________________________________________________
+ | |
+ | Local Functions |
+ |___________________________________________________________________________|
+*/
+Word16 saturate (Word32 L_var1);
+
+/*___________________________________________________________________________
+ | |
+ | Constants and Globals |
+ |___________________________________________________________________________|
+*/
+Flag Overflow = 0;
+Flag Carry = 0;
+
+/*___________________________________________________________________________
+ | |
+ | Functions |
+ |___________________________________________________________________________|
+*/
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : saturate |
+ | |
+ | Purpose : |
+ | |
+ | Limit the 32 bit input to the range of a 16 bit word. |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16
+saturate (Word32 L_var1)
+{
+ Word16 var_out;
+
+ if (L_var1 > 0X00007fffL)
+ {
+ Overflow = 1;
+ var_out = MAX_16;
+ }
+ else if (L_var1 < (Word32) 0xffff8000L)
+ {
+ Overflow = 1;
+ var_out = MIN_16;
+ }
+ else
+ {
+ var_out = extract_l (L_var1);
+#if (WMOPS)
+ multiCounter[currCounter].extract_l--;
+#endif
+ }
+
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : add |
+ | |
+ | Purpose : |
+ | |
+ | Performs the addition (var1+var2) with overflow control and saturation;|
+ | the 16 bit result is set at +32767 when overflow occurs or at -32768 |
+ | when underflow occurs. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 add (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+ Word32 L_sum;
+
+ L_sum = (Word32) var1 + var2;
+ var_out = saturate (L_sum);
+#if (WMOPS)
+ multiCounter[currCounter].add++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : sub |
+ | |
+ | Purpose : |
+ | |
+ | Performs the subtraction (var1+var2) with overflow control and satu- |
+ | ration; the 16 bit result is set at +32767 when overflow occurs or at |
+ | -32768 when underflow occurs. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 sub (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+ Word32 L_diff;
+
+ L_diff = (Word32) var1 - var2;
+ var_out = saturate (L_diff);
+#if (WMOPS)
+ multiCounter[currCounter].sub++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : abs_s |
+ | |
+ | Purpose : |
+ | |
+ | Absolute value of var1; abs_s(-32768) = 32767. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 0000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 abs_s (Word16 var1)
+{
+ Word16 var_out;
+
+ if (var1 == (Word16) 0X8000)
+ {
+ var_out = MAX_16;
+ }
+ else
+ {
+ if (var1 < 0)
+ {
+ var_out = -var1;
+ }
+ else
+ {
+ var_out = var1;
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].abs_s++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : shl |
+ | |
+ | Purpose : |
+ | |
+ | Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill|
+ | the var2 LSB of the result. If var2 is negative, arithmetically shift |
+ | var1 right by -var2 with sign extension. Saturate the result in case of |
+ | underflows or overflows. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 shl (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+ Word32 result;
+
+ if (var2 < 0)
+ {
+ if (var2 < -16)
+ var2 = -16;
+ var_out = shr (var1, -var2);
+#if (WMOPS)
+ multiCounter[currCounter].shr--;
+#endif
+ }
+ else
+ {
+ result = (Word32) var1 *((Word32) 1 << var2);
+
+ if ((var2 > 15 && var1 != 0) || (result != (Word32) ((Word16) result)))
+ {
+ Overflow = 1;
+ var_out = (var1 > 0) ? MAX_16 : MIN_16;
+ }
+ else
+ {
+ var_out = extract_l (result);
+#if (WMOPS)
+ multiCounter[currCounter].extract_l--;
+#endif
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].shl++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : shr |
+ | |
+ | Purpose : |
+ | |
+ | Arithmetically shift the 16 bit input var1 right var2 positions with |
+ | sign extension. If var2 is negative, arithmetically shift var1 left by |
+ | -var2 with sign extension. Saturate the result in case of underflows or |
+ | overflows. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 shr (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+
+ if (var2 < 0)
+ {
+ if (var2 < -16)
+ var2 = -16;
+ var_out = shl (var1, -var2);
+#if (WMOPS)
+ multiCounter[currCounter].shl--;
+#endif
+ }
+ else
+ {
+ if (var2 >= 15)
+ {
+ var_out = (var1 < 0) ? -1 : 0;
+ }
+ else
+ {
+ if (var1 < 0)
+ {
+ var_out = ~((~var1) >> var2);
+ }
+ else
+ {
+ var_out = var1 >> var2;
+ }
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].shr++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : mult |
+ | |
+ | Purpose : |
+ | |
+ | Performs the multiplication of var1 by var2 and gives a 16 bit result |
+ | which is scaled i.e.: |
+ | mult(var1,var2) = extract_l(L_shr((var1 times var2),15)) and |
+ | mult(-32768,-32768) = 32767. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 mult (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+ Word32 L_product;
+
+ L_product = (Word32) var1 *(Word32) var2;
+
+ L_product = (L_product & (Word32) 0xffff8000L) >> 15;
+
+ if (L_product & (Word32) 0x00010000L)
+ L_product = L_product | (Word32) 0xffff0000L;
+
+ var_out = saturate (L_product);
+#if (WMOPS)
+ multiCounter[currCounter].mult++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_mult |
+ | |
+ | Purpose : |
+ | |
+ | L_mult is the 32 bit result of the multiplication of var1 times var2 |
+ | with one shift left i.e.: |
+ | L_mult(var1,var2) = L_shl((var1 times var2),1) and |
+ | L_mult(-32768,-32768) = 2147483647. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_mult (Word16 var1, Word16 var2)
+{
+ Word32 L_var_out;
+
+ L_var_out = (Word32) var1 *(Word32) var2;
+
+ if (L_var_out != (Word32) 0x40000000L)
+ {
+ L_var_out *= 2;
+ }
+ else
+ {
+ Overflow = 1;
+ L_var_out = MAX_32;
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].L_mult++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : negate |
+ | |
+ | Purpose : |
+ | |
+ | Negate var1 with saturation, saturate in the case where input is -32768:|
+ | negate(var1) = sub(0,var1). |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 negate (Word16 var1)
+{
+ Word16 var_out;
+
+ var_out = (var1 == MIN_16) ? MAX_16 : -var1;
+#if (WMOPS)
+ multiCounter[currCounter].negate++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : extract_h |
+ | |
+ | Purpose : |
+ | |
+ | Return the 16 MSB of L_var1. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32 ) whose value falls in the |
+ | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 extract_h (Word32 L_var1)
+{
+ Word16 var_out;
+
+ var_out = (Word16) (L_var1 >> 16);
+#if (WMOPS)
+ multiCounter[currCounter].extract_h++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : extract_l |
+ | |
+ | Purpose : |
+ | |
+ | Return the 16 LSB of L_var1. |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32 ) whose value falls in the |
+ | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 extract_l (Word32 L_var1)
+{
+ Word16 var_out;
+
+ var_out = (Word16) L_var1;
+#if (WMOPS)
+ multiCounter[currCounter].extract_l++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : round |
+ | |
+ | Purpose : |
+ | |
+ | Round the lower 16 bits of the 32 bit input number into the MS 16 bits |
+ | with saturation. Shift the resulting bits right by 16 and return the 16 |
+ | bit number: |
+ | round(L_var1) = extract_h(L_add(L_var1,32768)) |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32 ) whose value falls in the |
+ | range : 0x8000 0000 <= L_var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 round (Word32 L_var1)
+{
+ Word16 var_out;
+ Word32 L_rounded;
+
+ L_rounded = L_add (L_var1, (Word32) 0x00008000L);
+#if (WMOPS)
+ multiCounter[currCounter].L_add--;
+#endif
+ var_out = extract_h (L_rounded);
+#if (WMOPS)
+ multiCounter[currCounter].extract_h--;
+ multiCounter[currCounter].round++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_mac |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit |
+ | result to L_var3 with saturation, return a 32 bit result: |
+ | L_mac(L_var3,var1,var2) = L_add(L_var3,L_mult(var1,var2)). |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word32 L_var_out;
+ Word32 L_product;
+
+ L_product = L_mult (var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_mult--;
+#endif
+ L_var_out = L_add (L_var3, L_product);
+#if (WMOPS)
+ multiCounter[currCounter].L_add--;
+ multiCounter[currCounter].L_mac++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_msu |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 |
+ | bit result to L_var3 with saturation, return a 32 bit result: |
+ | L_msu(L_var3,var1,var2) = L_sub(L_var3,L_mult(var1,var2)). |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word32 L_var_out;
+ Word32 L_product;
+
+ L_product = L_mult (var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_mult--;
+#endif
+ L_var_out = L_sub (L_var3, L_product);
+#if (WMOPS)
+ multiCounter[currCounter].L_sub--;
+ multiCounter[currCounter].L_msu++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_macNs |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit |
+ | result to L_var3 without saturation, return a 32 bit result. Generate |
+ | carry and overflow values : |
+ | L_macNs(L_var3,var1,var2) = L_add_c(L_var3,L_mult(var1,var2)). |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ | |
+ | Caution : |
+ | |
+ | In some cases the Carry flag has to be cleared or set before using |
+ | operators which take into account its value. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word32 L_var_out;
+
+ L_var_out = L_mult (var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_mult--;
+#endif
+ L_var_out = L_add_c (L_var3, L_var_out);
+#if (WMOPS)
+ multiCounter[currCounter].L_add_c--;
+ multiCounter[currCounter].L_macNs++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_msuNs |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 |
+ | bit result from L_var3 without saturation, return a 32 bit result. Ge- |
+ | nerate carry and overflow values : |
+ | L_msuNs(L_var3,var1,var2) = L_sub_c(L_var3,L_mult(var1,var2)). |
+ | |
+ | Complexity weight : 1 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ | |
+ | Caution : |
+ | |
+ | In some cases the Carry flag has to be cleared or set before using |
+ | operators which take into account its value. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word32 L_var_out;
+
+ L_var_out = L_mult (var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_mult--;
+#endif
+ L_var_out = L_sub_c (L_var3, L_var_out);
+#if (WMOPS)
+ multiCounter[currCounter].L_sub_c--;
+ multiCounter[currCounter].L_msuNs++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_add |
+ | |
+ | Purpose : |
+ | |
+ | 32 bits addition of the two 32 bits variables (L_var1+L_var2) with |
+ | overflow control and saturation; the result is set at +2147483647 when |
+ | overflow occurs or at -2147483648 when underflow occurs. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | L_var2 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_add (Word32 L_var1, Word32 L_var2)
+{
+ Word32 L_var_out;
+
+ L_var_out = L_var1 + L_var2;
+
+ if (((L_var1 ^ L_var2) & MIN_32) == 0)
+ {
+ if ((L_var_out ^ L_var1) & MIN_32)
+ {
+ L_var_out = (L_var1 < 0) ? MIN_32 : MAX_32;
+ Overflow = 1;
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_add++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_sub |
+ | |
+ | Purpose : |
+ | |
+ | 32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with |
+ | overflow control and saturation; the result is set at +2147483647 when |
+ | overflow occurs or at -2147483648 when underflow occurs. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | L_var2 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_sub (Word32 L_var1, Word32 L_var2)
+{
+ Word32 L_var_out;
+
+ L_var_out = L_var1 - L_var2;
+
+ if (((L_var1 ^ L_var2) & MIN_32) != 0)
+ {
+ if ((L_var_out ^ L_var1) & MIN_32)
+ {
+ L_var_out = (L_var1 < 0L) ? MIN_32 : MAX_32;
+ Overflow = 1;
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_sub++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_add_c |
+ | |
+ | Purpose : |
+ | |
+ | Performs 32 bits addition of the two 32 bits variables (L_var1+L_var2+C)|
+ | with carry. No saturation. Generate carry and Overflow values. The car- |
+ | ry and overflow values are binary variables which can be tested and as- |
+ | signed values. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | L_var2 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ | |
+ | Caution : |
+ | |
+ | In some cases the Carry flag has to be cleared or set before using |
+ | operators which take into account its value. |
+ |___________________________________________________________________________|
+*/
+Word32 L_add_c (Word32 L_var1, Word32 L_var2)
+{
+ Word32 L_var_out;
+ Word32 L_test;
+ Flag carry_int = 0;
+
+ L_var_out = L_var1 + L_var2 + Carry;
+
+ L_test = L_var1 + L_var2;
+
+ if ((L_var1 > 0) && (L_var2 > 0) && (L_test < 0))
+ {
+ Overflow = 1;
+ carry_int = 0;
+ }
+ else
+ {
+ if ((L_var1 < 0) && (L_var2 < 0))
+ {
+ if (L_test >= 0)
+ {
+ Overflow = 1;
+ carry_int = 1;
+ }
+ else
+ {
+ Overflow = 0;
+ carry_int = 1;
+ }
+ }
+ else
+ {
+ if (((L_var1 ^ L_var2) < 0) && (L_test >= 0))
+ {
+ Overflow = 0;
+ carry_int = 1;
+ }
+ else
+ {
+ Overflow = 0;
+ carry_int = 0;
+ }
+ }
+ }
+
+ if (Carry)
+ {
+ if (L_test == MAX_32)
+ {
+ Overflow = 1;
+ Carry = carry_int;
+ }
+ else
+ {
+ if (L_test == (Word32) 0xFFFFFFFFL)
+ {
+ Carry = 1;
+ }
+ else
+ {
+ Carry = carry_int;
+ }
+ }
+ }
+ else
+ {
+ Carry = carry_int;
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].L_add_c++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_sub_c |
+ | |
+ | Purpose : |
+ | |
+ | Performs 32 bits subtraction of the two 32 bits variables with carry |
+ | (borrow) : L_var1-L_var2-C. No saturation. Generate carry and Overflow |
+ | values. The carry and overflow values are binary variables which can |
+ | be tested and assigned values. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | L_var2 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ | |
+ | Caution : |
+ | |
+ | In some cases the Carry flag has to be cleared or set before using |
+ | operators which take into account its value. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_sub_c (Word32 L_var1, Word32 L_var2)
+{
+ Word32 L_var_out;
+ Word32 L_test;
+ Flag carry_int = 0;
+
+ if (Carry)
+ {
+ Carry = 0;
+ if (L_var2 != MIN_32)
+ {
+ L_var_out = L_add_c (L_var1, -L_var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_add_c--;
+#endif
+ }
+ else
+ {
+ L_var_out = L_var1 - L_var2;
+ if (L_var1 > 0L)
+ {
+ Overflow = 1;
+ Carry = 0;
+ }
+ }
+ }
+ else
+ {
+ L_var_out = L_var1 - L_var2 - (Word32) 0X00000001L;
+ L_test = L_var1 - L_var2;
+
+ if ((L_test < 0) && (L_var1 > 0) && (L_var2 < 0))
+ {
+ Overflow = 1;
+ carry_int = 0;
+ }
+ else if ((L_test > 0) && (L_var1 < 0) && (L_var2 > 0))
+ {
+ Overflow = 1;
+ carry_int = 1;
+ }
+ else if ((L_test > 0) && ((L_var1 ^ L_var2) > 0))
+ {
+ Overflow = 0;
+ carry_int = 1;
+ }
+ if (L_test == MIN_32)
+ {
+ Overflow = 1;
+ Carry = carry_int;
+ }
+ else
+ {
+ Carry = carry_int;
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].L_sub_c++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_negate |
+ | |
+ | Purpose : |
+ | |
+ | Negate the 32 bit variable L_var1 with saturation; saturate in the case |
+ | where input is -2147483648 (0x8000 0000). |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_negate (Word32 L_var1)
+{
+ Word32 L_var_out;
+
+ L_var_out = (L_var1 == MIN_32) ? MAX_32 : -L_var1;
+#if (WMOPS)
+ multiCounter[currCounter].L_negate++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : mult_r |
+ | |
+ | Purpose : |
+ | |
+ | Same as mult with rounding, i.e.: |
+ | mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and |
+ | mult_r(-32768,-32768) = 32767. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 mult_r (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+ Word32 L_product_arr;
+
+ L_product_arr = (Word32) var1 *(Word32) var2; /* product */
+ L_product_arr += (Word32) 0x00004000L; /* round */
+ L_product_arr &= (Word32) 0xffff8000L;
+ L_product_arr >>= 15; /* shift */
+
+ if (L_product_arr & (Word32) 0x00010000L) /* sign extend when necessary */
+ {
+ L_product_arr |= (Word32) 0xffff0000L;
+ }
+ var_out = saturate (L_product_arr);
+#if (WMOPS)
+ multiCounter[currCounter].mult_r++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_shl |
+ | |
+ | Purpose : |
+ | |
+ | Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero |
+ | fill the var2 LSB of the result. If var2 is negative, arithmetically |
+ | shift L_var1 right by -var2 with sign extension. Saturate the result in |
+ | case of underflows or overflows. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_shl (Word32 L_var1, Word16 var2)
+{
+ Word32 L_var_out=0;
+
+ if (var2 <= 0)
+ {
+ if (var2 < -32)
+ var2 = -32;
+ L_var_out = L_shr (L_var1, -var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_shr--;
+#endif
+ }
+ else
+ {
+ for (; var2 > 0; var2--)
+ {
+ if (L_var1 > (Word32) 0X3fffffffL)
+ {
+ Overflow = 1;
+ L_var_out = MAX_32;
+ break;
+ }
+ else
+ {
+ if (L_var1 < (Word32) 0xc0000000L)
+ {
+ Overflow = 1;
+ L_var_out = MIN_32;
+ break;
+ }
+ }
+ L_var1 *= 2;
+ L_var_out = L_var1;
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_shl++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_shr |
+ | |
+ | Purpose : |
+ | |
+ | Arithmetically shift the 32 bit input L_var1 right var2 positions with |
+ | sign extension. If var2 is negative, arithmetically shift L_var1 left |
+ | by -var2 and zero fill the -var2 LSB of the result. Saturate the result |
+ | in case of underflows or overflows. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_shr (Word32 L_var1, Word16 var2)
+{
+ Word32 L_var_out;
+
+ if (var2 < 0)
+ {
+ if (var2 < -32)
+ var2 = -32;
+ L_var_out = L_shl (L_var1, -var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_shl--;
+#endif
+ }
+ else
+ {
+ if (var2 >= 31)
+ {
+ L_var_out = (L_var1 < 0L) ? -1 : 0;
+ }
+ else
+ {
+ if (L_var1 < 0)
+ {
+ L_var_out = ~((~L_var1) >> var2);
+ }
+ else
+ {
+ L_var_out = L_var1 >> var2;
+ }
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_shr++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : shr_r |
+ | |
+ | Purpose : |
+ | |
+ | Same as shr(var1,var2) but with rounding. Saturate the result in case of|
+ | underflows or overflows : |
+ | - If var2 is greater than zero : |
+ | if (sub(shl(shr(var1,var2),1),shr(var1,sub(var2,1)))) |
+ | is equal to zero |
+ | then |
+ | shr_r(var1,var2) = shr(var1,var2) |
+ | else |
+ | shr_r(var1,var2) = add(shr(var1,var2),1) |
+ | - If var2 is less than or equal to zero : |
+ | shr_r(var1,var2) = shr(var1,var2). |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 shr_r (Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+
+ if (var2 > 15)
+ {
+ var_out = 0;
+ }
+ else
+ {
+ var_out = shr (var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].shr--;
+#endif
+
+ if (var2 > 0)
+ {
+ if ((var1 & ((Word16) 1 << (var2 - 1))) != 0)
+ {
+ var_out++;
+ }
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].shr_r++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : mac_r |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Add the 32 bit |
+ | result to L_var3 with saturation. Round the LS 16 bits of the result |
+ | into the MS 16 bits with saturation and shift the result right by 16. |
+ | Return a 16 bit result. |
+ | mac_r(L_var3,var1,var2) = round(L_mac(L_var3,var1,var2)) |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+
+ L_var3 = L_mac (L_var3, var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_mac--;
+#endif
+ L_var3 = L_add (L_var3, (Word32) 0x00008000L);
+#if (WMOPS)
+ multiCounter[currCounter].L_add--;
+#endif
+ var_out = extract_h (L_var3);
+#if (WMOPS)
+ multiCounter[currCounter].extract_h--;
+ multiCounter[currCounter].mac_r++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : msu_r |
+ | |
+ | Purpose : |
+ | |
+ | Multiply var1 by var2 and shift the result left by 1. Subtract the 32 |
+ | bit result to L_var3 with saturation. Round the LS 16 bits of the res- |
+ | ult into the MS 16 bits with saturation and shift the result right by |
+ | 16. Return a 16 bit result. |
+ | msu_r(L_var3,var1,var2) = round(L_msu(L_var3,var1,var2)) |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | L_var3 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= L_var3 <= 0x7fff ffff. |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 8000 <= L_var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2)
+{
+ Word16 var_out;
+
+ L_var3 = L_msu (L_var3, var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_msu--;
+#endif
+ L_var3 = L_add (L_var3, (Word32) 0x00008000L);
+#if (WMOPS)
+ multiCounter[currCounter].L_add--;
+#endif
+ var_out = extract_h (L_var3);
+#if (WMOPS)
+ multiCounter[currCounter].extract_h--;
+ multiCounter[currCounter].msu_r++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_deposit_h |
+ | |
+ | Purpose : |
+ | |
+ | Deposit the 16 bit var1 into the 16 MS bits of the 32 bit output. The |
+ | 16 LS bits of the output are zeroed. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var_out <= 0x7fff 0000. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_deposit_h (Word16 var1)
+{
+ Word32 L_var_out;
+
+ L_var_out = (Word32) var1 << 16;
+#if (WMOPS)
+ multiCounter[currCounter].L_deposit_h++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_deposit_l |
+ | |
+ | Purpose : |
+ | |
+ | Deposit the 16 bit var1 into the 16 LS bits of the 32 bit output. The |
+ | 16 MS bits of the output are sign extended. |
+ | |
+ | Complexity weight : 2 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0xFFFF 8000 <= var_out <= 0x0000 7fff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_deposit_l (Word16 var1)
+{
+ Word32 L_var_out;
+
+ L_var_out = (Word32) var1;
+#if (WMOPS)
+ multiCounter[currCounter].L_deposit_l++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_shr_r |
+ | |
+ | Purpose : |
+ | |
+ | Same as L_shr(L_var1,var2) but with rounding. Saturate the result in |
+ | case of underflows or overflows : |
+ | - If var2 is greater than zero : |
+ | if (L_sub(L_shl(L_shr(L_var1,var2),1),L_shr(L_var1,sub(var2,1))))|
+ | is equal to zero |
+ | then |
+ | L_shr_r(L_var1,var2) = L_shr(L_var1,var2) |
+ | else |
+ | L_shr_r(L_var1,var2) = L_add(L_shr(L_var1,var2),1) |
+ | - If var2 is less than or equal to zero : |
+ | L_shr_r(L_var1,var2) = L_shr(L_var1,var2). |
+ | |
+ | Complexity weight : 3 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var1 <= 0x7fff ffff. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_shr_r (Word32 L_var1, Word16 var2)
+{
+ Word32 L_var_out;
+
+ if (var2 > 31)
+ {
+ L_var_out = 0;
+ }
+ else
+ {
+ L_var_out = L_shr (L_var1, var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_shr--;
+#endif
+ if (var2 > 0)
+ {
+ if ((L_var1 & ((Word32) 1 << (var2 - 1))) != 0)
+ {
+ L_var_out++;
+ }
+ }
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_shr_r++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_abs |
+ | |
+ | Purpose : |
+ | |
+ | Absolute value of L_var1; Saturate in case where the input is |
+ | -214783648 |
+ | |
+ | Complexity weight : 3 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x0000 0000 <= var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_abs (Word32 L_var1)
+{
+ Word32 L_var_out;
+
+ if (L_var1 == MIN_32)
+ {
+ L_var_out = MAX_32;
+ }
+ else
+ {
+ if (L_var1 < 0)
+ {
+ L_var_out = -L_var1;
+ }
+ else
+ {
+ L_var_out = L_var1;
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].L_abs++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : L_sat |
+ | |
+ | Purpose : |
+ | |
+ | 32 bit L_var1 is set to 2147483647 if an overflow occured or to |
+ | -2147483648 if an underflow occured on the most recent L_add_c, |
+ | L_sub_c, L_macNs or L_msuNs operations. The carry and overflow values |
+ | are binary values which can be tested and assigned values. |
+ | |
+ | Complexity weight : 4 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | L_var_out |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var_out <= 0x7fff ffff. |
+ |___________________________________________________________________________|
+*/
+
+Word32 L_sat (Word32 L_var1)
+{
+ Word32 L_var_out;
+
+ L_var_out = L_var1;
+
+ if (Overflow)
+ {
+
+ if (Carry)
+ {
+ L_var_out = MIN_32;
+ }
+ else
+ {
+ L_var_out = MAX_32;
+ }
+
+ Carry = 0;
+ Overflow = 0;
+ }
+#if (WMOPS)
+ multiCounter[currCounter].L_sat++;
+#endif
+ return (L_var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : norm_s |
+ | |
+ | Purpose : |
+ | |
+ | Produces the number of left shift needed to normalize the 16 bit varia- |
+ | ble var1 for positive values on the interval with minimum of 16384 and |
+ | maximum of 32767, and for negative values on the interval with minimum |
+ | of -32768 and maximum of -16384; in order to normalize the result, the |
+ | following operation must be done : |
+ | norm_var1 = shl(var1,norm_s(var1)). |
+ | |
+ | Complexity weight : 15 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0xffff 8000 <= var1 <= 0x0000 7fff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 0000 <= var_out <= 0x0000 000f. |
+ |___________________________________________________________________________|
+*/
+
+Word16 norm_s (Word16 var1)
+{
+ Word16 var_out;
+
+ if (var1 == 0)
+ {
+ var_out = 0;
+ }
+ else
+ {
+ if (var1 == (Word16) 0xffff)
+ {
+ var_out = 15;
+ }
+ else
+ {
+ if (var1 < 0)
+ {
+ var1 = ~var1;
+ }
+ for (var_out = 0; var1 < 0x4000; var_out++)
+ {
+ var1 <<= 1;
+ }
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].norm_s++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : div_s |
+ | |
+ | Purpose : |
+ | |
+ | Produces a result which is the fractional integer division of var1 by |
+ | var2; var1 and var2 must be positive and var2 must be greater or equal |
+ | to var1; the result is positive (leading bit equal to 0) and truncated |
+ | to 16 bits. |
+ | If var1 = var2 then div(var1,var2) = 32767. |
+ | |
+ | Complexity weight : 18 |
+ | |
+ | Inputs : |
+ | |
+ | var1 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 0000 <= var1 <= var2 and var2 != 0. |
+ | |
+ | var2 |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : var1 <= var2 <= 0x0000 7fff and var2 != 0. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 0000 <= var_out <= 0x0000 7fff. |
+ | It's a Q15 value (point between b15 and b14). |
+ |___________________________________________________________________________|
+*/
+
+Word16 div_s (Word16 var1, Word16 var2)
+{
+ Word16 var_out = 0;
+ Word16 iteration;
+ Word32 L_num;
+ Word32 L_denom;
+
+ if ((var1 > var2) || (var1 < 0) || (var2 < 0))
+ {
+ printf ("Division Error var1=%d var2=%d\n", var1, var2);
+ abort(); /* exit (0); */
+ }
+ if (var2 == 0)
+ {
+ printf ("Division by 0, Fatal error \n");
+ abort(); /* exit (0); */
+ }
+ if (var1 == 0)
+ {
+ var_out = 0;
+ }
+ else
+ {
+ if (var1 == var2)
+ {
+ var_out = MAX_16;
+ }
+ else
+ {
+ L_num = L_deposit_l (var1);
+#if (WMOPS)
+ multiCounter[currCounter].L_deposit_l--;
+#endif
+ L_denom = L_deposit_l (var2);
+#if (WMOPS)
+ multiCounter[currCounter].L_deposit_l--;
+#endif
+
+ for (iteration = 0; iteration < 15; iteration++)
+ {
+ var_out <<= 1;
+ L_num <<= 1;
+
+ if (L_num >= L_denom)
+ {
+ L_num = L_sub (L_num, L_denom);
+#if (WMOPS)
+ multiCounter[currCounter].L_sub--;
+#endif
+ var_out = add (var_out, 1);
+#if (WMOPS)
+ multiCounter[currCounter].add--;
+#endif
+ }
+ }
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].div_s++;
+#endif
+ return (var_out);
+}
+
+/*___________________________________________________________________________
+ | |
+ | Function Name : norm_l |
+ | |
+ | Purpose : |
+ | |
+ | Produces the number of left shifts needed to normalize the 32 bit varia-|
+ | ble L_var1 for positive values on the interval with minimum of |
+ | 1073741824 and maximum of 2147483647, and for negative values on the in-|
+ | terval with minimum of -2147483648 and maximum of -1073741824; in order |
+ | to normalize the result, the following operation must be done : |
+ | norm_L_var1 = L_shl(L_var1,norm_l(L_var1)). |
+ | |
+ | Complexity weight : 30 |
+ | |
+ | Inputs : |
+ | |
+ | L_var1 |
+ | 32 bit long signed integer (Word32) whose value falls in the |
+ | range : 0x8000 0000 <= var1 <= 0x7fff ffff. |
+ | |
+ | Outputs : |
+ | |
+ | none |
+ | |
+ | Return Value : |
+ | |
+ | var_out |
+ | 16 bit short signed integer (Word16) whose value falls in the |
+ | range : 0x0000 0000 <= var_out <= 0x0000 001f. |
+ |___________________________________________________________________________|
+*/
+
+Word16 norm_l (Word32 L_var1)
+{
+ Word16 var_out;
+
+ if (L_var1 == 0)
+ {
+ var_out = 0;
+ }
+ else
+ {
+ if (L_var1 == (Word32) 0xffffffffL)
+ {
+ var_out = 31;
+ }
+ else
+ {
+ if (L_var1 < 0)
+ {
+ L_var1 = ~L_var1;
+ }
+ for (var_out = 0; L_var1 < (Word32) 0x40000000L; var_out++)
+ {
+ L_var1 <<= 1;
+ }
+ }
+ }
+
+#if (WMOPS)
+ multiCounter[currCounter].norm_l++;
+#endif
+ return (var_out);
+}
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.cc
new file mode 100644
index 0000000..da0b6cc
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.cc
@@ -0,0 +1,185 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "ch_decode.h"
+#include "aux_sub.h"
+
+
+void decode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector)
+{
+ Word16 bit_stream[BIT_STREAM_LEN];
+ Word16 i, vec_num, tmp, tmp1, tmp2, bit_thr, shift;
+ Word16 *b_ptr, *ba_ptr, index0;
+ Word32 L_tmp;
+
+ imbe_param->b_vec[0] = (shr(frame_vector[0], 4) & 0xFC) | (shr(frame_vector[7], 1) & 0x3);
+
+ if (imbe_param->b_vec[0] < 0 || imbe_param->b_vec[0] > 207)
+ return; // If we return here IMBE parameters from previous frame will be used (frame repeating)
+
+ tmp = ((imbe_param->b_vec[0] & 0xFF) << 1) + 0x4F; // Convert b_vec[0] to unsigned Q15.1 format and add 39.5
+
+ //imbe_param->ff = 4./((double)imbe_param->b_vec[0] + 39.5);
+
+ // Calculate fundamental frequency with higher precession
+ shift = norm_s(tmp);
+ tmp1 = tmp << shift;
+
+ tmp2 = div_s(0x4000, tmp1);
+ imbe_param->fund_freq = L_shr(L_deposit_h(tmp2), 11 - shift);
+
+ L_tmp = L_sub(0x40000000, L_mult(tmp1, tmp2));
+ tmp2 = div_s(extract_l(L_shr(L_tmp, 2)), tmp1);
+ L_tmp = L_shr(L_deposit_l(tmp2), 11 - shift - 2);
+ imbe_param->fund_freq = L_add(imbe_param->fund_freq, L_tmp);
+
+ //printf("%X %X \n", imbe_param->fund_freq, (Word32)(imbe_param->ff * (double)((UWord32)1<<31)));
+
+ tmp = (tmp + 0x2) >> 3; // Calculate (b0 + 39.5 + 1)/4
+ imbe_param->num_harms = ((UWord32)CNST_0_9254_Q0_16 * tmp) >> 16;
+
+ if(imbe_param->num_harms <= 36)
+ imbe_param->num_bands = extract_h((UWord32)(imbe_param->num_harms + 2) * CNST_0_33_Q0_16); // fix((L+2)/3)
+ else
+ imbe_param->num_bands = NUM_BANDS_MAX;
+
+ // Convert input vector (from b_3 to b_L+1) to bit stream
+ bit_stream[0] = (frame_vector[0] & 0x4)?1:0;
+ bit_stream[1] = (frame_vector[0] & 0x2)?1:0;
+ bit_stream[2] = (frame_vector[0] & 0x1)?1:0;
+
+ bit_stream[BIT_STREAM_LEN - 3] = (frame_vector[7] & 0x40)?1:0;
+ bit_stream[BIT_STREAM_LEN - 2] = (frame_vector[7] & 0x20)?1:0;
+ bit_stream[BIT_STREAM_LEN - 1] = (frame_vector[7] & 0x10)?1:0;
+
+
+ index0 = 3 + 3 * 12 - 1;
+ for(vec_num = 3; vec_num >= 1; vec_num--)
+ {
+ tmp = frame_vector[vec_num];
+ for(i = 0; i < 12; i++)
+ {
+ bit_stream[index0] = (tmp & 0x1)?1:0;
+ tmp >>= 1;
+ index0--;
+ }
+ }
+
+ index0 = 3 + 3 * 12 + 3 * 11 - 1;
+ for(vec_num = 6; vec_num >= 4; vec_num--)
+ {
+ tmp = frame_vector[vec_num];
+ for(i = 0; i < 11; i++)
+ {
+ bit_stream[index0] = (tmp & 0x1)?1:0;
+ tmp >>= 1;
+ index0--;
+ }
+ }
+
+ // Rebuild b1
+ index0 = 3 + 3 * 12;
+ tmp = 0;
+ for(i = 0; i < imbe_param->num_bands; i++)
+ tmp = (tmp << 1) | bit_stream[index0++];
+
+ imbe_param->b_vec[1] = tmp;
+
+ // Rebuild b2
+ tmp = 0;
+ tmp |= bit_stream[index0++] << 1;
+ tmp |= bit_stream[index0++];
+ imbe_param->b_vec[2] = (frame_vector[0] & 0x38) | (tmp << 1) | (shr(frame_vector[7], 3) & 0x01);
+
+ // Shift the rest of sequence
+ tmp = imbe_param->num_bands + 2; // shift
+ for(; index0 < BIT_STREAM_LEN; index0++)
+ bit_stream[index0 - tmp] = bit_stream[index0];
+
+ // Priority ReScanning
+ b_ptr = &imbe_param->b_vec[3];
+ ba_ptr = imbe_param->bit_alloc;
+ for(i = 0; i < B_NUM; i++)
+ ba_ptr[i] = b_ptr[i] = 0;
+
+
+ // Unpack bit allocation table's item
+ get_bit_allocation(imbe_param->num_harms, imbe_param->bit_alloc);
+
+ index0 = 0;
+ bit_thr = (imbe_param->num_harms == 0xb)?9:ba_ptr[0];
+
+ while(index0 < BIT_STREAM_LEN - imbe_param->num_bands - 2)
+ {
+ for(i = 0; i < imbe_param->num_harms - 1; i++)
+ if(bit_thr && bit_thr <= ba_ptr[i])
+ b_ptr[i] = (b_ptr[i] << 1) | bit_stream[index0++];
+ bit_thr--;
+ }
+
+ // Synchronization Bit Decoding
+ imbe_param->b_vec[imbe_param->num_harms + 2] = frame_vector[7] & 1;
+}
+
+
+void v_uv_decode(IMBE_PARAM *imbe_param)
+{
+ Word16 num_harms;
+ Word16 num_bands;
+ Word16 vu_vec, *p_v_uv_dsn, mask, i, uv_cnt;
+
+ num_harms = imbe_param->num_harms;
+ num_bands = imbe_param->num_bands;
+ vu_vec = imbe_param->b_vec[1];
+
+ p_v_uv_dsn = imbe_param->v_uv_dsn;
+
+ mask = 1 << (num_bands - 1);
+
+ v_zap(p_v_uv_dsn, NUM_HARMS_MAX);
+
+ i = 0; uv_cnt = 0;
+ while(num_harms--)
+ {
+ if(vu_vec & mask)
+ *p_v_uv_dsn++ = 1;
+ else
+ {
+ *p_v_uv_dsn++ = 0;
+ uv_cnt++;
+ }
+
+ if(++i == 3)
+ {
+ if(num_bands > 1)
+ {
+ num_bands--;
+ mask >>= 1;
+ }
+ i = 0;
+ }
+ }
+ imbe_param->l_uv = uv_cnt;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.h
new file mode 100644
index 0000000..027ab11
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_decode.h
@@ -0,0 +1,32 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _CH_DECODE
+#define _CH_DECODE
+
+#include "typedef.h"
+
+#define BIT_STREAM_LEN (3 + 3*12 + 3*11 + 3)
+
+void decode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector);
+void v_uv_decode(IMBE_PARAM *imbe_param);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.cc
new file mode 100644
index 0000000..eeff592
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.cc
@@ -0,0 +1,110 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "ch_encode.h"
+#include "aux_sub.h"
+
+
+void encode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector)
+{
+ Word16 bit_stream[EN_BIT_STREAM_LEN], index0, bit_thr, bit_mask, i;
+ Word16 vec_num, num_harms, num_bands, tmp;
+ Word16 *ba_ptr, *b_ptr;
+
+ num_harms = imbe_param->num_harms;
+ num_bands = imbe_param->num_bands;
+
+ v_zap(frame_vector, 8);
+
+ // Unpack bit allocation table's item
+ get_bit_allocation(num_harms, imbe_param->bit_alloc);
+
+ // Priority Scanning
+ index0 = 0;
+ ba_ptr = imbe_param->bit_alloc;
+ bit_thr = (num_harms == 0xb)?9:ba_ptr[0];
+ bit_mask = shl(1, bit_thr - 1);
+
+ while(index0 < EN_BIT_STREAM_LEN - (num_bands - 3))
+ {
+ b_ptr = &imbe_param->b_vec[3];
+ for(i = 0; i < num_harms - 1; i++)
+ if(bit_thr && bit_thr <= ba_ptr[i])
+ bit_stream[index0++] = (b_ptr[i] & bit_mask)?1:0;
+
+ bit_thr--;
+ bit_mask = shr(bit_mask, 1);
+ }
+
+ frame_vector[0] = shl(imbe_param->b_vec[0] & 0xFC, 4) | imbe_param->b_vec[2] & 0x38;
+
+ index0 = 0;
+ frame_vector[0] |= (bit_stream[index0++])?4:0;
+ frame_vector[0] |= (bit_stream[index0++])?2:0;
+ frame_vector[0] |= (bit_stream[index0++])?1:0;
+
+ for(vec_num = 1; vec_num <= 3; vec_num++)
+ {
+ tmp = 0;
+ for(i = 0; i < 12; i++)
+ {
+ tmp <<= 1;
+ tmp |= bit_stream[index0++];
+ }
+ frame_vector[vec_num] = tmp;
+ }
+
+ index0 -= num_bands + 2;
+
+ bit_mask = shl(1, num_bands - 1);
+ for(i = 0; i < num_bands; i++)
+ {
+ bit_stream[index0++] = (imbe_param->b_vec[1] & bit_mask)?1:0;
+ bit_mask >>= 1;
+ }
+
+ bit_stream[index0++] = (imbe_param->b_vec[2] & 0x04)?1:0;
+ bit_stream[index0++] = (imbe_param->b_vec[2] & 0x02)?1:0;
+
+ index0 -= num_bands + 2;
+
+ for(vec_num = 4; vec_num <= 6; vec_num++)
+ {
+ tmp = 0;
+ for(i = 0; i < 11; i++)
+ {
+ tmp <<= 1;
+ tmp |= bit_stream[index0++];
+ }
+ frame_vector[vec_num] = tmp;
+ }
+
+ frame_vector[7] = shl(imbe_param->b_vec[0] & 0x03, 1) | shl(imbe_param->b_vec[2] & 0x01, 3);
+ frame_vector[7] |= (bit_stream[index0++])?0x40:0;
+ frame_vector[7] |= (bit_stream[index0++])?0x20:0;
+ frame_vector[7] |= (bit_stream[index0++])?0x10:0;
+ frame_vector[7] |= (imbe_param->b_vec[num_harms + 2])?0x01:0;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.h
new file mode 100644
index 0000000..0a9b8de
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/ch_encode.h
@@ -0,0 +1,32 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _CH_ENCODE
+#define _CH_ENCODE
+
+#define EN_BIT_STREAM_LEN (3 + 3*12 + 6 + 2*11 + 3)
+
+
+void encode_frame_vector(IMBE_PARAM *imbe_param, Word16 *frame_vector);
+
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.cc
new file mode 100644
index 0000000..946174c
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.cc
@@ -0,0 +1,66 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "aux_sub.h"
+#include "basic_op.h"
+#include "math_sub.h"
+#include "dc_rmv.h"
+
+
+#define CNST_0_99_Q1_15 0x7EB8
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// High-pass filter to remove DC
+//
+//
+// INPUT:
+// *sigin - pointer to input signal buffer
+// *sigout - pointer to output signal buffer
+// *mem - pointer to filter's memory element
+// len - number of input signal samples
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved filter state in mem
+//
+//-----------------------------------------------------------------------------
+void dc_rmv(Word16 *sigin, Word16 *sigout, Word32 *mem, Word16 len)
+{
+ Word32 L_tmp, L_mem;
+
+ L_mem = *mem;
+ while(len--)
+ {
+ L_tmp = L_deposit_h(*sigin++);
+ L_mem = L_add(L_mem, L_tmp);
+ *sigout++ = round(L_mem);
+ L_mem = L_mpy_ls(L_mem, CNST_0_99_Q1_15);
+ L_mem = L_sub(L_mem, L_tmp);
+ }
+ *mem = L_mem;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.h b/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.h
new file mode 100644
index 0000000..d36393b
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/dc_rmv.h
@@ -0,0 +1,46 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _DC_RMV
+#define _DC_RMV
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// High-pass filter to remove DC
+//
+//
+// INPUT:
+// *sigin - pointer to input signal buffer
+// *sigout - pointer to output signal buffer
+// *mem - pointer to filter's memory element
+// len - number of input signal samples
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved filter state in mem
+//
+//-----------------------------------------------------------------------------
+void dc_rmv(Word16 *sigin, Word16 *sigout, Word32 *mem, Word16 len);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/decode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/decode.cc
new file mode 100644
index 0000000..79c3a77
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/decode.cc
@@ -0,0 +1,69 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "ch_decode.h"
+#include "sa_decode.h"
+#include "sa_enh.h"
+#include "v_synt.h"
+#include "uv_synt.h"
+#include "basic_op.h"
+#include "aux_sub.h"
+#include "encode.h"
+#include "dsp_sub.h"
+#include "imbe_vocoder.h"
+
+#include <string.h>
+
+
+
+void imbe_vocoder::decode_init(IMBE_PARAM *imbe_param)
+{
+ v_synt_init();
+ uv_synt_init();
+ sa_decode_init();
+
+ // Make previous frame for the first frame
+ memset((char *)imbe_param, 0, sizeof(IMBE_PARAM));
+ imbe_param->fund_freq = 0x0cf6474a;
+ imbe_param->num_harms = 9;
+ imbe_param->num_bands = 3;
+
+}
+
+
+void imbe_vocoder::decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd)
+{
+ Word16 snd_tmp[FRAME];
+ Word16 j;
+
+ decode_frame_vector(imbe_param, frame_vector);
+ v_uv_decode(imbe_param);
+ sa_decode(imbe_param);
+ sa_enh(imbe_param);
+ v_synt(imbe_param, snd);
+ uv_synt(imbe_param, snd_tmp);
+
+ for(j = 0; j < FRAME; j++)
+ snd[j] = add(snd[j], snd_tmp[j]);
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/decode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/decode.h
new file mode 100644
index 0000000..afbc28e
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/decode.h
@@ -0,0 +1,30 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _DECODE
+#define _DECODE
+#if 0
+void decode_init(IMBE_PARAM *imbe_param);
+void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd);
+#endif
+#endif
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.cc
new file mode 100644
index 0000000..2e006e2
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.cc
@@ -0,0 +1,278 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "tbls.h"
+#include "dsp_sub.h"
+#include "math_sub.h"
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform inverse DCT
+//
+//
+// INPUT:
+// in - pointer to input data
+// m_lim - input data's size
+// i_lim - result's size
+// out - pointer to save result
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved in out result of conversion
+//
+//-----------------------------------------------------------------------------
+void imbe_vocoder::idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out)
+{
+ UWord16 angl_step, angl_intl, angl_intl_2;
+ UWord16 angl_acc;
+ Word32 sum;
+ Word16 i, m;
+
+ if(m_lim == 1)
+ {
+ angl_intl = CNST_0_5_Q1_15;
+ angl_intl_2 = CNST_1_0_Q1_15;
+ }
+ else
+ {
+ angl_intl = div_s ((Word16) CNST_0_5_Q5_11, m_lim << 11); // calculate 0.5/m_lim
+ angl_intl_2 = shl(angl_intl, 1);
+ }
+
+ angl_step = angl_intl;
+ for(i = 0; i < i_lim; i++)
+ {
+ sum = 0;
+ angl_acc = angl_step;
+ for(m = 1; m < m_lim; m++)
+ {
+ sum = L_add(sum, L_shr( L_mult(in[m], cos_fxp(angl_acc)), 7));
+ angl_acc += angl_step;
+ }
+ sum = L_add(sum, L_shr( L_deposit_h(in[0]), 8));
+ out[i] = extract_l(L_shr_r (sum, 8));
+ angl_step += angl_intl_2;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform DCT
+//
+//
+// INPUT:
+// in - pointer to input data
+// m_lim - input data's size
+// i_lim - result's size
+// out - pointer to save result
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved in out result of conversion
+//
+//-----------------------------------------------------------------------------
+void imbe_vocoder::dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out)
+{
+ UWord16 angl_step, angl_intl, angl_intl_2, angl_begin;
+ UWord16 angl_acc;
+ Word32 sum;
+ Word16 i, m;
+
+ if(m_lim == 1)
+ {
+ angl_intl = CNST_0_5_Q1_15;
+ angl_intl_2 = CNST_1_0_Q1_15;
+ }
+ else
+ {
+ angl_intl = div_s ((Word16) CNST_0_5_Q5_11, m_lim << 11); // calculate 0.5/m_lim
+ angl_intl_2 = shl(angl_intl, 1);
+ }
+
+ // Calculate first coefficient
+ sum = 0;
+ for(m = 0; m < m_lim; m++)
+ sum = L_add(sum, L_deposit_l(in[m]));
+ out[0] = extract_l(L_mpy_ls(sum, angl_intl_2));
+
+ // Calculate the others coefficients
+ angl_begin = angl_intl;
+ angl_step = angl_intl_2;
+ for(i = 1; i < i_lim; i++)
+ {
+ sum = 0;
+ angl_acc = angl_begin;
+ for(m = 0; m < m_lim; m++)
+ {
+ sum = L_add(sum, L_deposit_l(mult(in[m], cos_fxp(angl_acc))));
+ angl_acc += angl_step;
+ }
+ out[i] = extract_l(L_mpy_ls(sum, angl_intl_2));
+
+ angl_step += angl_intl_2;
+ angl_begin += angl_intl;
+ }
+}
+
+
+
+
+void imbe_vocoder::fft_init(void)
+{
+ Word16 i, fft_len2, shift, step, theta;
+
+ fft_len2 = shr(FFTLENGTH, 1);
+ shift = norm_s(fft_len2);
+ step = shl(2, shift);
+ theta = 0;
+
+ for(i = 0; i <= fft_len2; i++)
+ {
+ wr_array[i] = cos_fxp(theta);
+ wi_array[i] = sin_fxp(theta);
+ if(i >= (fft_len2 - 1))
+ theta = ONE_Q15;
+ else
+ theta = add(theta, step);
+ }
+}
+
+
+// Subroutine FFT: Fast Fourier Transform
+// ***************************************************************
+// * Replaces data by its DFT, if isign is 1, or replaces data *
+// * by inverse DFT times nn if isign is -1. data is a complex *
+// * array of length nn, input as a real array of length 2*nn. *
+// * nn MUST be an integer power of two. This is not checked *
+// * The real part of the number should be in the zeroeth *
+// * of data , and the imaginary part should be in the next *
+// * element. Hence all the real parts should have even indeces *
+// * and the imaginary parts, odd indeces. *
+// * *
+// * Data is passed in an array starting in position 0, but the *
+// * code is copied from Fortran so uses an internal pointer *
+// * which accesses position 0 as position 1, etc. *
+// * *
+// * This code uses e+jwt sign convention, so isign should be *
+// * reversed for e-jwt. *
+// ***************************************************************
+//
+// Q values:
+// datam1 - Q14
+// isign - Q15
+
+#define SWAP(a,b) temp1 = (a);(a) = (b); (b) = temp1
+
+void imbe_vocoder::fft(Word16 *datam1, Word16 nn, Word16 isign)
+{
+ Word16 n, mmax, m, j, istep, i;
+ Word16 wr, wi, temp1;
+ Word32 L_tempr, L_tempi;
+ Word16 *data;
+ Word32 L_temp1, L_temp2;
+ Word16 index, index_step;
+
+ // Use pointer indexed from 1 instead of 0
+ data = &datam1[-1];
+
+ n = shl(nn,1);
+ j = 1;
+ for( i = 1; i < n; i+=2 )
+ {
+ if ( j > i)
+ {
+ SWAP(data[j],data[i]);
+ SWAP(data[j+1],data[i+1]);
+ }
+ m = nn;
+ while ( m >= 2 && j > m )
+ {
+ j = sub(j,m);
+ m = shr(m,1);
+ }
+ j = add(j,m);
+ }
+ mmax = 2;
+
+ // initialize index step
+ index_step = nn;
+
+ while ( n > mmax)
+ {
+ istep = shl(mmax,1); // istep = 2 * mmax
+
+ index = 0;
+ index_step = shr(index_step,1);
+
+ wr = ONE_Q15;
+ wi = 0;
+ for ( m = 1; m < mmax; m+=2)
+ {
+ for ( i = m; i <= n; i += istep)
+ {
+ j = i + mmax;
+
+ // tempr = wr * data[j] - wi * data[j+1]
+ L_temp1 = L_shr(L_mult(wr,data[j]),1);
+ L_temp2 = L_shr(L_mult(wi,data[j+1]),1);
+ L_tempr = L_sub(L_temp1,L_temp2);
+
+ // tempi = wr * data[j+1] + wi * data[j]
+ L_temp1 = L_shr(L_mult(wr,data[j+1]),1);
+ L_temp2 = L_shr(L_mult(wi,data[j]),1);
+ L_tempi = L_add(L_temp1,L_temp2);
+
+
+ // data[j] = data[i] - tempr
+ L_temp1 = L_shr(L_deposit_h(data[i]),1);
+ data[j] = round(L_sub(L_temp1,L_tempr));
+
+ // data[i] += tempr
+ data[i] = round(L_add(L_temp1,L_tempr));
+
+ // data[j+1] = data[i+1] - tempi
+ L_temp1 = L_shr(L_deposit_h(data[i+1]),1);
+ data[j+1] = round(L_sub(L_temp1,L_tempi));
+
+ // data[i+1] += tempi
+ data[i+1] = round(L_add(L_temp1,L_tempi));
+ }
+ index = add(index,index_step);
+ wr = wr_array[index];
+ if (isign < 0)
+ wi = negate(wi_array[index]);
+ else
+ wi = wi_array[index];
+ }
+ mmax = istep;
+ }
+}
+
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.h b/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.h
new file mode 100644
index 0000000..53590e6
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/dsp_sub.h
@@ -0,0 +1,81 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _DSP_SUB
+#define _DSP_SUB
+
+
+#define CNST_0_5_Q1_15 0x4000
+#define CNST_0_5_Q5_11 0x0400
+#define CNST_1_0_Q1_15 0x7FFF
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform inverse DCT
+//
+//
+// INPUT:
+// in - pointer to input data
+// m_lim - input data's size
+// i_lim - result's size
+// out - pointer to save result
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved in out result of conversion
+//
+//-----------------------------------------------------------------------------
+void idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out);
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform DCT
+//
+//
+// INPUT:
+// in - pointer to input data
+// m_lim - input data's size
+// i_lim - result's size
+// out - pointer to save result
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved in out result of conversion
+//
+//-----------------------------------------------------------------------------
+void dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out);
+
+#define FFTLENGTH 256
+
+
+void fft_init(void);
+void fft(Word16 *datam1, Word16 nn, Word16 isign);
+
+void c_fft(Word16 * farray_ptr);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/encode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/encode.cc
new file mode 100644
index 0000000..6d00e1d
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/encode.cc
@@ -0,0 +1,99 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "dsp_sub.h"
+#include "aux_sub.h"
+#include "tbls.h"
+#include "encode.h"
+#include "dc_rmv.h"
+#include "pe_lpf.h"
+#include "pitch_est.h"
+#include "pitch_ref.h"
+#include "v_uv_det.h"
+#include "sa_encode.h"
+#include "ch_encode.h"
+#include "imbe_vocoder.h"
+
+
+
+
+void imbe_vocoder::encode_init(void)
+{
+ v_zap(pitch_est_buf, PITCH_EST_BUF_SIZE);
+ v_zap(pitch_ref_buf, PITCH_EST_BUF_SIZE);
+ v_zap(pe_lpf_mem, PE_LPF_ORD);
+ pitch_est_init();
+ fft_init();
+ dc_rmv_mem = 0;
+ sa_encode_init();
+ pitch_ref_init();
+}
+
+
+void imbe_vocoder::encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd)
+{
+ Word16 i;
+ Word16 *wr_ptr, *sig_ptr;
+
+ for(i = 0; i < PITCH_EST_BUF_SIZE - FRAME; i++)
+ {
+ pitch_est_buf[i] = pitch_est_buf[i + FRAME];
+ pitch_ref_buf[i] = pitch_ref_buf[i + FRAME];
+ }
+
+ dc_rmv(snd, &pitch_ref_buf[PITCH_EST_BUF_SIZE - FRAME], &dc_rmv_mem, FRAME);
+ pe_lpf(&pitch_ref_buf[PITCH_EST_BUF_SIZE - FRAME], &pitch_est_buf[PITCH_EST_BUF_SIZE - FRAME], pe_lpf_mem, FRAME);
+
+ pitch_est(imbe_param, pitch_est_buf);
+
+ //
+ // Speech windowing and FFT calculation
+ //
+ wr_ptr = (Word16 *)wr;
+ sig_ptr = &pitch_ref_buf[40];
+ for(i = 146; i < 256; i++)
+ {
+ fft_buf[i].re = mult(*sig_ptr++, *wr_ptr++);
+ fft_buf[i].im = 0;
+ }
+ fft_buf[0].re = *sig_ptr++;
+ fft_buf[0].im = 0;
+ wr_ptr--;
+ for(i = 1; i < 111; i++)
+ {
+ fft_buf[i].re = mult(*sig_ptr++, *wr_ptr--);
+ fft_buf[i].im = 0;
+ }
+ for(i = 111; i < 146; i++)
+ fft_buf[i].re = fft_buf[i].im = 0;
+
+ fft((Word16 *)&fft_buf, FFTLENGTH, 1);
+
+ pitch_ref(imbe_param, fft_buf);
+ v_uv_det(imbe_param, fft_buf);
+ sa_encode(imbe_param);
+ encode_frame_vector(imbe_param, frame_vector);
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/encode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/encode.h
new file mode 100644
index 0000000..7b06889
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/encode.h
@@ -0,0 +1,32 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _ENCODE
+#define _ENCODE
+
+#define PITCH_EST_BUF_SIZE 621
+#if 0
+void encode_init(void);
+void encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd);
+#endif
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/globals.h b/op25/gr-op25_repeater/lib/imbe_vocoder/globals.h
new file mode 100644
index 0000000..5474030
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/globals.h
@@ -0,0 +1,62 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _GLOBALS
+#define _GLOBALS
+
+
+//#define PI (double)3.1415926535897932384626433832795
+
+#define CNST_0_9254_Q0_16 60647 // 0.9254 in unsigned Q0.16 format
+#define CNST_0_33_Q0_16 0x5556 // 0.(3) = 1/3 in unsigned Q0.16 format
+
+
+#define CNST_ONE_Q8_24 0x01000000
+#define CNST_0_7_Q1_15 0x599A
+#define CNST_0_4_Q1_15 0x3333
+#define CNST_0_03_Q1_15 0x03D7
+#define CNST_0_05_Q1_15 0x0666
+
+#define CNST_1_125_Q8_8 0x0120
+#define CNST_0_5_Q8_8 0x0080
+#define CNST_0_125_Q8_8 0x0020
+#define CNST_0_25_Q8_8 0x0040
+
+#define CNST_0_8717_Q1_15 0x6F94
+#define CNST_0_0031_Q1_15 0x0064
+#define CNST_0_48_Q4_12 0x07AE
+#define CNST_1_00_Q4_12 0x1000
+#define CNST_0_85_Q4_12 0x0D9B
+#define CNST_0_4_Q4_12 0x0666
+#define CNST_0_05_Q4_12 0x00CD
+#define CNST_0_5882_Q1_15 0x4B4B
+#define CNST_0_2857_Q1_15 0x2492
+
+
+#define HI_BYTE(a) ((a >> 8) & 0xFF)
+#define LO_BYTE(a) (a & 0xFF);
+
+
+
+
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/imbe.h b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe.h
new file mode 100644
index 0000000..37ac8a7
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe.h
@@ -0,0 +1,69 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _IMBE
+#define _IMBE
+
+#include "typedef.h"
+
+#define FRAME 160 // Number samples in frame
+#define NUM_HARMS_MAX 56 // Maximum number of harmonics
+#define NUM_HARMS_MIN 9 // Minimum number of harmonics
+#define NUM_BANDS_MAX 12 // Maximum number of bands
+#define MAX_BLOCK_LEN 10 // Maximum length of block used during spectral amplitude encoding
+#define NUM_PRED_RES_BLKS 6 // Number of Prediction Residual Blocks
+#define PE_LPF_ORD 21 // Order of Pitch estimation LPF
+#define PITCH_EST_FRAME 301 // Pitch estimation frame size
+
+
+#define B_NUM (NUM_HARMS_MAX - 1)
+
+
+typedef struct
+{
+ Word16 e_p;
+ Word16 pitch; // Q14.2
+ Word16 ref_pitch; // Q8.8
+ Word32 fund_freq;
+ Word16 num_harms;
+ Word16 num_bands;
+ Word16 v_uv_dsn[NUM_HARMS_MAX];
+ Word16 b_vec[NUM_HARMS_MAX + 3];
+ Word16 bit_alloc[B_NUM + 4];
+ Word16 sa[NUM_HARMS_MAX];
+ Word16 l_uv;
+ Word16 div_one_by_num_harm;
+ Word16 div_one_by_num_harm_sh;
+} IMBE_PARAM;
+
+typedef struct
+{
+ Word16 re;
+ Word16 im;
+} Cmplx16;
+
+#if 0
+void decode_init(IMBE_PARAM *imbe_param);
+void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd);
+#endif
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.cc
new file mode 100644
index 0000000..b61e3b0
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.cc
@@ -0,0 +1,54 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ */
+
+#include <stdio.h>
+
+#include "imbe_vocoder.h"
+
+static bool already_printed = false;
+
+imbe_vocoder::imbe_vocoder (void) :
+ prev_pitch(0),
+ prev_prev_pitch(0),
+ prev_e_p(0),
+ prev_prev_e_p(0),
+ seed(1),
+ num_harms_prev1(0),
+ num_harms_prev2(0),
+ num_harms_prev3(0),
+ fund_freq_prev(0),
+ th_max(0),
+ dc_rmv_mem(0)
+{
+ memset(wr_array, 0, sizeof(wr_array));
+ memset(wi_array, 0, sizeof(wi_array));
+ memset(pitch_est_buf, 0, sizeof(pitch_est_buf));
+ memset(pitch_ref_buf, 0, sizeof(pitch_ref_buf));
+ memset(pe_lpf_mem, 0, sizeof(pe_lpf_mem));
+ memset(fft_buf, 0, sizeof(fft_buf));
+ memset(sa_prev1, 0, sizeof(sa_prev1));
+ memset(sa_prev2, 0, sizeof(sa_prev2));
+ memset(uv_mem, 0, sizeof(uv_mem));
+ memset(ph_mem, 0, sizeof(ph_mem));
+ memset(vu_dsn_prev, 0, sizeof(vu_dsn_prev));
+ memset(sa_prev3, 0, sizeof(sa_prev3));
+ memset(v_uv_dsn, 0, sizeof(v_uv_dsn));
+
+ memset(&my_imbe_param, 0, sizeof(IMBE_PARAM));
+
+ decode_init(&my_imbe_param);
+ encode_init();
+
+ if (!already_printed) {
+ already_printed = 1;
+ fprintf(stderr,"Project 25 IMBE Encoder/Decoder Fixed-Point implementation\n");
+ fprintf(stderr,"Developed by Pavel Yazev E-mail: pyazev@gmail.com\n");
+ fprintf(stderr,"Version 1.0 (c) Copyright 2009\n");
+ fprintf(stderr,"This program comes with ABSOLUTELY NO WARRANTY.\n");
+ fprintf(stderr,"This is free software, and you are welcome to redistribute it\n");
+ fprintf(stderr,"under certain conditions; see the file ``LICENSE'' for details.\n");
+ }
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.h b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.h
new file mode 100644
index 0000000..f6aed4b
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/imbe_vocoder.h
@@ -0,0 +1,89 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ */
+/* -*- c++ -*- */
+#ifndef INCLUDED_IMBE_VOCODER_H
+#define INCLUDED_IMBE_VOCODER_H
+
+#include <stdint.h>
+#include <string.h>
+
+#include "imbe.h"
+#include "dsp_sub.h"
+#include "basic_op.h"
+#include "math_sub.h"
+#include "encode.h"
+#include "decode.h"
+
+class imbe_vocoder
+{
+public:
+ imbe_vocoder(void); // constructor
+ ~imbe_vocoder() {} // destructor
+ // imbe_encode compresses 160 samples (in unsigned int format)
+ // outputs u[] vectors as frame_vector[]
+ void imbe_encode(int16_t *frame_vector, int16_t *snd) {
+ encode(&my_imbe_param, frame_vector, snd);
+ }
+ // imbe_decode decodes IMBE codewords (frame_vector),
+ // outputs the resulting 160 audio samples (snd)
+ void imbe_decode(int16_t *frame_vector, int16_t *snd) {
+ decode(&my_imbe_param, frame_vector, snd);
+ }
+private:
+ IMBE_PARAM my_imbe_param;
+
+ /* data items originally static (moved from individual c++ sources) */
+ Word16 prev_pitch, prev_prev_pitch, prev_e_p, prev_prev_e_p;
+ UWord32 seed ;
+ Word16 num_harms_prev1;
+ Word32 sa_prev1[NUM_HARMS_MAX + 2];
+ Word16 num_harms_prev2;
+ Word32 sa_prev2[NUM_HARMS_MAX + 2];
+ Word16 uv_mem[105];
+ UWord32 ph_mem[NUM_HARMS_MAX];
+ Word16 num_harms_prev3;
+ Word32 fund_freq_prev;
+ Word16 vu_dsn_prev[NUM_HARMS_MAX];
+ Word16 sa_prev3[NUM_HARMS_MAX];
+ Word32 th_max;
+ Word16 v_uv_dsn[NUM_BANDS_MAX];
+ Word16 wr_array[FFTLENGTH / 2 + 1];
+ Word16 wi_array[FFTLENGTH / 2 + 1];
+ Word16 pitch_est_buf[PITCH_EST_BUF_SIZE];
+ Word16 pitch_ref_buf[PITCH_EST_BUF_SIZE];
+ Word32 dc_rmv_mem;
+ Cmplx16 fft_buf[FFTLENGTH];
+ Word16 pe_lpf_mem[PE_LPF_ORD];
+
+ /* member functions */
+ void idct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out);
+ void dct(Word16 *in, Word16 m_lim, Word16 i_lim, Word16 *out);
+ void fft_init(void);
+ void fft(Word16 *datam1, Word16 nn, Word16 isign);
+ void encode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd);
+ void parse(int argc, char **argv);
+ void pitch_est_init(void);
+ Word32 autocorr(Word16 *sigin, Word16 shift, Word16 scale_shift);
+ void e_p(Word16 *sigin, Word16 *res_buf);
+ void pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf);
+ void sa_decode_init(void);
+ void sa_decode(IMBE_PARAM *imbe_param);
+ void sa_encode_init(void);
+ void sa_encode(IMBE_PARAM *imbe_param);
+ void uv_synt_init(void);
+ void uv_synt(IMBE_PARAM *imbe_param, Word16 *snd);
+ void v_synt_init(void);
+ void v_synt(IMBE_PARAM *imbe_param, Word16 *snd);
+ void pitch_ref_init(void);
+ Word16 voiced_sa_calc(Word32 num, Word16 den);
+ Word16 unvoiced_sa_calc(Word32 num, Word16 den);
+ void v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf);
+ void decode_init(IMBE_PARAM *imbe_param);
+ void decode(IMBE_PARAM *imbe_param, Word16 *frame_vector, Word16 *snd);
+ void encode_init(void);
+};
+
+#endif /* INCLUDED_IMBE_VOCODER_H */
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.cc
new file mode 100644
index 0000000..6bbc2f8
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.cc
@@ -0,0 +1,355 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "math_sub.h"
+
+//-----------------------------------------------------------------------------
+// Table for routine Pow2() table[] = 2^(-1...0)
+//-----------------------------------------------------------------------------
+static const Word16 pow2_table[33] =
+{
+ 16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
+ 20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
+ 25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706,
+ 31379, 32066, 32767
+};
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes pow(2.0, x)
+//
+// INPUT:
+// x - In signed Q10.22 format
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in signed Q14.2 format
+//
+//-----------------------------------------------------------------------------
+Word16 Pow2(Word32 x)
+{
+ Word16 exp, i, a, tmp;
+ Word32 L_x;
+ Word16 exponent, fraction;
+
+ exponent = extract_h(L_shr(x, 6));
+ if(exponent < 0)
+ exponent = add(exponent, 1);
+ fraction = extract_l(L_shr(L_sub(x, L_shl(L_deposit_l(exponent),6 + 16)), 7));
+
+ if(x < 0)
+ fraction = negate(fraction);
+
+ L_x = L_mult(fraction, 32); // L_x = fraction<<6
+ i = extract_h(L_x); // Extract b10-b16 of fraction
+ L_x = L_shr(L_x, 1);
+ a = extract_l(L_x); // Extract b0-b9 of fraction
+ a = a & (Word16)0x7fff;
+
+ L_x = L_deposit_h (pow2_table[i]); // table[i] << 16
+ tmp = sub(pow2_table[i], pow2_table[i + 1]); // table[i] - table[i+1]
+ L_x = L_msu(L_x, tmp, a); // L_x -= tmp*a*2
+
+ if(x < 0)
+ {
+ L_x = L_deposit_h(div_s(0x4000, extract_h(L_x))); // calculate 1/fraction
+ exponent = sub(exponent, 1);
+ }
+
+ exp = sub(12, exponent);
+ L_x = L_shr_r(L_x, exp);
+
+ return extract_h(L_x);
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Multiply a 32 bit number (L_var2) and a 16 bit
+// number (var1) returning a 32 bit result. L_var2
+// is truncated to 31 bits prior to executing the
+// multiply.
+//
+// INPUT:
+// L_var2 - A Word32 input variable
+// var1 - A Word16 input variable
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// A Word32 value
+//
+//-----------------------------------------------------------------------------
+Word32 L_mpy_ls(Word32 L_var2, Word16 var1)
+{
+ Word32 L_varOut;
+ Word16 swtemp;
+
+ swtemp = shr(extract_l(L_var2), 1);
+ swtemp = (Word16)32767 & (Word16) swtemp;
+
+ L_varOut = L_mult(var1, swtemp);
+ L_varOut = L_shr(L_varOut, 15);
+ L_varOut = L_mac(L_varOut, var1, extract_h(L_var2));
+ return (L_varOut);
+}
+
+//-----------------------------------------------------------------------------
+// Table for routine cos_fxp()
+//-----------------------------------------------------------------------------
+static const Word16 cos_table[129] =
+{
+ 32767, 32766, 32758, 32746, 32729, 32706, 32679, 32647, 32610,
+ 32568, 32522, 32470, 32413, 32352, 32286, 32214, 32138, 32058,
+ 31972, 31881, 31786, 31686, 31581, 31471, 31357, 31238, 31114,
+ 30986, 30853, 30715, 30572, 30425, 30274, 30118, 29957, 29792,
+ 29622, 29448, 29269, 29086, 28899, 28707, 28511, 28311, 28106,
+ 27897, 27684, 27467, 27246, 27020, 26791, 26557, 26320, 26078,
+ 25833, 25583, 25330, 25073, 24812, 24548, 24279, 24008, 23732,
+ 23453, 23170, 22884, 22595, 22302, 22006, 21706, 21403, 21097,
+ 20788, 20475, 20160, 19841, 19520, 19195, 18868, 18538, 18205,
+ 17869, 17531, 17190, 16846, 16500, 16151, 15800, 15447, 15091,
+ 14733, 14373, 14010, 13646, 13279, 12910, 12540, 12167, 11793,
+ 11417, 11039, 10660, 10279, 9896, 9512, 9127, 8740, 8351,
+ 7962, 7571, 7180, 6787, 6393, 5998, 5602, 5205, 4808,
+ 4410, 4011, 3612, 3212, 2811, 2411, 2009, 1608, 1206,
+ 804, 402, 0
+};
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes the cosine of x whose value is expressed in radians/PI.
+//
+// INPUT:
+// x - argument in Q1.15
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q1.15
+//
+//-----------------------------------------------------------------------------
+Word16 cos_fxp(Word16 x)
+{
+ Word16 tx, ty;
+ Word16 sign;
+ Word16 index1,index2;
+ Word16 m;
+ Word16 temp;
+
+ sign = 0;
+ if(x < 0)
+ tx = negate(x);
+ else
+ tx = x;
+
+ // if angle > pi/2, cos(angle) = -cos(pi-angle)
+ if(tx > X05_Q15)
+ {
+ tx = sub(ONE_Q15,tx);
+ sign = -1;
+ }
+ // convert input to be within range 0-128
+ index1 = shr(tx,7);
+ index2 = add(index1,1);
+
+ if (index1 == 128)
+ return (Word16)0;
+
+ m = sub(tx,shl(index1,7));
+ // convert decimal part to Q15
+ m = shl(m,8);
+
+ temp = sub(cos_table[index2],cos_table[index1]);
+ temp = mult(m,temp);
+ ty = add(cos_table[index1],temp);
+
+ if(sign)
+ return negate(ty);
+ else
+ return ty;
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes the sinus of x whose value is expressed in radians/PI.
+//
+// INPUT:
+// x - argument in Q1.15
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q1.15
+//
+//-----------------------------------------------------------------------------
+Word16 sin_fxp(Word16 x)
+{
+ Word16 tx, ty;
+ Word16 sign;
+
+ sign = 0;
+ if(x < 0)
+ {
+ tx = negate(x);
+ sign = 1;
+ }
+ else
+ tx = x;
+
+ if(tx > X05_Q15)
+ tx = sub(tx, X05_Q15);
+ else
+ tx = sub(X05_Q15,tx);
+
+ ty = cos_fxp(tx);
+
+ if(sign)
+ return negate(ty);
+ else
+ return ty;
+}
+
+
+//-----------------------------------------------------------------------------
+// Table for routine sqrt_l_exp()
+// table[] = sqrt((i+16)*2^-6) * 2^15, i.e. sqrt(x) scaled Q15
+//-----------------------------------------------------------------------------
+static const Word16 sqrt_table[49] =
+{
+ 16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480,
+ 20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232,
+ 24576, 24915, 25249, 25580, 25905, 26227, 26545, 26859, 27170, 27477,
+ 27780, 28081, 28378, 28672, 28963, 29251, 29537, 29819, 30099, 30377,
+ 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32767
+};
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes sqrt(L_x), where L_x is positive.
+//
+// INPUT:
+// L_x - argument in Q1.31
+// *exp - pointer to save denormalization exponent
+// OUTPUT:
+// Right shift to be applied to result, Q16.0
+//
+// RETURN:
+// Result in Q1.31
+// Right shift should be applied to it!
+//
+//-----------------------------------------------------------------------------
+Word32 sqrt_l_exp(Word32 L_x, Word16 *exp)
+{
+ Word16 e, i, a, tmp;
+ Word32 L_y;
+
+ if(L_x <= (Word32)0)
+ {
+ *exp = 0;
+ return (Word32)0;
+ }
+
+ e = norm_l(L_x) & 0xFFFE; // get next lower EVEN norm. exp
+ L_x = L_shl(L_x, e); // L_x is normalized to [0.25..1)
+ *exp = e >> 1; // return 2*exponent (or Q1)
+
+ L_x = L_shr(L_x, 9);
+ i = extract_h(L_x); // Extract b25-b31, 16 <= i <= 63 because of normalization
+ L_x = L_shr(L_x, 1);
+ a = extract_l(L_x); // Extract b10-b24
+ a = a & (Word16)0x7fff;
+
+ i = sub(i, 16); // 0 <= i <= 47
+
+ L_y = L_deposit_h(sqrt_table[i]); // table[i] << 16
+ tmp = sub(sqrt_table[i], sqrt_table[i + 1]); // table[i] - table[i+1])
+ L_y = L_msu(L_y, tmp, a); // L_y -= tmp*a*2
+
+ return L_y;
+}
+
+//-----------------------------------------------------------------------------
+// Table for routine Log2()
+//-----------------------------------------------------------------------------
+static const Word16 log_table[33] =
+{
+ 0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
+ 12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
+ 22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497,
+ 31266, 32023, 32767
+};
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes log2 of x
+//
+// INPUT:
+// x - argument in Q14.2
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q10.22
+//
+//-----------------------------------------------------------------------------
+Word32 Log2(Word16 x)
+{
+ Word16 exp, i, a, tmp;
+ Word32 L_y;
+
+ if(x <= (Word16)0)
+ return 0;
+
+ exp = norm_s(x);
+ x = shl(x, exp);
+
+ i = shr(x, 9); // Extract b15-b9
+ a = shl(x & 0x1FF, 6); // Extract b8-b0
+ i = sub (i, 32);
+
+ L_y = L_deposit_h(log_table[i]); // table[i] << 16
+ tmp = sub(log_table[i], log_table[i + 1]); // table[i] - table[i+1]
+ L_y = L_msu(L_y, tmp, a); // L_y -= tmp*a*2
+
+ L_y = L_shr(L_y, 9);
+
+ exp = sub(12, exp);
+ L_y = L_add(L_y, L_deposit_h(shl(exp, 6)));
+
+ return L_y;
+}
+
+
+
+
+
+
+
+
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.h b/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.h
new file mode 100644
index 0000000..baf75fe
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/math_sub.h
@@ -0,0 +1,130 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _MATH_SUB
+#define _MATH_SUB
+
+#define X05_Q15 16384 // (0.5*(1<<15))
+#define ONE_Q15 32767 // ((1<<15)-1)
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes the cosine of x whose value is expressed in radians/PI.
+//
+// INPUT:
+// x - argument in Q1.15
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q1.15
+//
+//-----------------------------------------------------------------------------
+Word16 cos_fxp(Word16 x);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes the sinus of x whose value is expressed in radians/PI.
+//
+// INPUT:
+// x - argument in Q1.15
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q1.15
+//
+//-----------------------------------------------------------------------------
+Word16 sin_fxp(Word16 x);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Multiply a 32 bit number (L_var2) and a 16 bit
+// number (var1) returning a 32 bit result. L_var2
+// is truncated to 31 bits prior to executing the
+// multiply.
+//
+// INPUT:
+// L_var2 - A Word32 input variable
+// var1 - A Word16 input variable
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// A Word32 value
+//
+//-----------------------------------------------------------------------------
+Word32 L_mpy_ls(Word32 L_var2, Word16 var1);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes pow(2.0, x)
+//
+// INPUT:
+// x - In signed Q10.22 format
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in signed Q14.2 format
+//
+//-----------------------------------------------------------------------------
+Word16 Pow2 (Word32 x);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes sqrt(L_x), where L_x is positive.
+//
+// INPUT:
+// L_x - argument in Q1.31
+// *exp - pointer to save denormalization exponent
+// OUTPUT:
+// Right shift to be applied to result, Q16.0
+//
+// RETURN:
+// Result in Q1.31
+// Right shift should be applied to it!
+//
+//-----------------------------------------------------------------------------
+Word32 sqrt_l_exp (Word32 L_x, Word16 *exp);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Computes log2 of x
+//
+// INPUT:
+// x - argument in Q14.2
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Result in Q10.22
+//
+//-----------------------------------------------------------------------------
+Word32 Log2(Word16 x);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.cc
new file mode 100644
index 0000000..b16547b
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.cc
@@ -0,0 +1,74 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "aux_sub.h"
+#include "basic_op.h"
+#include "math_sub.h"
+#include "pe_lpf.h"
+
+
+
+static const Word16 lpf_coef[PE_LPF_ORD] =
+{
+ -94, -92, 185, 543, 288, -883, -1834, -495, 3891, 9141, 11512,
+ 9141, 3891, -495, -1834, -883, 288, 543, 185, -92, -94
+};
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Low-pass filter for pitch estimator
+//
+//
+// INPUT:
+// *sigin - pointer to input signal buffer
+// *sigout - pointer to output signal buffer
+// *mem - pointer to filter's memory element
+// len - number of input signal samples
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved filter state in mem
+//
+//-----------------------------------------------------------------------------
+void pe_lpf(Word16 *sigin, Word16 *sigout, Word16 *mem, Word16 len)
+{
+ Word16 i;
+ Word32 L_sum;
+
+ while(len--)
+ {
+ for(i = 0; i < PE_LPF_ORD - 1; i++)
+ mem[i] = mem[i + 1];
+ mem[PE_LPF_ORD - 1] = *sigin++;
+
+ L_sum = 0;
+ for(i = 0; i < PE_LPF_ORD; i++)
+ L_sum = L_mac(L_sum, mem[i], lpf_coef[i]);
+
+ *sigout++ = round(L_sum);
+ }
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.h b/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.h
new file mode 100644
index 0000000..54fd017
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pe_lpf.h
@@ -0,0 +1,47 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _PE_LPF
+#define _PE_LPF
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Low-pass filter for pitch estimator
+//
+//
+// INPUT:
+// *sigin - pointer to input signal buffer
+// *sigout - pointer to output signal buffer
+// *mem - pointer to filter's memory element
+// len - number of input signal samples
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Saved filter state in mem
+//
+//-----------------------------------------------------------------------------
+void pe_lpf(Word16 *sigin, Word16 *sigout, Word16 *mem, Word16 len);
+
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.cc
new file mode 100644
index 0000000..25ba61a
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.cc
@@ -0,0 +1,350 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "aux_sub.h"
+#include "math_sub.h"
+#include "tbls.h"
+#include "pitch_est.h"
+#include "encode.h"
+#include "dsp_sub.h"
+#include "imbe_vocoder.h"
+
+
+
+static const Word16 min_max_tbl[203] =
+{
+ 0x0008, 0x0009, 0x000a, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0012, 0x0013,
+ 0x0014, 0x0115, 0x0216, 0x0218, 0x0319, 0x041a, 0x051b, 0x061c, 0x061e, 0x071f,
+ 0x0820, 0x0921, 0x0a22, 0x0a24, 0x0b25, 0x0c26, 0x0d27, 0x0e28, 0x0e2a, 0x0f2b,
+ 0x102c, 0x112d, 0x122e, 0x1230, 0x1331, 0x1432, 0x1533, 0x1634, 0x1636, 0x1737,
+ 0x1838, 0x1939, 0x1a3a, 0x1a3c, 0x1b3d, 0x1c3e, 0x1d3f, 0x1e40, 0x1e42, 0x1f43,
+ 0x2044, 0x2145, 0x2246, 0x2248, 0x2349, 0x244a, 0x254b, 0x264c, 0x264e, 0x274f,
+ 0x2850, 0x2951, 0x2a52, 0x2a54, 0x2b55, 0x2c56, 0x2d57, 0x2e58, 0x2e5a, 0x2f5b,
+ 0x305c, 0x315d, 0x325e, 0x3260, 0x3361, 0x3462, 0x3563, 0x3664, 0x3666, 0x3767,
+ 0x3868, 0x3969, 0x3a6a, 0x3a6c, 0x3b6d, 0x3c6e, 0x3d6f, 0x3e70, 0x3e72, 0x3f73,
+ 0x4074, 0x4175, 0x4276, 0x4278, 0x4379, 0x447a, 0x457b, 0x467c, 0x467e, 0x477f,
+ 0x4880, 0x4981, 0x4a82, 0x4a84, 0x4b85, 0x4c86, 0x4d87, 0x4e88, 0x4e8a, 0x4f8b,
+ 0x508c, 0x518d, 0x528e, 0x5290, 0x5391, 0x5492, 0x5593, 0x5694, 0x5696, 0x5797,
+ 0x5898, 0x5999, 0x5a9a, 0x5a9c, 0x5b9d, 0x5c9e, 0x5d9f, 0x5ea0, 0x5ea2, 0x5fa3,
+ 0x60a4, 0x61a5, 0x62a6, 0x62a8, 0x63a9, 0x64aa, 0x65ab, 0x66ac, 0x66ae, 0x67af,
+ 0x68b0, 0x69b1, 0x6ab2, 0x6ab4, 0x6bb5, 0x6cb6, 0x6db7, 0x6eb8, 0x6eba, 0x6fbb,
+ 0x70bc, 0x71bd, 0x72be, 0x72c0, 0x73c1, 0x74c2, 0x75c3, 0x76c4, 0x76c6, 0x77c7,
+ 0x78c8, 0x79c9, 0x7aca, 0x7aca, 0x7bca, 0x7cca, 0x7dca, 0x7eca, 0x7eca, 0x7fca,
+ 0x80ca, 0x81ca, 0x82ca, 0x82ca, 0x83ca, 0x84ca, 0x85ca, 0x86ca, 0x86ca, 0x87ca,
+ 0x88ca, 0x89ca, 0x8aca, 0x8aca, 0x8bca, 0x8cca, 0x8dca, 0x8eca, 0x8eca, 0x8fca,
+ 0x90ca, 0x91ca, 0x92ca, 0x92ca, 0x93ca, 0x94ca, 0x95ca, 0x96ca, 0x96ca, 0x97ca,
+ 0x98ca, 0x99ca, 0x9aca
+};
+
+
+
+
+
+void imbe_vocoder::pitch_est_init(void)
+{
+ prev_pitch = prev_prev_pitch = 158; // 100
+ prev_e_p = prev_prev_e_p = 0;
+}
+
+
+
+Word32 imbe_vocoder::autocorr(Word16 *sigin, Word16 shift, Word16 scale_shift)
+{
+ Word32 L_sum;
+ Word16 i;
+
+ L_sum = 0;
+ for(i = 0; i < PITCH_EST_FRAME - shift; i++)
+ L_sum = L_add(L_sum, L_shr(L_mult(sigin[i], sigin[i + shift]), scale_shift) );
+
+ return L_sum;
+}
+
+
+
+void imbe_vocoder::e_p(Word16 *sigin, Word16 *res_buf)
+{
+ Word16 i, j, den_part_acc, tmp;
+ Word32 L_sum, L_num, L_den, L_e0, L_tmp;
+ Word16 sig_wndwed[PITCH_EST_FRAME];
+ Word32 corr[259];
+ Word16 index_beg, index_step;
+ Word16 scale_shift;
+
+
+ // Windowing input signal s * wi^2
+ for(i = 0 ; i < PITCH_EST_FRAME; i++)
+ sig_wndwed[i] = mult_r(sigin[i], wi[i]);
+
+ L_sum = 0;
+ for(i = 0 ; i < PITCH_EST_FRAME; i++)
+ L_sum = L_add(L_sum, L_mpy_ls( L_mult(sigin[i], sigin[i]), wi[i]) ); // sum(s^2 * wi^2)
+
+ // Check for the overflow
+ if(L_sum == MAX_32)
+ {
+ // Recalculate with scaling
+ L_sum = 0;
+ for(i = 0 ; i < PITCH_EST_FRAME; i++)
+ L_sum = L_add(L_sum, L_mpy_ls( L_shr(L_mult(sigin[i], sigin[i]), 5), wi[i]));
+ scale_shift = 5;
+ }
+ else
+ scale_shift = 0;
+
+ L_e0 = 0;
+ for(i = 0 ; i < PITCH_EST_FRAME; i++)
+ L_e0 = L_add(L_e0, L_shr( L_mult(sig_wndwed[i], sig_wndwed[i]), scale_shift)); // sum(s^2 * wi^4)
+
+ // Calculate correlation for time shift in range 21...150 with step 0.5
+ // For integer shifts
+ for(tmp = 21, i = 0; tmp <= 150; tmp++, i += 2)
+ corr[i] = autocorr(sig_wndwed, tmp, scale_shift);
+ // For intermediate shifts
+ for(i = 1; i < 258; i += 2)
+ corr[i] = L_shr( L_add(corr[i - 1], corr[i + 1]), 1);
+
+
+ // variable to calculate 1 - P * sum(wi ^4) in denominator
+ den_part_acc = CNST_0_8717_Q1_15;
+
+ index_step = 42; // Note: 42 = 21 in Q15.1 format, so index_step will be used also as p in Q15.1 format
+ index_beg = 0;
+ L_e0 = L_shr(L_e0, 7); // divide by 64 to compensate wi scaling
+ // p = 21...122 by step 0.5
+ for(i = 0; i < 203; i++)
+ {
+
+ // Calculate sum( corr ( n * p) )
+ L_tmp = 0;
+ j = index_beg;
+ while(j <= 258)
+ {
+ L_tmp = L_add(L_tmp, corr[j]);
+ j += index_step;
+ }
+
+ L_tmp = L_shr(L_tmp, 6); // compensate wi scaling
+ L_tmp = L_add(L_tmp, L_e0); // For n = 0
+ L_tmp = L_tmp * index_step;
+ L_num = L_sub(L_sum, L_tmp);
+
+ index_beg++;
+ index_step++;
+
+ L_den = L_mpy_ls(L_sum, den_part_acc);
+
+ if(L_num < L_den && L_den != 0)
+ {
+ //res_buf[i] = (Word16)((double)L_num/(double)L_den * 4096.); // Q4.12
+
+ if(L_num <= 0)
+ res_buf[i] = 0;
+ else
+ {
+ tmp = norm_l(L_den);
+ tmp = div_s(extract_h(L_shl(L_num, tmp)), extract_h(L_shl(L_den, tmp)));
+ res_buf[i] = shr(tmp, 3); // convert to Q4.12
+ }
+ }
+ else if(L_num >= L_den)
+ {
+ res_buf[i] = CNST_1_00_Q4_12;
+ //res_buf[i] = (Word16)((double)L_num/(double)L_den * 4096.); // Q4.12
+ }
+ else
+ res_buf[i] = CNST_1_00_Q4_12;
+
+ den_part_acc = sub(den_part_acc, CNST_0_0031_Q1_15);
+ }
+}
+
+
+
+
+void imbe_vocoder::pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf)
+{
+ Word16 e_p_arr0[203], e_p_arr1[203], e_p_arr2[203], e1p1_e2p2_est_save[203];
+ Word16 min_index, max_index, p, i, p_index;
+ UWord16 tmp=0, p_fp;
+ UWord32 UL_tmp;
+ Word16 e_p_cur, pb, pf, ceb, s_tmp;
+ Word16 cef_est, cef, p0_est, p0, p1, p2, p1_max_index, p2_max_index, e1p1_e2p2_est, e1p1_e2p2;
+ Word16 e_p_arr2_min[203];
+
+ // Calculate E(p) function for current and two future frames
+ e_p(&frames_buf[0], e_p_arr0);
+
+ // Look-Back Pitch Tracking
+ min_index = HI_BYTE(min_max_tbl[prev_pitch]);
+ max_index = LO_BYTE(min_max_tbl[prev_pitch]);
+
+ p = pb = min_index;
+ e_p_cur = e_p_arr0[min_index];
+ while(++p <= max_index)
+ if(e_p_arr0[p] < e_p_cur)
+ {
+ e_p_cur = e_p_arr0[p];
+ pb = p;
+ }
+ ceb = add(e_p_cur, add(prev_e_p, prev_prev_e_p));
+
+
+ if(ceb <= CNST_0_48_Q4_12)
+ {
+ prev_prev_pitch = prev_pitch;
+ prev_pitch = pb;
+ prev_prev_e_p = prev_e_p;
+ prev_e_p = e_p_arr0[pb];
+
+ imbe_param->pitch = pb + 42; // Result in Q15.1 format
+ imbe_param->e_p = prev_e_p;
+ return;
+ }
+
+
+ // Look-Ahead Pitch Tracking
+ e_p(&frames_buf[FRAME], e_p_arr1);
+ e_p(&frames_buf[2 * FRAME], e_p_arr2);
+
+ p0_est = p0 = 0;
+ cef_est = e_p_arr0[p0] + e_p_arr1[p0] + e_p_arr2[p0];
+ e1p1_e2p2 = 1;
+
+ p1 = 0;
+ while(p1 < 203)
+ {
+ p2 = HI_BYTE(min_max_tbl[p1]);
+ p2_max_index = LO_BYTE(min_max_tbl[p1]);
+ s_tmp = e_p_arr2[p1];
+ while(p2 <= p2_max_index)
+ {
+ if(e_p_arr2[p2] < s_tmp)
+ s_tmp = e_p_arr2[p2];
+ p2++;
+ }
+ e_p_arr2_min[p1] = s_tmp;
+ p1++;
+ }
+ while(p0 < 203)
+ {
+ e1p1_e2p2_est = e_p_arr1[p0] + e_p_arr2_min[p0];
+ p1 = HI_BYTE(min_max_tbl[p0]);
+ p1_max_index = LO_BYTE(min_max_tbl[p0]);
+ while(p1 <= p1_max_index)
+ {
+ if(add(e_p_arr1[p1], e_p_arr2_min[p1]) < e1p1_e2p2_est)
+ e1p1_e2p2_est = add(e_p_arr1[p1], e_p_arr2_min[p1]);
+ p1++;
+ }
+ e1p1_e2p2_est_save[p0] = e1p1_e2p2_est;
+ cef = add(e_p_arr0[p0], e1p1_e2p2_est);
+ if(cef < cef_est)
+ {
+ cef_est = cef;
+ p0_est = p0;
+ }
+ p0++;
+ }
+
+ pf = p0_est;
+ // Sub-multiples analysis
+ if(pf >= 42) // Check if Sub-multiples are possible
+ {
+ if(pf < 84)
+ i = 1;
+ else if(pf < 126)
+ i = 2;
+ else if(pf < 168)
+ i = 3;
+ else
+ i = 4;
+
+ p_fp = (pf + 42) << 8; // Convert pitch estimation from array index to unsigned Q7.19 format
+
+ while(i--)
+ {
+ switch(i)
+ {
+ case 0:
+ tmp = p_fp >> 1; // P_est/2
+ break;
+
+ case 1:
+ UL_tmp = (UWord32)p_fp * 0x5555; // P_est/3
+ tmp = UL_tmp >> 16;
+ break;
+
+ case 2:
+ tmp = p_fp >> 2; // P_est/4
+ break;
+
+ case 3:
+ UL_tmp = (UWord32)p_fp * 0x3333; // P_est/5
+ tmp = UL_tmp >> 16;
+ break;
+ }
+
+ p_index = ((tmp + 0x0080) >> 8) - 42; // Convert fixed-point pitch value to integer array index with rounding
+
+ cef = add(e_p_arr0[p_index], e1p1_e2p2_est_save[p_index]);
+
+ if(cef <= CNST_0_85_Q4_12 && mult_r(cef, CNST_0_5882_Q1_15) <= cef_est) // 1/1.7 = 0.5882
+ {
+ pf = p_index;
+ break;
+ }
+
+ if(cef <= CNST_0_4_Q4_12 && mult_r(cef, CNST_0_2857_Q1_15) <= cef_est) // 1/3.5 = 0.2857
+ {
+ pf = p_index;
+ break;
+ }
+
+ if(cef <= CNST_0_05_Q4_12)
+ {
+ pf = p_index;
+ break;
+ }
+ }
+ }
+
+ cef = add(e_p_arr0[pf], e1p1_e2p2_est_save[pf]);
+
+ if(ceb <= cef)
+ p = pb;
+ else
+ p = pf;
+
+ prev_prev_pitch = prev_pitch;
+ prev_pitch = p;
+ prev_prev_e_p = prev_e_p;
+ prev_e_p = e_p_arr0[p];
+
+
+ imbe_param->pitch = p + 42; // Result in Q15.1 format
+ imbe_param->e_p = prev_e_p;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.h b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.h
new file mode 100644
index 0000000..b6b052d
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_est.h
@@ -0,0 +1,29 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _PITCH_EST
+#define _PITCH_EST
+
+void pitch_est_init(void);
+void pitch_est(IMBE_PARAM *imbe_param, Word16 *frames_buf);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.cc
new file mode 100644
index 0000000..035a06d
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.cc
@@ -0,0 +1,167 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "aux_sub.h"
+#include "math_sub.h"
+#include "dsp_sub.h"
+#include "tbls.h"
+#include "pitch_ref.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+
+#define PITCH_REF_FRAME 221
+#define MIN_INDEX 50
+
+
+
+
+void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf)
+{
+ Word16 i, j, index_a_save, pitch_est, tmp, shift, index_wr, up_lim;
+ Cmplx16 sp_rec[FFTLENGTH/2];
+ Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b, fund_freq_acc, L_tmp, amp_re_acc, amp_im_acc, L_sum, L_diff_min;
+ Word16 ha, hb, index_a, index_b, index_tbl[20], it_ind, re_tmp, im_tmp, pitch_cand=0;
+ Word32 fund_freq_cand=0;
+
+
+ pitch_est = shl(imbe_param->pitch, 7); // Convert to Q8.8
+ pitch_est = sub(pitch_est, CNST_1_125_Q8_8); // Sub 1.125 = 9/8
+
+ L_diff_min = MAX_32;
+ for(i = 0; i < 19; i++)
+ {
+ shift = norm_s(pitch_est);
+ tmp = shl(pitch_est, shift);
+ tmp = div_s(0x4000, tmp);
+ fund_freq = L_shl(tmp, shift + 11);
+
+ fund_freq_acc = fund_freq;
+ fund_freq_2 = L_shr(fund_freq, 1);
+ fund_freq_acc_a = L_sub(fund_freq, fund_freq_2);
+ fund_freq_acc_b = L_add(fund_freq, fund_freq_2);
+
+ // Calculate upper limit for spectrum reconstruction
+ up_lim = extract_h(L_shr((UWord32)CNST_0_9254_Q0_16 * pitch_est, 1)); // 0.9254/fund_freq
+ up_lim = sub(up_lim, CNST_0_5_Q8_8); // sub 0.5
+ up_lim = up_lim & 0xFF00; // extract fixed part
+ up_lim = mult(up_lim, extract_h(fund_freq));
+ up_lim = shr(up_lim, 1);
+
+ index_b = 0;
+ while(index_b <= up_lim)
+ {
+ ha = extract_h(fund_freq_acc_a);
+ hb = extract_h(fund_freq_acc_b);
+ index_a = (ha >> 8) + ((ha & 0xFF)?1:0);
+ index_b = (hb >> 8) + ((hb & 0xFF)?1:0);
+
+ if(index_b >= MIN_INDEX)
+ {
+ L_tmp = L_shl(L_deposit_h(index_a), 8);
+ L_tmp = L_sub(L_tmp, fund_freq_acc);
+ L_tmp = L_add(L_tmp, 0x00020000); // for rounding purpose
+ L_tmp = L_shr(L_tmp, 2);
+
+ index_a_save = index_a;
+ it_ind = 0;
+
+ amp_re_acc = amp_im_acc = 0;
+ while(index_a < index_b)
+ {
+ index_wr = extract_h(L_tmp);
+ if(index_wr < 0 && (L_tmp & 0xFFFF)) // truncating for negative number
+ index_wr = add(index_wr, 1);
+ index_wr = add(index_wr, 160);
+ index_tbl[it_ind++] = index_wr;
+ if(index_wr >= 0 && index_wr <= 320)
+ {
+ amp_re_acc = L_mac(amp_re_acc, fft_buf[index_a].re, wr_sp[index_wr]);
+ amp_im_acc = L_mac(amp_im_acc, fft_buf[index_a].im, wr_sp[index_wr]);
+ }
+
+ index_a++;
+ L_tmp = L_add(L_tmp, 0x400000);
+ }
+
+ it_ind = 0;
+ index_a = index_a_save;
+ while(index_a < index_b)
+ {
+ index_wr = index_tbl[it_ind++];
+ if(index_wr < 0 || index_wr > 320)
+ {
+ sp_rec[index_a].im = sp_rec[index_a].re = 0;
+ }
+ else
+ {
+ sp_rec[index_a].im = mult(mult(extract_h(amp_im_acc), wr_sp[index_wr]), 0x6666);
+ sp_rec[index_a].re = mult(mult(extract_h(amp_re_acc), wr_sp[index_wr]), 0x6666);
+ }
+
+ index_a++;
+ }
+ }
+
+ fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq);
+ fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq);
+ fund_freq_acc = L_add(fund_freq_acc, fund_freq);
+ }
+
+ L_sum = 0;
+ for(j = MIN_INDEX; j <= up_lim; j++)
+ {
+ re_tmp = sub(fft_buf[j].re, sp_rec[j].re);
+ im_tmp = sub(fft_buf[j].im, sp_rec[j].im);
+ L_sum = L_mac(L_sum, re_tmp, re_tmp);
+ L_sum = L_mac(L_sum, im_tmp, im_tmp);
+ }
+
+ if(L_sum < L_diff_min)
+ {
+ L_diff_min = L_sum;
+ pitch_cand = pitch_est;
+ fund_freq_cand = fund_freq;
+ }
+
+ pitch_est = add(pitch_est, CNST_0_125_Q8_8); // Add 0.125 = 1/8
+ }
+
+ imbe_param->ref_pitch = pitch_cand;
+ imbe_param->fund_freq = fund_freq_cand;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.h b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.h
new file mode 100644
index 0000000..29ccf8a
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/pitch_ref.h
@@ -0,0 +1,28 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _PITCH_REF
+#define _PIRCH_REF
+
+void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.cc
new file mode 100644
index 0000000..bd0cbe8
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.cc
@@ -0,0 +1,144 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "qnt_sub.h"
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Dequantize by quantizer step size
+//
+//
+// INPUT:
+// qval - quantized value
+// step_size - step size used to quantize in unsigned Q0.16 format
+// bit_num - the number of bits
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in signed (bit_num).16 format
+//
+//-----------------------------------------------------------------------------
+Word32 deqnt_by_step(Word16 qval, UWord16 step_size, Word16 bit_num)
+{
+ Word32 res;
+
+ if(bit_num == 0)
+ return (Word32)0;
+
+ res = (Word32)step_size * (qval - (1 << (bit_num - 1)));
+ res = L_add(res, ((Word32)step_size * CNST_0_5_Q0_16) >> 16);
+
+ return res;
+}
+
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Quantize by quantizer step size
+//
+//
+// INPUT:
+// val - value to be quantized in Q5.10 format
+// step_size - step size used to quantize in unsigned Q0.16 format
+// bit_num - the number of bits
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in integer
+//
+//-----------------------------------------------------------------------------
+Word16 qnt_by_step(Word16 val, UWord16 step_size, Word16 bit_num)
+{
+ Word16 index, min_val, max_val;
+ Word16 q_index, shift, tmp;
+
+ shift = norm_s(step_size);
+
+ tmp = div_s(0x4000, shl(step_size, shift)); // Remark: To get result in Qxx.16 format it is necessary left shift tmp by (shift + 3)
+ q_index = shr_r(mult(val, tmp), sub(9, shift)); // q_index here is rounded to the nearest integer
+
+ max_val = 1 << (bit_num - 1);
+ min_val = negate(max_val);
+
+ if(q_index < min_val)
+ index = 0;
+ else if(q_index >= max_val)
+ index = (1 << bit_num) - 1;
+ else
+ index = max_val + q_index;
+
+ return index;
+}
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Quantize by table
+//
+//
+// INPUT:
+// val - value to be quantized
+// q_tbl - pointer to table
+// q_tbl_size - size of table
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in integer
+//
+//-----------------------------------------------------------------------------
+Word16 tbl_quant(Word16 val, Word16 *q_tbl, Word16 q_tbl_size)
+{
+ Word16 min_index, max_index, index;
+
+ min_index = 0;
+ max_index = q_tbl_size - 1;
+
+ if(val >= q_tbl[max_index])
+ return max_index;
+
+ if(val <= q_tbl[min_index])
+ return min_index;
+
+ while(max_index - min_index != 1)
+ {
+ index = min_index + ((max_index - min_index) >> 1);
+
+ if(q_tbl[index] > val)
+ max_index = index;
+ else
+ min_index = index;
+ }
+
+ if(q_tbl[max_index] - val <= val - q_tbl[min_index])
+ return max_index;
+ else
+ return min_index;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.h b/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.h
new file mode 100644
index 0000000..ee3ac1c
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/qnt_sub.h
@@ -0,0 +1,86 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _QNT_SUB
+#define _QNT_SUB
+
+
+#define CNST_0_5_Q0_16 0x8000
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Dequantize by quantizer step size
+//
+//
+// INPUT:
+// qval - quantized value
+// step_size - step size used to quantize in unsigned Q0.16 format
+// bit_num - the number of bits
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in signed (bit_num).16 format
+//
+//-----------------------------------------------------------------------------
+Word32 deqnt_by_step(Word16 qval, UWord16 step_size, Word16 bit_num);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Quantize by quantizer step size
+//
+//
+// INPUT:
+// val - value to be quantized
+// step_size - step size used to quantize in unsigned Q0.16 format
+// bit_num - the number of bits
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in integer
+//
+//-----------------------------------------------------------------------------
+Word16 qnt_by_step(Word16 val, UWord16 step_size, Word16 bit_num);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Quantize by table
+//
+//
+// INPUT:
+// val - value to be quantized
+// q_tbl - pointer to table
+// q_tbl_size - size of table
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Quantized Value in integer
+//
+//-----------------------------------------------------------------------------
+Word16 tbl_quant(Word16 val, Word16 *q_tbl, Word16 q_tbl_size);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.cc
new file mode 100644
index 0000000..b818d64
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.cc
@@ -0,0 +1,61 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+
+#include "typedef.h"
+#include "basic_op.h"
+
+static UWord32 seed = 1;
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Generate pseudo-random numbers in range -1...1
+//
+//
+// INPUT:
+// None
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Pseudo-random number in signed Q1.16 format
+//
+//-----------------------------------------------------------------------------
+Word16 rand_gen(void)
+{
+ UWord32 hi, lo;
+
+ lo = 16807 * (seed & 0xFFFF);
+ hi = 16807 * (seed >> 16);
+
+ lo += (Word32)(hi & 0x7FFF) << 16;
+ lo += (hi >> 15);
+
+ if(lo > 0x7FFFFFFF)
+ lo -= 0x7FFFFFFF;
+
+ seed = lo;
+
+ return (Word16)lo;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.h b/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.h
new file mode 100644
index 0000000..f67d15e
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/rand_gen.h
@@ -0,0 +1,44 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _RAND_GEN
+#define _RAND_GEN
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Generate pseudo-random numbers in range -1...1
+//
+//
+// INPUT:
+// None
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Pseudo-random number in signed Q1.16 format
+//
+//-----------------------------------------------------------------------------
+Word16 rand_gen(void);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.cc
new file mode 100644
index 0000000..27c30aa
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.cc
@@ -0,0 +1,200 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "tbls.h"
+#include "qnt_sub.h"
+#include "sa_decode.h"
+#include "aux_sub.h"
+#include "dsp_sub.h"
+#include "math_sub.h"
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Initialization of Spectral Amplitude Decoder
+//
+//
+// INPUT:
+// None
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+void imbe_vocoder::sa_decode_init(void)
+{
+ num_harms_prev1 = 30;
+ v_zap((Word16 *)sa_prev1, 2 * (NUM_HARMS_MAX + 2));
+}
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform Spectral Amplitude Decoding
+//
+//
+// INPUT:
+// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with
+// valid num_harms and b_vec items
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Decoded Spectral Amplitudes
+//
+//-----------------------------------------------------------------------------
+void imbe_vocoder::sa_decode(IMBE_PARAM *imbe_param)
+{
+ Word16 gain_vec[6], gain_r[6];
+ UWord16 index, index_1, num_harms;
+ Word16 *gss_ptr, *ba_ptr, i, j, *t_vec_ptr, *b_vec_ptr;
+ Word16 t_vec[NUM_HARMS_MAX], c_vec[MAX_BLOCK_LEN];
+ Word32 lmprbl_item;
+ Word16 bl_len, step_size, num_bits, tmp, ro_coef, si_coef, tmp1;
+ UWord32 k_coef, k_acc;
+ Word32 sum, tmp_word32, sa_tmp[NUM_HARMS_MAX];
+ Word16 *sa;
+
+ num_harms = imbe_param->num_harms;
+ index = num_harms - NUM_HARMS_MIN;
+ ba_ptr = imbe_param->bit_alloc;
+ b_vec_ptr = &imbe_param->b_vec[2];
+ sa = imbe_param->sa;
+
+ // Decoding the Gain Vector. gain_vec has signed Q5.11 format
+ gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5];
+ gain_vec[0] = gain_qnt_tbl[*b_vec_ptr++];
+
+ for(i = 1; i < 6; i++)
+ gain_vec[i] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr++, *gss_ptr++, *ba_ptr++), 5));
+ idct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r);
+
+ lmprbl_item = lmprbl_tbl[index];
+ v_zap(t_vec, NUM_HARMS_MAX);
+
+ // Decoding the Higher Order DCT Coefficients
+ t_vec_ptr = t_vec;
+ for(i = 0; i < NUM_PRED_RES_BLKS; i++)
+ {
+ bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4;
+ v_zap(c_vec, MAX_BLOCK_LEN);
+ c_vec[0] = gain_r[i];
+ for(j = 1; j < bl_len; j++)
+ {
+ num_bits = *ba_ptr++;
+ if(num_bits)
+ {
+ step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1);
+ c_vec[j] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr, step_size, num_bits), 5));
+ }
+ else
+ c_vec[j] = 0;
+
+ b_vec_ptr++;
+ }
+ idct(c_vec, bl_len, bl_len, t_vec_ptr);
+ t_vec_ptr += bl_len;
+ }
+
+ // Calculate num_harms_prev/num_harms. Result save in unsigned format Q8.24
+ if(num_harms == num_harms_prev1)
+ k_coef = (Word32)CNST_ONE_Q8_24;
+ else if(num_harms > num_harms_prev1)
+ k_coef = (Word32)div_s(num_harms_prev1 << 9, num_harms << 9) << 9;
+ else
+ {
+ // imbe_param->num_harms < num_harms_prev1
+ k_coef = 0;
+ tmp = num_harms_prev1;
+ while(tmp > num_harms)
+ {
+ tmp -= num_harms;
+ k_coef += (Word32)CNST_ONE_Q8_24;
+ }
+ k_coef += (Word32)div_s(tmp << 9, num_harms << 9) << 9;
+ }
+
+ if(num_harms <= 15)
+ ro_coef = CNST_0_4_Q1_15;
+ else if(num_harms <= 24)
+ ro_coef = num_harms * CNST_0_03_Q1_15 - CNST_0_05_Q1_15;
+ else
+ ro_coef = CNST_0_7_Q1_15;
+
+ k_acc = k_coef;
+ sum = 0;
+
+ for(i = num_harms_prev1 + 1; i < NUM_HARMS_MAX + 2; i++)
+ sa_prev1[i] = sa_prev1[num_harms_prev1];
+
+ for(i = 0; i < num_harms; i++)
+ {
+ index = (UWord16)(k_acc >> 24); // Get integer part
+ si_coef = (Word16)((k_acc - ((UWord32)index << 24)) >> 9); // Get fractional part
+
+ if(si_coef == 0)
+ {
+ tmp_word32 = L_mpy_ls(sa_prev1[index], ro_coef); // sa_prev1 here is in Q10.22 format
+ sa_tmp[i] = L_add(L_shr(L_deposit_h(t_vec[i]), 5), tmp_word32); // Convert t_vec to Q10.22 and add ...
+ sum = L_add(sum, sa_prev1[index]); // sum in Q10.22 format
+ }
+ else
+ {
+ index_1 = index + 1;
+ tmp_word32 = L_mpy_ls(sa_prev1[index], sub(0x7FFF, si_coef));
+ sum = L_add(sum, tmp_word32);
+ sa_tmp[i] = L_add(L_shr(L_deposit_h(t_vec[i]), 5), L_mpy_ls(tmp_word32, ro_coef));
+
+ tmp_word32 = L_mpy_ls(sa_prev1[index_1], si_coef);
+ sum = L_add(sum, tmp_word32);
+ sa_tmp[i] = L_add(sa_tmp[i], L_mpy_ls(tmp_word32, ro_coef));
+ }
+
+ k_acc += k_coef;
+ }
+
+ imbe_param->div_one_by_num_harm_sh = tmp = norm_s(num_harms);
+ imbe_param->div_one_by_num_harm = tmp1 = div_s(0x4000, num_harms << tmp); // calculate 1/num_harms with scaling for better pricision
+ // save result to use late
+
+ sum = L_shr(L_mpy_ls(L_mpy_ls(sum, ro_coef), tmp1), (14 - tmp));
+
+ for(i = 1; i <= num_harms; i++)
+ {
+ sa_prev1[i] = L_sub(sa_tmp[i - 1], sum);
+ sa[i - 1] = Pow2(sa_prev1[i]);
+ }
+
+ num_harms_prev1 = num_harms;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.h
new file mode 100644
index 0000000..88d1e33
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_decode.h
@@ -0,0 +1,64 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _SA_DECODE
+#define _SA_DECODE
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Initialization of Spectral Amplitude Decoder
+//
+//
+// INPUT:
+// None
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// None
+//
+//-----------------------------------------------------------------------------
+#if 0
+void sa_decode_init(void);
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform Spectral Amplitude Decoding
+//
+//
+// INPUT:
+// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with
+// valid num_harms and b_vec items
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Decoded Spectral Amplitudes
+//
+//-----------------------------------------------------------------------------
+void sa_decode(IMBE_PARAM *imbe_param);
+#endif
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.cc
new file mode 100644
index 0000000..7553f74
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.cc
@@ -0,0 +1,296 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "globals.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "tbls.h"
+#include "qnt_sub.h"
+#include "sa_encode.h"
+#include "aux_sub.h"
+#include "dsp_sub.h"
+#include "math_sub.h"
+
+#include <stdio.h>
+#include <math.h>
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+
+void imbe_vocoder::sa_encode_init(void)
+{
+ Word16 i;
+ num_harms_prev2 = 30;
+ for(i = 0; i < NUM_HARMS_MAX + 2; i++)
+ sa_prev2[i] = 0;
+}
+
+void imbe_vocoder::sa_encode(IMBE_PARAM *imbe_param)
+{
+ Word16 gain_vec[6], gain_r[6];
+ UWord16 index, i, j, num_harms;
+ Word16 *ba_ptr, *t_vec_ptr, *b_vec_ptr, *gss_ptr, *sa_ptr;
+ Word16 t_vec[NUM_HARMS_MAX], c_vec[MAX_BLOCK_LEN];
+ Word32 lmprbl_item;
+ Word16 bl_len, step_size, num_bits, tmp, ro_coef, si_coef, tmp1;
+ UWord32 k_coef, k_acc;
+ Word32 sum, tmp_word32, vec32_tmp[NUM_HARMS_MAX], *vec32_ptr;
+
+ num_harms = imbe_param->num_harms;
+
+ // Calculate num_harms_prev2/num_harms. Result save in unsigned format Q8.24
+ if(num_harms == num_harms_prev2)
+ k_coef = (Word32)CNST_ONE_Q8_24;
+ else if(num_harms > num_harms_prev2)
+ k_coef = (Word32)div_s(num_harms_prev2 << 9, num_harms << 9) << 9;
+ else
+ {
+ // imbe_param->num_harms < num_harms_prev2
+ k_coef = 0;
+ tmp = num_harms_prev2;
+ while(tmp > num_harms)
+ {
+ tmp -= num_harms;
+ k_coef += (Word32)CNST_ONE_Q8_24;
+ }
+ k_coef += (Word32)div_s(tmp << 9, num_harms << 9) << 9;
+ }
+
+ // Calculate prediction coefficient
+ if(num_harms <= 15)
+ ro_coef = CNST_0_4_Q1_15;
+ else if(num_harms <= 24)
+ ro_coef = num_harms * CNST_0_03_Q1_15 - CNST_0_05_Q1_15;
+ else
+ ro_coef = CNST_0_7_Q1_15;
+
+ for(i = num_harms_prev2 + 1; i < NUM_HARMS_MAX + 2; i++)
+ sa_prev2[i] = sa_prev2[num_harms_prev2];
+
+ k_acc = k_coef;
+ sum = 0;
+ sa_ptr = imbe_param->sa;
+ vec32_ptr = vec32_tmp;
+ for(i = 0; i < num_harms; i++)
+ {
+ index = (UWord16)(k_acc >> 24); // Get integer part
+ si_coef = (Word16)((k_acc - ((UWord32)index << 24)) >> 9); // Get fractional part
+
+
+ if(si_coef == 0)
+ {
+ tmp_word32 = L_mpy_ls(sa_prev2[index], ro_coef); // sa_prev2 here is in Q10.22 format
+ *vec32_ptr++ = L_sub(Log2(*sa_ptr++), tmp_word32);
+ sum = L_add(sum, sa_prev2[index]); // sum in Q10.22 format
+ }
+ else
+ {
+ tmp_word32 = L_mpy_ls(sa_prev2[index], sub(0x7FFF, si_coef));
+ sum = L_add(sum, tmp_word32);
+ *vec32_ptr = L_sub(Log2(*sa_ptr++), L_mpy_ls(tmp_word32, ro_coef));
+
+ tmp_word32 = L_mpy_ls(sa_prev2[index + 1], si_coef);
+ sum = L_add(sum, tmp_word32);
+ *vec32_ptr = L_sub(*vec32_ptr, L_mpy_ls(tmp_word32, ro_coef));
+
+ vec32_ptr++;
+ }
+
+ k_acc += k_coef;
+ }
+
+ imbe_param->div_one_by_num_harm_sh = tmp = norm_s(num_harms);
+ imbe_param->div_one_by_num_harm = tmp1 = div_s(0x4000, num_harms << tmp); // calculate 1/num_harms with scaling for better pricision
+ // save result to use late
+ sum = L_shr(L_mpy_ls(L_mpy_ls(sum, ro_coef), tmp1), (14 - tmp));
+
+ for(i = 0; i < num_harms; i++)
+ t_vec[i] = extract_h(L_shl(L_add(vec32_tmp[i], sum), 5)); // t_vec has Q5.11 format
+ //////////////////////////////////////////////
+ //
+ // Encode T vector
+ //
+ //////////////////////////////////////////////
+ index = num_harms - NUM_HARMS_MIN;
+
+ // Unpack bit allocation table's item
+ get_bit_allocation(num_harms, imbe_param->bit_alloc);
+ lmprbl_item = lmprbl_tbl[index];
+
+ // Encoding the Higher Order DCT Coefficients
+ t_vec_ptr = t_vec;
+ b_vec_ptr = &imbe_param->b_vec[8];
+ ba_ptr = &imbe_param->bit_alloc[5];
+ for(i = 0; i < NUM_PRED_RES_BLKS; i++)
+ {
+ bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4;
+
+ dct(t_vec_ptr, bl_len, bl_len, c_vec);
+ gain_vec[i] = c_vec[0];
+/*
+ for(j = 0; j < bl_len; j++)
+ printf("%g ", (double)t_vec_ptr[j]/2048.);
+ printf("\n");
+ for(j = 0; j < bl_len; j++)
+ printf("%g ", (double)c_vec[j]/2048.);
+ printf("\n");
+ printf("\n");
+*/
+ for(j = 1; j < bl_len; j++)
+ {
+ num_bits = *ba_ptr++;
+ if(num_bits)
+ {
+ step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1);
+ *b_vec_ptr = qnt_by_step(c_vec[j], step_size, num_bits);
+ }
+ else
+ *b_vec_ptr = 0;
+
+ b_vec_ptr++;
+ }
+ t_vec_ptr += bl_len;
+ }
+
+ // Encoding the Gain Vector
+ dct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r);
+
+ b_vec_ptr = &imbe_param->b_vec[2];
+ ba_ptr = &imbe_param->bit_alloc[0];
+ gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5];
+
+ *b_vec_ptr++ = tbl_quant(gain_r[0], (Word16 *)&gain_qnt_tbl[0], GAIN_QNT_TBL_SIZE);
+ for(j = 1; j < 6; j++)
+ *b_vec_ptr++ = qnt_by_step(gain_r[j], *gss_ptr++, *ba_ptr++);
+
+/*
+ for(j = 0; j < NUM_PRED_RES_BLKS; j++)
+ printf("%g ", (double)gain_vec[j]/2048.);
+ printf("\n");
+ for(j = 0; j < NUM_PRED_RES_BLKS; j++)
+ printf("%g ", (double)gain_r[j]/2048.);
+ printf("\n");
+ printf("\n");
+*/
+
+
+
+ //////////////////////////////////////////////
+ //
+ // Decode T vector
+ //
+ //////////////////////////////////////////////
+ ba_ptr = imbe_param->bit_alloc;
+ b_vec_ptr = &imbe_param->b_vec[2];
+
+ // Decoding the Gain Vector. gain_vec has signed Q5.11 format
+ gss_ptr = (Word16 *)&gain_step_size_tbl[index * 5];
+ gain_vec[0] = gain_qnt_tbl[*b_vec_ptr++];
+
+ for(i = 1; i < 6; i++)
+ gain_vec[i] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr++, *gss_ptr++, *ba_ptr++), 5));
+/*
+ printf("gain deqnt\n");
+ for(j = 0; j < 6; j++)
+ printf("%g ", (double)gain_vec[j]/2048.);
+ printf("\n");
+*/
+ idct(gain_vec, NUM_PRED_RES_BLKS, NUM_PRED_RES_BLKS, gain_r);
+
+ v_zap(t_vec, NUM_HARMS_MAX);
+ lmprbl_item = lmprbl_tbl[index];
+
+ // Decoding the Higher Order DCT Coefficients
+ t_vec_ptr = t_vec;
+ for(i = 0; i < NUM_PRED_RES_BLKS; i++)
+ {
+ bl_len = (lmprbl_item >> 28) & 0xF; lmprbl_item <<= 4;
+ v_zap(c_vec, MAX_BLOCK_LEN);
+ c_vec[0] = gain_r[i];
+ for(j = 1; j < bl_len; j++)
+ {
+ num_bits = *ba_ptr++;
+ if(num_bits)
+ {
+ step_size = extract_h(((Word32)hi_ord_std_tbl[j - 1] * hi_ord_step_size_tbl[num_bits - 1]) << 1);
+ c_vec[j] = extract_l(L_shr(deqnt_by_step(*b_vec_ptr, step_size, num_bits), 5));
+ }
+ else
+ c_vec[j] = 0;
+
+ b_vec_ptr++;
+ }
+/*
+ printf("\n");
+ for(j = 0; j < bl_len; j++)
+ printf("%g ", (double)c_vec[j]/2048.);
+ printf("\n");
+*/
+ idct(c_vec, bl_len, bl_len, t_vec_ptr);
+ t_vec_ptr += bl_len;
+ }
+/*
+ printf("\n====t_vec_rec ===\n");
+ for(j = 0; j < num_harms; j++)
+ printf("%g ", (double)t_vec[j]/2048.);
+ printf("\n");
+*/
+ //////////////////////////////////////////////
+ //
+ // Reconstruct Spectral Amplitudes
+ //
+ //////////////////////////////////////////////
+ k_acc = k_coef;
+ vec32_ptr = vec32_tmp;
+
+ for(i = num_harms_prev2 + 1; i < NUM_HARMS_MAX + 2; i++)
+ sa_prev2[i] = sa_prev2[num_harms_prev2];
+
+ for(i = 0; i < num_harms; i++)
+ {
+ index = (UWord16)(k_acc >> 24); // Get integer part
+ si_coef = (Word16)((k_acc - ((UWord32)index << 24)) >> 9); // Get fractional part
+
+ if(si_coef == 0)
+ {
+ tmp_word32 = L_mpy_ls(sa_prev2[index], ro_coef); // sa_prev2 here is in Q10.22 format
+ *vec32_ptr++ = L_add(L_shr(L_deposit_h(t_vec[i]), 5), tmp_word32); // Convert t_vec to Q10.22 and add ...
+ }
+ else
+ {
+ tmp_word32 = L_mpy_ls(sa_prev2[index], sub(0x7FFF, si_coef));
+ *vec32_ptr = L_add(L_shr(L_deposit_h(t_vec[i]), 5), L_mpy_ls(tmp_word32, ro_coef));
+
+ tmp_word32 = L_mpy_ls(sa_prev2[index + 1], si_coef);
+ *vec32_ptr = L_add(*vec32_ptr, L_mpy_ls(tmp_word32, ro_coef));
+
+ vec32_ptr++;
+ }
+
+ k_acc += k_coef;
+ }
+
+ for(i = 1; i <= num_harms; i++)
+ sa_prev2[i] = L_sub(vec32_tmp[i - 1], sum);
+
+ num_harms_prev2 = num_harms;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.h b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.h
new file mode 100644
index 0000000..06e4145
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_encode.h
@@ -0,0 +1,30 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _SA_ENCODE
+#define _SA_ENCODE
+
+
+void sa_encode_init(void);
+void sa_encode(IMBE_PARAM *imbe_param);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.cc
new file mode 100644
index 0000000..c6586eb
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.cc
@@ -0,0 +1,202 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "qnt_sub.h"
+#include "aux_sub.h"
+#include "math_sub.h"
+#include "sa_enh.h"
+
+
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform Spectral Amplitude Enhancement
+//
+//
+// INPUT:
+// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with
+// valid num_harms, sa and fund_freq items
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Enhanced Spectral Amplitudes
+//
+//-----------------------------------------------------------------------------
+void sa_enh(IMBE_PARAM *imbe_param)
+{
+ Word16 *sa, num_harm, sa_tmp[NUM_HARMS_MAX], nm;
+ Word16 cos_w[NUM_HARMS_MAX], i, tmp;
+ Word32 L_tmp, Rm0, Rm1;
+ Word32 w0, cos_acc;
+ Word32 L_den, L_num, L_Rm0_2, L_Rm1_2, L_sum_Rm02_Rm12, L_sum_mod;
+ Word16 Rm0Rm1, nm1, nm2, tot_nm;
+ Word16 Rm0_s, Rm1_s;
+
+
+ sa = imbe_param->sa;
+ num_harm = imbe_param->num_harms;
+
+ v_equ(sa_tmp, sa, num_harm);
+
+ Rm0 = L_v_magsq(sa, num_harm);
+
+ if(Rm0 == 0)
+ return;
+
+ nm = norm_l (Rm0);
+ if(Rm0 == MAX_32)
+ {
+ nm = 1;
+ v_equ_shr(sa_tmp, sa, nm, num_harm);
+ Rm0 = L_v_magsq(sa_tmp, num_harm);
+ }
+ else
+ {
+ if(nm > 2)
+ {
+ nm = -(nm >> 1);
+ v_equ_shr(sa_tmp, sa, nm, num_harm);
+ Rm0 = L_v_magsq(sa_tmp, num_harm);
+ }
+ }
+
+ w0 = imbe_param->fund_freq;
+
+ cos_acc = 0; Rm1 = 0;
+ for(i = 0; i < num_harm; i++)
+ {
+ cos_acc = L_add(cos_acc, w0);
+
+ cos_w[i] = cos_fxp(extract_h(cos_acc));
+ Rm1 = L_add(Rm1, L_mpy_ls(L_mult(sa_tmp[i], sa_tmp[i]), cos_w[i]));
+ }
+
+ Rm0_s = extract_h(Rm0);
+ Rm1_s = extract_h(Rm1);
+
+ L_Rm0_2 = L_mult(Rm0_s, Rm0_s);
+ L_Rm1_2 = L_mult(Rm1_s, Rm1_s);
+ L_den = L_sub(L_Rm0_2, L_Rm1_2);
+ L_den = L_mult(extract_h(L_den), Rm0_s);
+ nm1 = norm_l(L_den);
+ L_den = L_shl(L_den, nm1);
+
+ nm2 = norm_l(w0);
+ L_den = L_mpy_ls(L_den, extract_h(L_shl(w0, nm2))); // Calculate w0 * Rm0 * (Rm0^2 - Rm1^2)
+ nm1 += nm2; // total denominator shift
+
+ if (L_den < 1) return; // fix bug infinite loop due to invalid input
+
+ L_sum_Rm02_Rm12 = L_add(L_shr(L_Rm0_2, 2), L_shr(L_Rm1_2, 2));
+ Rm0Rm1 = shr(mult_r(Rm0_s, Rm1_s), 1);
+
+ for(i = 0; i < num_harm; i++)
+ {
+ if((((i + 1) << 3) > num_harm) && (sa_tmp[i] != 0x0000))
+ {
+ L_num = L_sub(L_sum_Rm02_Rm12, L_mult(Rm0Rm1, cos_w[i]));
+ tot_nm = norm_l(L_num);
+ L_num = L_shl(L_num, tot_nm);
+ while(L_num >= L_den)
+ {
+ L_num = L_shr(L_num, 1);
+ tot_nm -= 1;
+ }
+
+ tmp = div_s(extract_h(L_num), extract_h(L_den));
+ tot_nm -= nm1;
+
+ L_tmp = L_mult(sa_tmp[i], sa_tmp[i]);
+ nm2 = norm_l(L_tmp);
+ L_tmp = L_shl(L_tmp, nm2);
+ L_tmp = L_mult(extract_h(L_tmp), tmp);
+ tot_nm += nm2;
+ tot_nm -= 2;
+
+ if(tot_nm <= 0)
+ {
+ L_tmp = L_shr(L_tmp, add(8, tot_nm));
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm);
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm);
+ L_tmp = L_mult(extract_h(L_tmp), CNST_0_9898_Q1_15);
+ tmp = extract_h(L_shl(L_tmp, 1));
+ }
+ else
+ {
+ if(tot_nm <= 8)
+ {
+ L_tmp = L_shr(L_tmp, tot_nm);
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm);
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm + 1);
+ tmp = mult(extract_h(L_tmp), CNST_0_9898_Q1_15);
+ }
+ else
+ {
+ nm1 = tot_nm & 0xFFFE;
+ L_tmp = L_shr(L_tmp, tot_nm - nm1);
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm);
+ tot_nm = nm1 >> 1;
+
+ nm1 = tot_nm & 0xFFFE;
+ L_tmp = L_shr(L_tmp, tot_nm - nm1);
+ L_tmp = sqrt_l_exp(L_tmp, &tot_nm);
+ L_tmp = L_shr(L_tmp, tot_nm);
+ L_tmp = L_mult(extract_h(L_tmp), CNST_0_9898_Q1_15);
+ tot_nm = nm1 >> 1;
+ tmp = extract_h(L_shr(L_tmp, tot_nm + 1));
+ }
+ }
+
+ if(tmp > CNST_1_2_Q2_14)
+ sa[i] = extract_h(L_shl(L_mult(sa[i], CNST_1_2_Q2_14), 1));
+ else if(tmp < CNST_0_5_Q2_14)
+ sa[i] = shr(sa[i], 1);
+ else
+ sa[i] = extract_h(L_shl(L_mult(sa[i], tmp), 1));
+ }
+ }
+
+ // Compute the correct scale factor
+ v_equ_shr(sa_tmp, sa, nm, num_harm);
+ L_sum_mod = L_v_magsq(sa_tmp, num_harm);
+ if(L_sum_mod > Rm0)
+ {
+ tmp = div_s(extract_h(Rm0), extract_h(L_sum_mod));
+ L_tmp = sqrt_l_exp(L_deposit_h(tmp), &tot_nm);
+ tmp = shr(extract_h(L_tmp), tot_nm);
+ for(i = 0; i < num_harm; i++)
+ sa[i] = mult_r(sa[i], tmp);
+ }
+}
+
+
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.h b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.h
new file mode 100644
index 0000000..6b3f277
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/sa_enh.h
@@ -0,0 +1,50 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _SA_ENH
+#define _SA_ENH
+
+#define CNST_0_9898_Q1_15 0x7EB3
+#define CNST_0_5_Q2_14 0x2000
+#define CNST_1_2_Q2_14 0x4CCC
+
+
+//-----------------------------------------------------------------------------
+// PURPOSE:
+// Perform Spectral Amplitude Enhancement
+//
+//
+// INPUT:
+// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with
+// valid num_harms, sa and fund_freq items
+//
+// OUTPUT:
+// None
+//
+// RETURN:
+// Enhanced Spectral Amplitudes
+//
+//-----------------------------------------------------------------------------
+void sa_enh(IMBE_PARAM *imbe_param);
+
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.cc
new file mode 100644
index 0000000..fb9ccf8
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.cc
@@ -0,0 +1,368 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+#include "typedef.h"
+#include "tbls.h"
+
+
+//-----------------------------------------------------------------------------
+//
+// Bit allocation and ancillary tables
+//
+//-----------------------------------------------------------------------------
+const Word16 bit_allocation_tbl[] =
+{
+ 0xA999, 0x9987,
+ 0x9988, 0x8976, 0x5000,
+ 0x8887, 0x7976, 0x5400,
+ 0x8777, 0x7876, 0x5430,
+ 0x7776, 0x6776, 0x5433,
+ 0x7666, 0x6775, 0x4434, 0x3000,
+ 0x7666, 0x5675, 0x4433, 0x3300,
+ 0x6665, 0x5665, 0x4433, 0x3320,
+ 0x6655, 0x5555, 0x4443, 0x3232,
+ 0x6555, 0x5545, 0x5433, 0x3322, 0x2000,
+ 0x6554, 0x4545, 0x4433, 0x3323, 0x2100,
+ 0x6554, 0x4545, 0x4433, 0x2321, 0x3210,
+ 0x5554, 0x4445, 0x4433, 0x2232, 0x1321,
+ 0x5544, 0x4444, 0x4432, 0x3223, 0x2122, 0x1000,
+ 0x5444, 0x4434, 0x4343, 0x2322, 0x2212, 0x2100,
+ 0x5444, 0x4433, 0x4333, 0x3232, 0x1221, 0x2210,
+ 0x5444, 0x3433, 0x4333, 0x3232, 0x1221, 0x2111,
+ 0x5443, 0x3433, 0x4333, 0x2232, 0x1221, 0x1221, 0x1000,
+ 0x5443, 0x3432, 0x4323, 0x2232, 0x2122, 0x1122, 0x1100,
+ 0x4443, 0x3432, 0x4323, 0x2223, 0x2112, 0x2112, 0x1110,
+ 0x4443, 0x3332, 0x4322, 0x3222, 0x3211, 0x2111, 0x2111,
+ 0x4443, 0x3332, 0x2332, 0x2322, 0x1321, 0x1211, 0x1211, 0x1000,
+ 0x4433, 0x3332, 0x2332, 0x2322, 0x1221, 0x1211, 0x1211, 0x1100,
+ 0x4433, 0x3332, 0x2332, 0x2322, 0x1221, 0x1211, 0x1121, 0x1100,
+ 0x4333, 0x3332, 0x2332, 0x2321, 0x1221, 0x1121, 0x1112, 0x1111,
+ 0x4333, 0x3322, 0x2322, 0x2322, 0x1122, 0x1112, 0x1111, 0x2111, 0x0000,
+ 0x4333, 0x3322, 0x2322, 0x2232, 0x1112, 0x2111, 0x2111, 0x0211, 0x1000,
+ 0x4333, 0x3322, 0x2132, 0x2213, 0x2111, 0x2211, 0x1211, 0x1021, 0x1100,
+ 0x4333, 0x2322, 0x2132, 0x2223, 0x2111, 0x2111, 0x1211, 0x1021, 0x1110,
+ 0x4333, 0x2322, 0x2132, 0x2213, 0x2111, 0x2111, 0x1211, 0x1102, 0x1111, 0x0000,
+ 0x4333, 0x2322, 0x2132, 0x2213, 0x2111, 0x2211, 0x1021, 0x1110, 0x2111, 0x0000,
+ 0x4333, 0x2322, 0x2132, 0x2113, 0x2111, 0x1221, 0x1102, 0x1111, 0x0211, 0x1000,
+ 0x4332, 0x2322, 0x1132, 0x2211, 0x3211, 0x1122, 0x1110, 0x2111, 0x1021, 0x1100,
+ 0x4332, 0x2322, 0x2113, 0x2221, 0x1221, 0x1112, 0x2111, 0x0211, 0x1002, 0x1110, 0x0000,
+ 0x4332, 0x2322, 0x2113, 0x2221, 0x1221, 0x1112, 0x1111, 0x0211, 0x1002, 0x1111, 0x0000,
+ 0x4332, 0x2322, 0x1113, 0x2221, 0x1221, 0x1112, 0x1111, 0x0211, 0x1100, 0x2111, 0x1000,
+ 0x4332, 0x2322, 0x1113, 0x2211, 0x1221, 0x1112, 0x2111, 0x0021, 0x1110, 0x0211, 0x1100,
+ 0x3332, 0x2322, 0x1113, 0x2211, 0x1221, 0x1111, 0x2211, 0x1002, 0x1111, 0x0021, 0x1110, 0x0000,
+ 0x3332, 0x2322, 0x1113, 0x2211, 0x1122, 0x1111, 0x1221, 0x1100, 0x2111, 0x1002, 0x1110, 0x0000,
+ 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1122, 0x1110, 0x0211, 0x1000, 0x2111, 0x0000,
+ 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1022, 0x1110, 0x0211, 0x1000, 0x2111, 0x1000,
+ 0x3332, 0x2322, 0x1111, 0x3221, 0x1112, 0x2111, 0x1022, 0x1110, 0x0211, 0x1100, 0x0211, 0x1000, 0x0000,
+ 0x3332, 0x2322, 0x1111, 0x3211, 0x1112, 0x2111, 0x1022, 0x1110, 0x0021, 0x1110, 0x0021, 0x1110, 0x0000,
+ 0x3322, 0x2321, 0x1111, 0x3221, 0x1112, 0x2111, 0x1102, 0x2111, 0x0002, 0x1111, 0x0002, 0x1111, 0x0000,
+ 0x3322, 0x2321, 0x1111, 0x3221, 0x1111, 0x2211, 0x1110, 0x2211, 0x1000, 0x2111, 0x1000, 0x2111, 0x0000,
+ 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1100, 0x0211, 0x1000, 0x0000,
+ 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1000, 0x0211, 0x1100, 0x0000,
+ 0x3322, 0x2322, 0x1111, 0x0322, 0x1111, 0x0221, 0x1111, 0x0221, 0x1100, 0x0211, 0x1100, 0x0021, 0x1100, 0x0000
+};
+
+const Word16 bit_allocation_offset_tbl[] =
+{
+ 0x0002, 0x000E, 0x001E, 0x0032, 0x004A, 0x0066, 0x0086, 0x00AA, 0x00D2, 0x00FE, 0x012E, 0x0162
+};
+
+//-----------------------------------------------------------------------------
+//
+// Log Magnitude Prediction Residual Block Length
+//
+//-----------------------------------------------------------------------------
+const Word32 lmprbl_tbl[] =
+{
+ 0x11122200,
+ 0x11222200,
+ 0x12222200,
+ 0x22222200,
+ 0x22222300,
+ 0x22223300,
+ 0x22233300,
+ 0x22333300,
+ 0x23333300,
+ 0x33333300,
+ 0x33333400,
+ 0x33334400,
+ 0x33344400,
+ 0x33444400,
+ 0x34444400,
+ 0x44444400,
+ 0x44444500,
+ 0x44445500,
+ 0x44455500,
+ 0x44555500,
+ 0x45555500,
+ 0x55555500,
+ 0x55555600,
+ 0x55556600,
+ 0x55566600,
+ 0x55666600,
+ 0x56666600,
+ 0x66666600,
+ 0x66666700,
+ 0x66667700,
+ 0x66677700,
+ 0x66777700,
+ 0x67777700,
+ 0x77777700,
+ 0x77777800,
+ 0x77778800,
+ 0x77788800,
+ 0x77888800,
+ 0x78888800,
+ 0x88888800,
+ 0x88888900,
+ 0x88889900,
+ 0x88899900,
+ 0x88999900,
+ 0x89999900,
+ 0x99999900,
+ 0x99999A00,
+ 0x9999AA00
+};
+
+
+
+//-----------------------------------------------------------------------------
+//
+// Gain Quantizer Levels in signed Q5.11 format
+//
+//-----------------------------------------------------------------------------
+const Word16 gain_qnt_tbl[] =
+{
+ -5821, -5518, -5239, -4880, -4549, -4292, -4057, -3760, -3370, -2903,
+ -2583, -2305, -1962, -1601, -1138, -711, -302, 57, 433, 795,
+ 1132, 1510, 1909, 2333, 2705, 3038, 3376, 3689, 3979, 4339,
+ 4754, 5129, 5435, 5695, 5991, 6300, 6596, 6969, 7342, 7751,
+ 8101, 8511, 8835, 9102, 9375, 9698, 10055, 10415, 10762, 11084,
+ 11403, 11752, 12123, 12468, 12863, 13239, 13615, 13997, 14382, 14770,
+ 15301, 15849, 16640, 17809
+};
+
+
+//-----------------------------------------------------------------------------
+//
+// Gain Ste Size in unsigned Q0.16 format
+//
+//-----------------------------------------------------------------------------
+const UWord16 gain_step_size_tbl[] =
+{
+ 203, 263, 220, 190, 173,
+ 406, 263, 440, 380, 346,
+ 813, 527, 440, 760, 692,
+ 813, 1054, 881, 760, 692,
+ 1625, 1054, 881, 1425, 1298,
+ 1625, 1976, 1652, 1425, 1298,
+ 1625, 1976, 1652, 1425, 2422,
+ 3047, 1976, 1652, 2661, 2422,
+ 3047, 1976, 3083, 2661, 2422,
+ 3047, 3688, 3083, 2661, 2422,
+ 3047, 3688, 3083, 3801, 3460,
+ 3047, 3688, 3083, 3801, 3460,
+ 5689, 3688, 3083, 3801, 3460,
+ 5689, 3688, 4404, 3801, 3460,
+ 5689, 5269, 4404, 3801, 3460,
+ 5689, 5269, 4404, 3801, 3460,
+ 5689, 5269, 4404, 3801, 5623,
+ 5689, 5269, 4404, 6177, 5623,
+ 5689, 5269, 4404, 6177, 5623,
+ 8126, 5269, 4404, 6177, 5623,
+ 8126, 5269, 4404, 6177, 5623,
+ 8126, 5269, 4404, 6177, 5623,
+ 8126, 5269, 7157, 6177, 5623,
+ 8126, 5269, 7157, 6177, 5623,
+ 8126, 8562, 7157, 6177, 5623,
+ 8126, 8562, 7157, 6177, 5623,
+ 8126, 8562, 7157, 6177, 5623,
+ 8126, 8562, 7157, 6177, 5623,
+ 8126, 8562, 7157, 6177, 7353,
+ 8126, 8562, 7157, 6177, 7353,
+ 8126, 8562, 7157, 6177, 7353,
+ 8126, 8562, 7157, 6177, 7353,
+ 8126, 8562, 7157, 8077, 7353,
+ 8126, 8562, 7157, 8077, 7353,
+ 8126, 8562, 7157, 8077, 7353,
+ 8126, 8562, 7157, 8077, 7353,
+ 8126, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 7157, 8077, 7353,
+ 13206, 8562, 9359, 8077, 7353,
+ 13206, 8562, 9359, 8077, 7353,
+ 13206, 8562, 9359, 8077, 7353,
+ 13206, 8562, 9359, 8077, 7353,
+ 13206, 8562, 9359, 8077, 7353
+};
+
+
+//-----------------------------------------------------------------------------
+//
+// Standard Deviation of Higher Order DCT Coefficients in unsigned Q0.16 format
+//
+//-----------------------------------------------------------------------------
+const UWord16 hi_ord_std_tbl[] =
+{
+ 20120, 15794, 13566, 12452, 11731, 11338, 10813, 11141, 11141
+};
+
+//-----------------------------------------------------------------------------
+//
+// Quantizer Step for Higher Order DCT Coefficients in unsigned Q1.15 format
+//
+//-----------------------------------------------------------------------------
+const UWord16 hi_ord_step_size_tbl[] =
+{
+ 39322, 27853, 21299, 13107, 9175, 4915, 2621, 1311, 655, 328
+};
+
+//-----------------------------------------------------------------------------
+//
+// Speech Synthesis Window
+//
+//-----------------------------------------------------------------------------
+const Word16 ws[49] =
+{
+ 655, 1310, 1966, 2621, 3276, 3932, 4587, 5242, 5898, 6553,
+ 7208, 7864, 8519, 9175, 9830, 10485, 11141, 11796, 12451, 13107,
+ 13762, 14417, 15073, 15728, 16384, 17039, 17694, 18350, 19005, 19660,
+ 20316, 20971, 21626, 22282, 22937, 23592, 24248, 24903, 25559, 26214,
+ 26869, 27525, 28180, 28835, 29491, 30146, 30801, 31457, 32112
+};
+
+/*
+const Word16 ws_ws[49] =
+{
+
+ 17052, 17746, 18467, 19212, 19980, 20770, 21580, 22407, 23246, 24094,
+ 24945, 25793, 26631, 27453, 28248, 29008, 29724, 30385, 30983, 31507,
+ 31950, 32302, 32559, 32715, 32767, 32715, 32559, 32302, 31950, 31507,
+ 30983, 30385, 29724, 29008, 28248, 27453, 26631, 25793, 24945, 24094,
+ 23246, 22407, 21580, 20770, 19980, 19212, 18467, 17746, 17052
+};
+*/
+
+//-----------------------------------------------------------------------------
+//
+// Squared Pitch Estimation Window 64*wi^2
+//
+//-----------------------------------------------------------------------------
+const Word16 wi[301] =
+{
+ 15, 18, 21, 25, 29, 34, 40, 46, 52, 59,
+ 67, 76, 86, 96, 108, 120, 133, 148, 164, 180,
+ 199, 218, 239, 261, 285, 311, 338, 367, 398, 431,
+ 465, 502, 541, 582, 625, 671, 719, 769, 822, 878,
+ 936, 997, 1061, 1128, 1198, 1271, 1347, 1426, 1508, 1594,
+ 1683, 1775, 1871, 1970, 2073, 2179, 2289, 2403, 2520, 2641,
+ 2766, 2894, 3026, 3162, 3301, 3445, 3592, 3742, 3897, 4055,
+ 4216, 4382, 4551, 4723, 4899, 5078, 5261, 5447, 5636, 5828,
+ 6023, 6221, 6423, 6626, 6833, 7042, 7253, 7467, 7683, 7900,
+ 8120, 8341, 8564, 8788, 9014, 9241, 9468, 9696, 9925, 10154,
+ 10383, 10613, 10842, 11070, 11298, 11525, 11752, 11977, 12200, 12422,
+ 12642, 12860, 13076, 13289, 13500, 13708, 13912, 14114, 14312, 14506,
+ 14696, 14882, 15064, 15242, 15414, 15582, 15745, 15903, 16055, 16202,
+ 16343, 16478, 16608, 16731, 16848, 16958, 17062, 17159, 17250, 17333,
+ 17410, 17480, 17542, 17597, 17646, 17686, 17720, 17746, 17764, 17776,
+ 17779, 17776, 17764, 17746, 17720, 17686, 17646, 17597, 17542, 17480,
+ 17410, 17333, 17250, 17159, 17062, 16958, 16848, 16731, 16608, 16478,
+ 16343, 16202, 16055, 15903, 15745, 15582, 15414, 15242, 15064, 14882,
+ 14696, 14506, 14312, 14114, 13912, 13708, 13500, 13289, 13076, 12860,
+ 12642, 12422, 12200, 11977, 11752, 11525, 11298, 11070, 10842, 10613,
+ 10383, 10154, 9925, 9696, 9468, 9241, 9014, 8788, 8564, 8341,
+ 8120, 7900, 7683, 7467, 7253, 7042, 6833, 6626, 6423, 6221,
+ 6023, 5828, 5636, 5447, 5261, 5078, 4899, 4723, 4551, 4382,
+ 4216, 4055, 3897, 3742, 3592, 3445, 3301, 3162, 3026, 2894,
+ 2766, 2641, 2520, 2403, 2289, 2179, 2073, 1970, 1871, 1775,
+ 1683, 1594, 1508, 1426, 1347, 1271, 1198, 1128, 1061, 997,
+ 936, 878, 822, 769, 719, 671, 625, 582, 541, 502,
+ 465, 431, 398, 367, 338, 311, 285, 261, 239, 218,
+ 199, 180, 164, 148, 133, 120, 108, 96, 86, 76,
+ 67, 59, 52, 46, 40, 34, 29, 25, 21, 18,
+ 15
+};
+
+//-----------------------------------------------------------------------------
+//
+// Pitch Refinement Window
+//
+//-----------------------------------------------------------------------------
+const Word16 wr[] =
+{
+ 487, 570, 658, 753, 854, 962, 1076, 1197, 1325, 1460,
+ 1602, 1752, 1909, 2074, 2246, 2426, 2614, 2810, 3014, 3227,
+ 3447, 3675, 3912, 4157, 4410, 4671, 4941, 5219, 5505, 5799,
+ 6101, 6411, 6729, 7054, 7388, 7728, 8077, 8432, 8795, 9164,
+ 9541, 9923, 10312, 10707, 11108, 11515, 11927, 12344, 12766, 13192,
+ 13622, 14056, 14494, 14935, 15379, 15825, 16273, 16724, 17175, 17628,
+ 18081, 18534, 18988, 19440, 19892, 20342, 20790, 21237, 21680, 22120,
+ 22557, 22990, 23419, 23842, 24261, 24673, 25080, 25480, 25874, 26259,
+ 26638, 27008, 27370, 27722, 28066, 28400, 28724, 29037, 29340, 29632,
+ 29912, 30181, 30438, 30683, 30915, 31135, 31341, 31535, 31715, 31881,
+ 32033, 32172, 32296, 32406, 32502, 32583, 32649, 32701, 32738, 32760,
+};
+
+//-----------------------------------------------------------------------------
+//
+// Real Part Spectrum of Pitch Refinement Window * 256
+//
+//-----------------------------------------------------------------------------
+const Word16 wr_sp[] =
+{
+ 16, 43, 71, 102, 135, 170, 207, 247, 289, 333,
+ 380, 430, 483, 538, 596, 657, 721, 787, 857, 930,
+ 1006, 1085, 1168, 1254, 1343, 1435, 1531, 1630, 1733, 1840,
+ 1950, 2063, 2181, 2302, 2426, 2555, 2687, 2823, 2962, 3106,
+ 3253, 3404, 3559, 3718, 3881, 4047, 4218, 4392, 4570, 4751,
+ 4937, 5126, 5319, 5516, 5716, 5920, 6128, 6339, 6554, 6772,
+ 6994, 7219, 7447, 7679, 7914, 8152, 8393, 8637, 8884, 9134,
+ 9387, 9642, 9900, 10160, 10423, 10688, 10956, 11225, 11497, 11770,
+ 12045, 12322, 12601, 12881, 13162, 13444, 13728, 14012, 14298, 14584,
+ 14871, 15158, 15445, 15733, 16020, 16308, 16595, 16882, 17168, 17454,
+ 17738, 18022, 18305, 18586, 18866, 19145, 19421, 19696, 19969, 20240,
+ 20508, 20774, 21037, 21298, 21556, 21811, 22062, 22310, 22555, 22796,
+ 23033, 23267, 23496, 23722, 23943, 24159, 24372, 24579, 24782, 24980,
+ 25172, 25360, 25542, 25719, 25891, 26057, 26217, 26372, 26520, 26663,
+ 26800, 26930, 27055, 27173, 27285, 27390, 27489, 27581, 27667, 27746,
+ 27818, 27884, 27942, 27994, 28039, 28078, 28109, 28133, 28151, 28161,
+ 28165, 28161, 28151, 28133, 28109, 28078, 28039, 27994, 27942, 27884,
+ 27818, 27746, 27667, 27581, 27489, 27390, 27285, 27173, 27055, 26930,
+ 26800, 26663, 26520, 26372, 26217, 26057, 25891, 25719, 25542, 25360,
+ 25172, 24980, 24782, 24579, 24372, 24159, 23943, 23722, 23496, 23267,
+ 23033, 22796, 22555, 22310, 22062, 21811, 21556, 21298, 21037, 20774,
+ 20508, 20240, 19969, 19696, 19421, 19145, 18866, 18586, 18305, 18022,
+ 17738, 17454, 17168, 16882, 16595, 16308, 16020, 15733, 15445, 15158,
+ 14871, 14584, 14298, 14012, 13728, 13444, 13162, 12881, 12601, 12322,
+ 12045, 11770, 11497, 11225, 10956, 10688, 10423, 10160, 9900, 9642,
+ 9387, 9134, 8884, 8637, 8393, 8152, 7914, 7679, 7447, 7219,
+ 6994, 6772, 6554, 6339, 6128, 5920, 5716, 5516, 5319, 5126,
+ 4937, 4751, 4570, 4392, 4218, 4047, 3881, 3718, 3559, 3404,
+ 3253, 3106, 2962, 2823, 2687, 2555, 2426, 2302, 2181, 2063,
+ 1950, 1840, 1733, 1630, 1531, 1435, 1343, 1254, 1168, 1085,
+ 1006, 930, 857, 787, 721, 657, 596, 538, 483, 430,
+ 380, 333, 289, 247, 207, 170, 135, 102, 71, 43,
+ 16
+};
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.h b/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.h
new file mode 100644
index 0000000..f83387b
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/tbls.h
@@ -0,0 +1,99 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _TBLS
+#define _TBLS
+
+
+//-----------------------------------------------------------------------------
+//
+// Bit allocation and ancillary tables
+//
+//-----------------------------------------------------------------------------
+extern const Word16 bit_allocation_tbl[];
+extern const Word16 bit_allocation_offset_tbl[];
+
+//-----------------------------------------------------------------------------
+//
+// Log Magnitude Prediction Residual Block Length
+//
+//-----------------------------------------------------------------------------
+extern const Word32 lmprbl_tbl[];
+
+//-----------------------------------------------------------------------------
+//
+// Gain Quantizer Levels in Q5.11 format
+//
+//-----------------------------------------------------------------------------
+extern const Word16 gain_qnt_tbl[];
+#define GAIN_QNT_TBL_SIZE 64
+
+//-----------------------------------------------------------------------------
+//
+// Gain Ste Size in unsigned Q0.16 format
+//
+//-----------------------------------------------------------------------------
+extern const UWord16 gain_step_size_tbl[];
+
+//-----------------------------------------------------------------------------
+//
+// Standard Deviation of Higher Order DCT Coefficients in unsigned Q0.16 format
+//
+//-----------------------------------------------------------------------------
+extern const UWord16 hi_ord_std_tbl[];
+
+//-----------------------------------------------------------------------------
+//
+// Quantizer Step for Higher Order DCT Coefficients in unsigned Q1.15 format
+//
+//-----------------------------------------------------------------------------
+extern const UWord16 hi_ord_step_size_tbl[];
+
+//-----------------------------------------------------------------------------
+//
+// Speech Synthesis Window
+//
+//-----------------------------------------------------------------------------
+extern const Word16 ws[];
+
+//-----------------------------------------------------------------------------
+//
+// Squared Pitch Estimation Window 64*wi^2
+//
+//-----------------------------------------------------------------------------
+extern const Word16 wi[];
+
+//-----------------------------------------------------------------------------
+//
+// Pitch Refinement Window
+//
+//-----------------------------------------------------------------------------
+extern const Word16 wr[];
+
+//-----------------------------------------------------------------------------
+//
+// Real Part Spectrum of Pitch Refinement Window * 256
+//
+//-----------------------------------------------------------------------------
+extern const Word16 wr_sp[];
+
+#endif
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/typedef.h b/op25/gr-op25_repeater/lib/imbe_vocoder/typedef.h
new file mode 100644
index 0000000..c62c4c7
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/typedef.h
@@ -0,0 +1,74 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+/*
+********************************************************************************
+*
+* GSM AMR speech codec Version 7.4.0 January 31, 2000
+*
+********************************************************************************
+*
+* File : typedef.c
+* Purpose : Basic types.
+*
+********************************************************************************
+*/
+#ifndef typedef_h
+#define typedef_h "$Id $"
+
+#undef ORIGINAL_TYPEDEF_H /* define to get "original" ETSI version
+ of typedef.h */
+
+#ifdef ORIGINAL_TYPEDEF_H
+/*
+ * this is the original code from the ETSI file typedef.h
+ */
+
+#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__)
+typedef signed char Word8;
+typedef short Word16;
+typedef long Word32;
+typedef int Flag;
+
+#elif defined(__sun)
+typedef signed char Word8;
+typedef short Word16;
+typedef long Word32;
+typedef int Flag;
+
+#elif defined(__unix__) || defined(__unix)
+typedef signed char Word8;
+typedef short Word16;
+typedef int Word32;
+typedef int Flag;
+
+#endif
+#else /* not original typedef.h */
+
+/*
+ * use (improved) type definition file typdefs.h and add a "Flag" type
+ */
+#include "typedefs.h"
+typedef int Flag;
+
+#endif
+
+#endif
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/typedefs.h b/op25/gr-op25_repeater/lib/imbe_vocoder/typedefs.h
new file mode 100644
index 0000000..d86550b
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/typedefs.h
@@ -0,0 +1,201 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+/*
+********************************************************************************
+*
+* GSM AMR speech codec Version 7.4.0 January 31, 2000
+*
+********************************************************************************
+*
+* File : typedefs.h
+* Description : Definition of platform independent data
+* types and constants
+*
+*
+* The following platform independent data types and corresponding
+* preprocessor (#define) constants are defined:
+*
+* defined type meaning corresponding constants
+* ----------------------------------------------------------
+* Char character (none)
+* Bool boolean true, false
+* Word8 8-bit signed minWord8, maxWord8
+* UWord8 8-bit unsigned minUWord8, maxUWord8
+* Word16 16-bit signed minWord16, maxWord16
+* UWord16 16-bit unsigned minUWord16, maxUWord16
+* Word32 32-bit signed minWord32, maxWord32
+* UWord32 32-bit unsigned minUWord32, maxUWord32
+* Float floating point minFloat, maxFloat
+*
+*
+* The following compile switches are #defined:
+*
+* PLATFORM string indicating platform progam is compiled on
+* possible values: "OSF", "PC", "SUN"
+*
+* OSF only defined if the current platform is an Alpha
+* PC only defined if the current platform is a PC
+* SUN only defined if the current platform is a Sun
+*
+* LSBFIRST is defined if the byte order on this platform is
+* "least significant byte first" -> defined on DEC Alpha
+* and PC, undefined on Sun
+*
+********************************************************************************
+*/
+#ifndef typedefs_h
+#define typedefs_h "$Id $"
+
+/*
+********************************************************************************
+* INCLUDE FILES
+********************************************************************************
+*/
+#include <float.h>
+#include <limits.h>
+
+#define __MSDOS__
+
+/*
+********************************************************************************
+* DEFINITION OF CONSTANTS
+********************************************************************************
+*/
+/*
+ ********* define char type
+ */
+typedef char Char;
+
+/*
+ ********* define 8 bit signed/unsigned types & constants
+ */
+#if SCHAR_MAX == 127
+typedef signed char Word8;
+#define minWord8 SCHAR_MIN
+#define maxWord8 SCHAR_MAX
+
+typedef unsigned char UWord8;
+#define minUWord8 0
+#define maxUWord8 UCHAR_MAX
+#else
+#error cannot find 8-bit type
+#endif
+
+
+/*
+ ********* define 16 bit signed/unsigned types & constants
+ */
+#if INT_MAX == 32767
+typedef int Word16;
+#define minWord16 INT_MIN
+#define maxWord16 INT_MAX
+typedef unsigned int UWord16;
+#define minUWord16 0
+#define maxUWord16 UINT_MAX
+#elif SHRT_MAX == 32767
+typedef short Word16;
+#define minWord16 SHRT_MIN
+#define maxWord16 SHRT_MAX
+typedef unsigned short UWord16;
+#define minUWord16 0
+#define maxUWord16 USHRT_MAX
+#else
+#error cannot find 16-bit type
+#endif
+
+
+/*
+ ********* define 32 bit signed/unsigned types & constants
+ */
+#if INT_MAX == 2147483647
+typedef int Word32;
+#define minWord32 INT_MIN
+#define maxWord32 INT_MAX
+typedef unsigned int UWord32;
+#define minUWord32 0
+#define maxUWord32 UINT_MAX
+#elif LONG_MAX == 2147483647
+typedef long Word32;
+#define minWord32 LONG_MIN
+#define maxWord32 LONG_MAX
+typedef unsigned long UWord32;
+#define minUWord32 0
+#define maxUWord32 ULONG_MAX
+#else
+#error cannot find 32-bit type
+#endif
+
+/*
+ ********* define floating point type & constants
+ */
+/* use "#if 0" below if Float should be double;
+ use "#if 1" below if Float should be float
+ */
+#if 0
+typedef float Float;
+#define maxFloat FLT_MAX
+#define minFloat FLT_MIN
+#else
+typedef double Float;
+#define maxFloat DBL_MAX
+#define minFloat DBL_MIN
+#endif
+
+/*
+ ********* define complex type
+ */
+typedef struct {
+ Float r; /* real part */
+ Float i; /* imaginary part */
+} CPX;
+
+/*
+ ********* define boolean type
+ */
+typedef int Bool;
+#define false 0
+#define true 1
+
+/*
+ ********* Check current platform
+ */
+#if defined(__MSDOS__)
+#define PC
+#define PLATFORM "PC"
+#define LSBFIRST
+#elif defined(__osf__)
+#define OSF
+#define PLATFORM "OSF"
+#define LSBFIRST
+#elif defined(__sun__) || defined(__sun)
+#define SUN
+#define PLATFORM "SUN"
+#undef LSBFIRST
+#elif defined(linux) && defined(i386)
+#define PC
+#define PLATFORM "PC"
+#define LSBFIRST
+#else
+#error "can't determine architecture; adapt typedefs.h to your platform"
+#endif
+
+#endif
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.cc
new file mode 100644
index 0000000..99c990d
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.cc
@@ -0,0 +1,147 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "aux_sub.h"
+#include "dsp_sub.h"
+#include "math_sub.h"
+#include "uv_synt.h"
+#include "rand_gen.h"
+#include "tbls.h"
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+
+
+
+void imbe_vocoder::uv_synt_init(void)
+{
+ fft_init();
+ v_zap(uv_mem, 105);
+}
+
+
+
+
+
+
+void imbe_vocoder::uv_synt(IMBE_PARAM *imbe_param, Word16 *snd)
+{
+ Cmplx16 Uw[FFTLENGTH];
+ Word16 i, index_a, index_b, index_aux, ha, hb, *v_uv_dsn_ptr, *sa_ptr, sa;
+ Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b;
+
+ sa_ptr = imbe_param->sa;
+ v_uv_dsn_ptr = imbe_param->v_uv_dsn;
+ fund_freq = imbe_param->fund_freq;
+ fund_freq_2 = L_shr(fund_freq, 1);
+
+ v_zap((Word16 *)&Uw, 2 * FFTLENGTH);
+
+ fund_freq_acc_a = L_sub(fund_freq, fund_freq_2);
+ fund_freq_acc_b = L_add(fund_freq, fund_freq_2);
+
+ for(i = 0; i < imbe_param->num_harms; i++)
+ {
+ ha = extract_h(fund_freq_acc_a);
+ hb = extract_h(fund_freq_acc_b);
+ index_a = (ha >> 8) + ((ha & 0xFF)?1:0);
+ index_b = (hb >> 8) + ((hb & 0xFF)?1:0);
+
+ index_aux = 256 - index_a;
+
+ sa = shl(*sa_ptr, 3);
+
+ if(*v_uv_dsn_ptr++)
+ {
+ while(index_a < index_b)
+ {
+ Uw[index_a].re = Uw[index_a].im = 0;
+ Uw[index_aux].re = Uw[index_aux].im = 0;
+ index_a++;
+ index_aux--;
+ }
+ }
+ else
+ {
+ while(index_a < index_b)
+ {
+ Uw[index_a].re = mult(sa, rand_gen());
+ Uw[index_a].im = mult(sa, rand_gen());
+ //Uw[index_a].re = sa;
+ //Uw[index_a].im = sa;
+
+ Uw[index_aux].re = Uw[index_a].re;
+ Uw[index_aux].im = negate(Uw[index_a].im);
+ index_a++;
+ index_aux--;
+ }
+ }
+
+ fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq);
+ fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq);
+ sa_ptr++;
+ }
+
+/*
+ j = 128;
+ for(i = 0; i < 128; i++)
+ Uw_tmp[j++] = Uw[i];
+
+ j = 128;
+ for(i = 0; i < 128; i++)
+ Uw_tmp[i] = Uw[j++];
+
+ for(i = 0; i < 256; i++)
+ Uw[i] = Uw_tmp[i];
+*/
+
+
+ fft((Word16 *)&Uw, FFTLENGTH, -1);
+
+ for(i = 0; i < 105; i++)
+ snd[i] = uv_mem[i];
+
+ index_aux = 73;
+ for(i = 105; i < FRAME; i++)
+ snd[i] = shl(Uw[index_aux++].re, 3);
+
+
+ // Weighted Overlap Add Algorithm
+ index_aux = 24;
+ index_a = 0;
+ index_b = 48;
+ for(i = 56; i < 105; i++)
+ {
+ snd[i] = extract_h(L_add(L_mult(snd[i], ws[index_b]), L_mult(shl(Uw[index_aux].re, 3), ws[index_a])));
+
+ index_aux++;
+ index_a++;
+ index_b--;
+ }
+
+ index_aux = 128;
+ for(i = 0; i < 105; i++)
+ uv_mem[i] = shl(Uw[index_aux++].re, 3);
+}
+
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.h b/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.h
new file mode 100644
index 0000000..ef04cb7
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/uv_synt.h
@@ -0,0 +1,29 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _UV_SYNT
+#define _UV_SYNT
+
+void uv_synt_init(void);
+void uv_synt(IMBE_PARAM *imbe_param, Word16 *snd);
+void fft(Word16 *datam1, Word16 nn, Word16 isign);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.cc
new file mode 100644
index 0000000..ee99e33
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.cc
@@ -0,0 +1,248 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "imbe.h"
+#include "aux_sub.h"
+#include "dsp_sub.h"
+#include "math_sub.h"
+#include "v_synt.h"
+#include "rand_gen.h"
+#include "tbls.h"
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+
+
+
+
+
+#define CNST_0_1_Q1_15 0x0CCD
+
+
+
+void imbe_vocoder::v_synt_init(void)
+{
+ Word16 i;
+
+ for(i = 0; i < NUM_HARMS_MAX; i++)
+ {
+ ph_mem[i] = L_deposit_h(rand_gen());
+ vu_dsn_prev[i] = 0;
+ }
+
+ num_harms_prev3 = 0;
+ fund_freq_prev = 0;
+}
+
+
+void imbe_vocoder::v_synt(IMBE_PARAM *imbe_param, Word16 *snd)
+{
+ Word32 L_tmp, L_tmp1, fund_freq, L_snd[FRAME], L_ph_acc, L_ph_step;
+ Word32 L_ph_acc_aux, L_ph_step_prev, L_amp_acc, L_amp_step, L_ph_step_aux;
+ Word16 num_harms, i, j, *vu_dsn, *sa, *s_ptr, *s_ptr_aux, num_harms_max, num_harms_max_4;
+ UWord32 ph_mem_prev[NUM_HARMS_MAX], dph[NUM_HARMS_MAX];
+ Word16 num_harms_inv, num_harms_sh, num_uv;
+ Word16 freq_flag;
+
+
+ fund_freq = imbe_param->fund_freq;
+ num_harms = imbe_param->num_harms;
+ vu_dsn = imbe_param->v_uv_dsn;
+ sa = imbe_param->sa;
+ num_harms_inv = imbe_param->div_one_by_num_harm;
+ num_harms_sh = imbe_param->div_one_by_num_harm_sh;
+ num_uv = imbe_param->l_uv;
+
+ for(i = 0; i < FRAME; i++)
+ L_snd[i] = 0;
+
+ // Update phases (calculated phase value correspond to bound of frame)
+ L_tmp = (((fund_freq_prev + fund_freq) >> 7) * FRAME/2) << 7; // It is performed integer multiplication by mod 1
+
+ L_ph_acc = 0;
+ for(i = 0; i < NUM_HARMS_MAX; i++)
+ {
+ ph_mem_prev[i] = ph_mem[i];
+ L_ph_acc += L_tmp;
+ ph_mem[i] += L_ph_acc;
+ dph[i] = 0;
+ }
+
+ num_harms_max = (num_harms >= num_harms_prev3)?num_harms:num_harms_prev3;
+ num_harms_max_4 = num_harms_max >> 2;
+
+ if(L_abs(L_sub(fund_freq, fund_freq_prev)) >= L_mpy_ls(fund_freq, CNST_0_1_Q1_15))
+ freq_flag = 1;
+ else
+ freq_flag = 0;
+
+ L_ph_step = L_ph_step_prev = 0;
+ for(i = 0; i < num_harms_max; i++)
+ {
+ L_ph_step += fund_freq;
+ L_ph_step_prev += fund_freq_prev;
+
+
+ if(i > num_harms_max_4)
+ {
+ if(num_uv == num_harms)
+ {
+ dph[i] = L_deposit_h(rand_gen());
+ }
+ else
+ {
+ L_tmp = L_mult(rand_gen(), num_harms_inv);
+ dph[i] = L_shr(L_tmp, 15 - num_harms_sh) * num_uv;
+ }
+ ph_mem[i] += dph[i];
+ }
+
+ if(vu_dsn[i] == 0 && vu_dsn_prev[i] == 0)
+ continue;
+
+ if(vu_dsn[i] == 1 && vu_dsn_prev[i] == 0) // unvoiced => voiced
+ {
+ s_ptr = (Word16 *)ws;
+ L_ph_acc = ph_mem[i] - (((L_ph_step >> 7) * 104) << 7);
+ for(j = 56; j <= 104; j++)
+ {
+ L_tmp = L_mult(*s_ptr++, sa[i]);
+ L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc += L_ph_step;
+ }
+
+ for(j = 105; j <= 159; j++)
+ {
+ L_tmp = L_mult(sa[i], cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc += L_ph_step;
+ }
+ continue;
+ }
+
+
+ if(vu_dsn[i] == 0 && vu_dsn_prev[i] == 1) // voiced => unvoiced
+ {
+ s_ptr = (Word16 *)&ws[48];
+ L_ph_acc = ph_mem_prev[i];
+
+ for(j = 0; j <= 55; j++)
+ {
+ L_tmp = L_mult(sa_prev3[i], cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc += L_ph_step_prev;
+ }
+
+ for(j = 56; j <= 104; j++)
+ {
+ L_tmp = L_mult(*s_ptr--, sa_prev3[i]);
+ L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc += L_ph_step_prev;
+ }
+ continue;
+ }
+
+ if(i >=7 || freq_flag)
+ {
+ s_ptr_aux = (Word16 *)&ws[48];
+ L_ph_acc_aux = ph_mem_prev[i];
+
+ s_ptr = (Word16 *)ws;
+ L_ph_acc = ph_mem[i] - (((L_ph_step >> 7) * 104) << 7);
+
+ for(j = 0; j <= 55; j++)
+ {
+ L_tmp = L_mult(sa_prev3[i], cos_fxp(extract_h(L_ph_acc_aux)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc_aux += L_ph_step_prev;
+ }
+
+ for(j = 56; j <= 104; j++)
+ {
+ L_tmp = L_mult(*s_ptr_aux--, sa_prev3[i]);
+ L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc_aux)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+
+ L_tmp = L_mult(*s_ptr++, sa[i]);
+ L_tmp = L_mpy_ls(L_tmp, cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+
+ L_ph_acc_aux += L_ph_step_prev;
+ L_ph_acc += L_ph_step;
+ }
+
+ for(j = 105; j <= 159; j++)
+ {
+ L_tmp = L_mult(sa[i], cos_fxp(extract_h(L_ph_acc)));
+ L_tmp = L_shr(L_tmp, 1);
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+ L_ph_acc += L_ph_step;
+ }
+ continue;
+ }
+
+ L_amp_step = L_mpy_ls(L_shr(L_deposit_h(sub(sa[i], sa_prev3[i])), 4 + 1), CNST_0_1_Q1_15); // (sa[i] - sa_prev3[i]) / 160, 1/160 = 0.1/16
+ L_amp_acc = L_shr(L_deposit_h(sa_prev3[i]), 1);
+
+
+ L_ph_step_aux = L_mpy_ls(L_shr(fund_freq - fund_freq_prev, 4 + 1), CNST_0_1_Q1_15); // (fund_freq - fund_freq_prev)/(2*160)
+ L_ph_step_aux = ((L_ph_step_aux >> 7) * (i + 1)) << 7;
+
+ L_ph_acc = ph_mem_prev[i];
+
+ L_tmp1 = L_mpy_ls(L_shr(dph[i], 4), CNST_0_1_Q1_15); // dph[i] / 160
+
+ for(j = 0; j < 160; j++)
+ {
+ L_ph_acc_aux = ((L_ph_step_aux >> 9) * j) << 9;
+ L_ph_acc_aux = ((L_ph_acc_aux >> 9) * j) << 9;
+
+ L_tmp = L_mpy_ls(L_amp_acc, cos_fxp(extract_h(L_ph_acc + L_ph_acc_aux)));
+ L_snd[j] = L_add(L_snd[j], L_tmp);
+
+ L_amp_acc = L_add(L_amp_acc, L_amp_step);
+ L_ph_acc += L_ph_step_prev;
+ L_ph_acc += L_tmp1;
+ }
+ }
+
+ for(i = 0; i < FRAME; i++)
+ *snd++ = extract_h(L_snd[i]);
+
+ v_zap(vu_dsn_prev, NUM_HARMS_MAX);
+ v_equ(vu_dsn_prev, imbe_param->v_uv_dsn, num_harms);
+ v_equ(sa_prev3, imbe_param->sa, num_harms);
+
+ num_harms_prev3 = num_harms;
+ fund_freq_prev = fund_freq;
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.h b/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.h
new file mode 100644
index 0000000..2139fb2
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/v_synt.h
@@ -0,0 +1,30 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _V_SYNT
+#define _V_SYNT
+
+void v_synt_init(void);
+void v_synt(IMBE_PARAM *imbe_param, Word16 *snd);
+
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.cc b/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.cc
new file mode 100644
index 0000000..82cb211
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.cc
@@ -0,0 +1,373 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "typedef.h"
+#include "globals.h"
+#include "imbe.h"
+#include "basic_op.h"
+#include "aux_sub.h"
+#include "math_sub.h"
+#include "dsp_sub.h"
+#include "tbls.h"
+#include "v_uv_det.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "encode.h"
+#include "imbe_vocoder.h"
+
+
+#define CNST_0_5625_Q1_15 0x4800
+#define CNST_0_45_Q1_15 0x3999
+#define CNST_0_1741_Q1_15 0x164A
+#define CNST_0_1393_Q1_15 0x11D5
+#define CNST_0_99_Q1_15 0x7EB8
+#define CNST_0_01_Q1_15 0x0148
+#define CNST_0_0025_Q1_15 0x0051
+#define CNST_0_25_Q1_15 0x2000
+#define CNST_PI_4_Q1_15 0x6488
+#define CNST_0_55_Q4_12 0x08CD
+
+
+
+
+
+
+
+extern FILE *fp_in, *fp_out;
+extern int frame_cnt;
+
+
+void imbe_vocoder::pitch_ref_init(void)
+{
+ v_zap(v_uv_dsn, NUM_BANDS_MAX);
+ th_max = 0;
+}
+
+Word16 imbe_vocoder::voiced_sa_calc(Word32 num, Word16 den)
+{
+ Word16 tmp;
+ Word32 L_tmp;
+
+ L_tmp = L_mpy_ls(num, den);
+ L_tmp = sqrt_l_exp(L_tmp, &tmp);
+ L_tmp = L_shr(L_tmp, tmp - 3);
+
+ //L_tmp =0;
+ //return (Word16)(2*256.0*sqrt(2*(double)num/(double)den));
+ return extract_h(L_tmp);
+}
+
+Word16 imbe_vocoder::unvoiced_sa_calc(Word32 num, Word16 den)
+{
+ Word16 shift, tmp;
+ Word32 L_tmp;
+
+ shift = norm_s(den);
+ tmp = div_s(0x4000, shl(den, shift));
+ L_tmp = L_shl(L_mpy_ls(num, tmp), shift + 2);
+ L_tmp = sqrt_l_exp(L_tmp, &tmp);
+ L_tmp = L_shr(L_tmp, tmp - 2 + 6);
+ L_tmp = L_mpy_ls(L_tmp, 0x4A76);
+
+ //L_tmp =0;
+ //return (Word16)(2*0.1454 * sqrt(2*256*(double)num/(double)den));
+ return extract_h(L_tmp);
+}
+
+//=============================================================================
+//
+// Voiced/Unvoiced Determination & Spectral Amplitudes Estimation
+//
+//=============================================================================
+void imbe_vocoder::v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf)
+{
+ Word16 i, j, index_a_save, tmp, index_wr;
+ Word32 fund_freq, fund_freq_2, fund_freq_acc_a, fund_freq_acc_b, fund_freq_acc, fund_fr_acc, L_tmp, amp_re_acc, amp_im_acc;
+ Word16 ha, hb, index_a, index_b, index_tbl[30], it_ind, re_tmp, im_tmp, re_tmp2, im_tmp2, sc_coef;
+ Word32 Sw_sum, M_num[NUM_HARMS_MAX], M_num_sum, M_den_sum, D_num, D_den, th_lf, th_hf, th0, fund_fr_step, M_fcn_num, M_fcn_den;
+ Word16 sp_rec_re, sp_rec_im, M_fcn;
+ Word16 band_cnt, num_harms_cnt, uv_harms_cnt, Dk;
+ Word16 num_harms, num_bands, dsn_thr=0;
+ Word16 thr[NUM_BANDS_MAX], M_den[NUM_HARMS_MAX], b1_vec;
+
+
+ fund_freq = imbe_param->fund_freq;
+
+ tmp = shr( add( shr(imbe_param->ref_pitch, 1), CNST_0_25_Q8_8), 8); // fix(pitch_cand / 2 + 0.5)
+ num_harms = extract_h((UWord32)CNST_0_9254_Q0_16 * tmp); // fix(0.9254 * fix(pitch_cand / 2 + 0.5))
+ if(num_harms < NUM_HARMS_MIN)
+ num_harms = NUM_HARMS_MIN;
+ else if(num_harms > NUM_HARMS_MAX)
+ num_harms = NUM_HARMS_MAX;
+
+ if(num_harms <= 36)
+ num_bands = extract_h((UWord32)(num_harms + 2) * CNST_0_33_Q0_16); // fix((L+2)/3)
+ else
+ num_bands = NUM_BANDS_MAX;
+
+ imbe_param->num_harms = num_harms;
+ imbe_param->num_bands = num_bands;
+
+ //=========================================================================
+ //
+ // M(th) function calculation
+ //
+ //=========================================================================
+ for(j = 0, th_lf = 0; j < 64; j++)
+ {
+ th_lf = L_mac(th_lf, fft_buf[j].re, fft_buf[j].re);
+ th_lf = L_mac(th_lf, fft_buf[j].im, fft_buf[j].im);
+ }
+ for(j = 64, th_hf = 0; j < 128; j++)
+ {
+ th_hf = L_mac(th_hf, fft_buf[j].re, fft_buf[j].re);
+ th_hf = L_mac(th_hf, fft_buf[j].im, fft_buf[j].im);
+ }
+ th0 = L_add(th_lf, th_hf);
+
+ if(th0 > th_max)
+ th_max = L_shr(L_add(th_max, th0), 1);
+ else
+ th_max = L_add(L_mpy_ls(th_max, CNST_0_99_Q1_15), L_mpy_ls(th0, CNST_0_01_Q1_15));
+
+ M_fcn_num = L_add(th0, L_mpy_ls(th_max, CNST_0_0025_Q1_15));
+ M_fcn_den = L_add(th0, L_mpy_ls(th_max, CNST_0_01_Q1_15));
+ if(M_fcn_den == 0)
+ M_fcn = CNST_0_25_Q1_15;
+ else
+ {
+ tmp = norm_l(M_fcn_den);
+ M_fcn_den = L_shl(M_fcn_den, tmp);
+ M_fcn_num = L_shl(M_fcn_num, tmp);
+
+ M_fcn = div_s(extract_h(M_fcn_num), extract_h(M_fcn_den));
+
+ if(th_lf < (L_tmp= L_add(L_shl(th_hf, 2), th_hf))) // compare th_lf < 5*th_hf
+ {
+ tmp = norm_l(L_tmp);
+ M_fcn_den = L_shl(L_tmp, tmp);
+ th_lf = L_shl(th_lf, tmp);
+
+ tmp = div_s(extract_h(th_lf), extract_h(M_fcn_den));
+ L_tmp = sqrt_l_exp(L_deposit_h(tmp), &tmp);
+ if(tmp)
+ L_tmp = L_shr(L_tmp, tmp);
+ M_fcn = mult(M_fcn, extract_h(L_tmp));
+ }
+ }
+ // ========================================================================
+ fund_fr_step = L_shl(L_mpy_ls(fund_freq, CNST_PI_4_Q1_15), 2); // mult by PI
+
+ uv_harms_cnt = 0;
+ b1_vec = 0;
+ band_cnt = 0;
+ num_harms_cnt = 0;
+ Sw_sum = 0;
+ D_num = D_den = 0;
+
+ fund_fr_acc = 0;
+ fund_freq_acc = fund_freq;
+ fund_freq_2 = L_shr(fund_freq, 1);
+ fund_freq_acc_a = L_sub(fund_freq, fund_freq_2);
+ fund_freq_acc_b = L_add(fund_freq, fund_freq_2);
+ for(j = 0; j < num_harms; j++)
+ {
+ ha = extract_h(fund_freq_acc_a);
+ hb = extract_h(fund_freq_acc_b);
+ index_a = (ha >> 8) + ((ha & 0xFF)?1:0);
+ index_b = (hb >> 8) + ((hb & 0xFF)?1:0);
+
+ L_tmp = L_shl(L_deposit_h(index_a), 8);
+ L_tmp = L_sub(L_tmp, fund_freq_acc);
+ L_tmp = L_add(L_tmp, 0x00020000); // for rounding purpose
+ L_tmp = L_shr(L_tmp, 2);
+
+ index_a_save = index_a;
+ it_ind = 0;
+
+ // =========== v/uv determination threshold function ==
+ if(num_harms_cnt == 0) // calculate one time per band
+ {
+ if(imbe_param->e_p > CNST_0_55_Q4_12 && band_cnt >= 1)
+ dsn_thr = 0;
+ else if(v_uv_dsn[band_cnt] == 1)
+ dsn_thr = mult(M_fcn, sub(CNST_0_5625_Q1_15, mult(CNST_0_1741_Q1_15, extract_h(fund_fr_acc))));
+ else
+ dsn_thr = mult(M_fcn, sub(CNST_0_45_Q1_15, mult(CNST_0_1393_Q1_15, extract_h(fund_fr_acc))));
+
+ fund_fr_acc = L_add(fund_fr_acc, fund_fr_step);
+
+ thr[band_cnt] = dsn_thr;
+ }
+ // ====================================================
+
+ M_den_sum = 0;
+ amp_re_acc = amp_im_acc = 0;
+ while(index_a < index_b)
+ {
+ index_wr = extract_h(L_tmp);
+ if(index_wr < 0 && (L_tmp & 0xFFFF)) // truncating for negative number
+ index_wr = add(index_wr, 1);
+ index_wr = add(index_wr, 160);
+ index_tbl[it_ind++] = index_wr;
+ if(index_wr >= 0 && index_wr <= 320)
+ {
+ amp_re_acc = L_mac(amp_re_acc, fft_buf[index_a].re, wr_sp[index_wr]);
+ amp_im_acc = L_mac(amp_im_acc, fft_buf[index_a].im, wr_sp[index_wr]);
+ M_den_sum = L_add(M_den_sum, mult(wr_sp[index_wr], wr_sp[index_wr]));
+ }
+
+ index_a++;
+ L_tmp = L_add(L_tmp, 0x400000);
+ }
+ sc_coef = div_s(0x4000, extract_l(L_shr(M_den_sum, 1)));
+ im_tmp2 = mult(extract_h(amp_im_acc), sc_coef);
+ re_tmp2 = mult(extract_h(amp_re_acc), sc_coef);
+
+ M_num_sum = 0;
+ it_ind = 0;
+ index_a = index_a_save;
+ while(index_a < index_b)
+ {
+ index_wr = index_tbl[it_ind++];
+ if(index_wr < 0 || index_wr > 320)
+ sp_rec_re = sp_rec_im = 0;
+ else
+ {
+ sp_rec_im = mult( im_tmp2, wr_sp[index_wr]);
+ sp_rec_re = mult( re_tmp2, wr_sp[index_wr]);
+ }
+
+ re_tmp = sub(fft_buf[index_a].re, sp_rec_re);
+ im_tmp = sub(fft_buf[index_a].im, sp_rec_im);
+ D_num = L_mac(D_num, re_tmp, re_tmp);
+ D_num = L_mac(D_num, im_tmp, im_tmp);
+
+ M_num_sum = L_mac(M_num_sum, fft_buf[index_a].re, fft_buf[index_a].re);
+ M_num_sum = L_mac(M_num_sum, fft_buf[index_a].im, fft_buf[index_a].im);
+
+ index_a++;
+ }
+
+ M_den[j] = sc_coef;
+ M_num[j] = M_num_sum;
+ D_den = L_add(D_den, M_num_sum);
+
+ if(++num_harms_cnt == 3 && band_cnt < num_bands - 1)
+ {
+ b1_vec <<= 1;
+
+ if(D_den > D_num && D_den != 0)
+ {
+ tmp = norm_l(D_den);
+ Dk = div_s(extract_h(L_shl(D_num, tmp)), extract_h(L_shl(D_den, tmp)));
+ }
+ else
+ Dk = MAX_16;
+
+ if(Dk < dsn_thr)
+ {
+ // voiced band
+ v_uv_dsn[band_cnt] = 1;
+ b1_vec |= 1;
+ i = j - 2;
+ while(i <= j)
+ {
+ imbe_param->sa[i] = voiced_sa_calc(M_num[i], M_den[i]);
+ imbe_param->v_uv_dsn[i] = 1;
+ i++;
+ }
+ }
+ else
+ {
+ // unvoiced band
+ v_uv_dsn[band_cnt] = 0;
+ i = j - 2;
+ while(i <= j)
+ {
+ imbe_param->sa[i] = unvoiced_sa_calc(M_num[i], index_b - index_a_save);
+ imbe_param->v_uv_dsn[i] = 0;
+ uv_harms_cnt++;
+ i++;
+ }
+ }
+
+ D_num = D_den = 0;
+ num_harms_cnt = 0;
+ band_cnt++;
+ }
+
+
+ fund_freq_acc_a = L_add(fund_freq_acc_a, fund_freq);
+ fund_freq_acc_b = L_add(fund_freq_acc_b, fund_freq);
+ fund_freq_acc = L_add(fund_freq_acc, fund_freq);
+ }
+
+ if(num_harms_cnt)
+ {
+ b1_vec <<= 1;
+ if(D_den > D_num && D_den != 0)
+ {
+ tmp = norm_l(D_den);
+ Dk= div_s(extract_h(L_shl(D_num, tmp)), extract_h(L_shl(D_den, tmp)));
+ }
+ else
+ Dk = MAX_16;
+
+ if(Dk < dsn_thr)
+ {
+ // voiced band
+ v_uv_dsn[band_cnt] = 1;
+ b1_vec |= 1;
+
+ i = num_harms - num_harms_cnt;
+ while(i < num_harms)
+ {
+ imbe_param->sa[i] = voiced_sa_calc(M_num[i], M_den[i]);
+ imbe_param->v_uv_dsn[i] = 1;
+ i++;
+ }
+ }
+ else
+ {
+ // unvoiced band
+ v_uv_dsn[band_cnt] = 0;
+ i = num_harms - num_harms_cnt;
+ while(i < num_harms)
+ {
+ imbe_param->sa[i] = unvoiced_sa_calc(M_num[i], index_b - index_a_save);
+ imbe_param->v_uv_dsn[i] = 0;
+ uv_harms_cnt++;
+ i++;
+ }
+ }
+ }
+
+ imbe_param->l_uv = uv_harms_cnt;
+
+
+ imbe_param->b_vec[1] = b1_vec; // Save encoded voiced/unvoiced decision
+ imbe_param->b_vec[0] = shr( sub(imbe_param->ref_pitch, 0x1380), 7); // Pitch encode fix(2*pitch - 39)
+
+}
diff --git a/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.h b/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.h
new file mode 100644
index 0000000..ebe270f
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/imbe_vocoder/v_uv_det.h
@@ -0,0 +1,28 @@
+/*
+ * Project 25 IMBE Encoder/Decoder Fixed-Point implementation
+ * Developed by Pavel Yazev E-mail: pyazev@gmail.com
+ * Version 1.0 (c) Copyright 2009
+ *
+ * This 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.
+ *
+ * The software 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; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#ifndef _V_UV_DET
+#define _V_UV_DET
+
+void v_uv_det(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/op25_golay.h b/op25/gr-op25_repeater/lib/op25_golay.h
new file mode 120000
index 0000000..1b8b911
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/op25_golay.h
@@ -0,0 +1 @@
+../../gr-op25/lib/op25_golay.h \ No newline at end of file
diff --git a/op25/gr-op25_repeater/lib/op25_hamming.h b/op25/gr-op25_repeater/lib/op25_hamming.h
new file mode 120000
index 0000000..6b89f8e
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/op25_hamming.h
@@ -0,0 +1 @@
+../../gr-op25/lib/op25_hamming.h \ No newline at end of file
diff --git a/op25/gr-op25_repeater/lib/op25_imbe_frame.h b/op25/gr-op25_repeater/lib/op25_imbe_frame.h
new file mode 120000
index 0000000..ea1f3cb
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/op25_imbe_frame.h
@@ -0,0 +1 @@
+../../gr-op25/lib/op25_imbe_frame.h \ No newline at end of file
diff --git a/op25/gr-op25_repeater/lib/op25_p25_frame.h b/op25/gr-op25_repeater/lib/op25_p25_frame.h
new file mode 120000
index 0000000..67cad24
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/op25_p25_frame.h
@@ -0,0 +1 @@
+../../gr-op25/lib/op25_p25_frame.h \ No newline at end of file
diff --git a/op25/gr-op25_repeater/lib/op25_yank.h b/op25/gr-op25_repeater/lib/op25_yank.h
new file mode 120000
index 0000000..7e3b92f
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/op25_yank.h
@@ -0,0 +1 @@
+../../gr-op25/lib/op25_yank.h \ No newline at end of file
diff --git a/op25/gr-op25_repeater/lib/p25_frame.h b/op25/gr-op25_repeater/lib/p25_frame.h
new file mode 100644
index 0000000..29dd0b2
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/p25_frame.h
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_OP25_P25_FRAME_H
+#define INCLUDED_OP25_P25_FRAME_H 1
+
+namespace gr {
+ namespace op25_repeater {
+static const size_t P25_VOICE_FRAME_SIZE = 1728;
+static const size_t P25_HEADER_SYMBOLS = 24 + 32 + 1;
+static const size_t P25_HEADER_BITS = P25_HEADER_SYMBOLS * 2;
+
+static const uint64_t P25_FRAME_SYNC_MAGIC = 0x5575F5FF77FFLL;
+static const uint64_t P25_FRAME_SYNC_REV_P = 0x5575F5FF77FFLL ^ 0xAAAAAAAAAAAALL;
+static const uint64_t P25_FRAME_SYNC_MASK = 0xFFFFFFFFFFFFLL;
+
+/* Given a 64-bit frame header word and a frame body which is to be initialized
+ * 1. Place flags at beginning of frame body
+ * 2. Store 64-bit frame header word
+ * 3. FIXME Place first status symbol
+ */
+static inline void
+p25_setup_frame_header(bit_vector& frame_body, uint64_t hw) {
+ uint64_t acc = P25_FRAME_SYNC_MAGIC;
+ for (int i=47; i>=0; i--) {
+ frame_body[ i ] = acc & 1;
+ acc >>= 1;
+ }
+ acc = hw;
+ for (int i=113; i>=72; i--) {
+ frame_body[ i ] = acc & 1;
+ acc >>= 1;
+ }
+ // FIXME: insert proper status dibit bits at 70, 71
+ frame_body[70] = 1;
+ frame_body[71] = 0;
+ for (int i=69; i>=48; i--) {
+ frame_body[ i ] = acc & 1;
+ acc >>= 1;
+ }
+}
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_P25_FRAME_H */
diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc
new file mode 100644
index 0000000..36e236a
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc
@@ -0,0 +1,451 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "p25_frame_assembler_impl.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+#include <vector>
+#include <sys/time.h>
+#include "bch.h"
+#include "op25_imbe_frame.h"
+#include "p25_frame.h"
+#include "p25_framer.h"
+#include "rs.h"
+
+static const int64_t TIMEOUT_THRESHOLD = 1000000;
+
+namespace gr {
+ namespace op25_repeater {
+
+ p25_frame_assembler::sptr
+ p25_frame_assembler::make(const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue)
+ {
+ return gnuradio::get_initial_sptr
+ (new p25_frame_assembler_impl(udp_host, port, debug, do_imbe, do_output, do_msgq, queue));
+ }
+
+ /*
+ * The private constructor
+ */
+
+ /*
+ * Our virtual destructor.
+ */
+ p25_frame_assembler_impl::~p25_frame_assembler_impl()
+ {
+ if (write_sock > 0)
+ close(write_sock);
+ delete framer;
+ }
+
+static const int MIN_IN = 1; // mininum number of input streams
+static const int MAX_IN = 1; // maximum number of input streams
+
+static uint16_t crc16(uint8_t buf[], int len) {
+ uint32_t poly = (1<<12) + (1<<5) + (1<<0);
+ uint32_t crc = 0;
+ for(int i=0; i<len; i++) {
+ uint8_t bits = buf[i];
+ for (int j=0; j<8; j++) {
+ uint8_t bit = (bits >> (7-j)) & 1;
+ crc = ((crc << 1) | bit) & 0x1ffff;
+ if (crc & 0x10000)
+ crc = (crc & 0xffff) ^ poly;
+ }
+ }
+ crc = crc ^ 0xffff;
+ return crc & 0xffff;
+}
+
+/* translated from p25craft.py Michael Ossmann <mike@ossmann.com> */
+static uint32_t crc32(uint8_t buf[], int len) { /* length is nr. of bits */
+ uint32_t g = 0x04c11db7;
+ uint64_t crc = 0;
+ for (int i = 0; i < len; i++) {
+ crc <<= 1;
+ int b = ( buf [i / 8] >> (7 - (i % 8)) ) & 1;
+ if (((crc >> 32) ^ b) & 1)
+ crc ^= g;
+ }
+ crc = (crc & 0xffffffff) ^ 0xffffffff;
+ return crc;
+}
+
+/* find_min is from wireshark/plugins/p25/packet-p25cai.c */
+/* Copyright 2008, Michael Ossmann <mike@ossmann.com> */
+/* return the index of the lowest value in a list */
+static int
+find_min(uint8_t list[], int len)
+{
+ int min = list[0];
+ int index = 0;
+ int unique = 1;
+ int i;
+
+ for (i = 1; i < len; i++) {
+ if (list[i] < min) {
+ min = list[i];
+ index = i;
+ unique = 1;
+ } else if (list[i] == min) {
+ unique = 0;
+ }
+ }
+ /* return -1 if a minimum can't be found */
+ if (!unique)
+ return -1;
+
+ return index;
+}
+
+/* count_bits is from wireshark/plugins/p25/packet-p25cai.c */
+/* Copyright 2008, Michael Ossmann <mike@ossmann.com> */
+/* count the number of 1 bits in an int */
+static int
+count_bits(unsigned int n)
+{
+ int i = 0;
+ for (i = 0; n != 0; i++)
+ n &= n - 1;
+ return i;
+}
+
+/* adapted from wireshark/plugins/p25/packet-p25cai.c */
+/* Copyright 2008, Michael Ossmann <mike@ossmann.com> */
+/* deinterleave and trellis1_2 decoding */
+/* buf is assumed to be a buffer of 12 bytes */
+static int
+block_deinterleave(bit_vector& bv, unsigned int start, uint8_t* buf)
+{
+ static const uint16_t deinterleave_tb[] = {
+ 0, 1, 2, 3, 52, 53, 54, 55, 100,101,102,103, 148,149,150,151,
+ 4, 5, 6, 7, 56, 57, 58, 59, 104,105,106,107, 152,153,154,155,
+ 8, 9, 10, 11, 60, 61, 62, 63, 108,109,110,111, 156,157,158,159,
+ 12, 13, 14, 15, 64, 65, 66, 67, 112,113,114,115, 160,161,162,163,
+ 16, 17, 18, 19, 68, 69, 70, 71, 116,117,118,119, 164,165,166,167,
+ 20, 21, 22, 23, 72, 73, 74, 75, 120,121,122,123, 168,169,170,171,
+ 24, 25, 26, 27, 76, 77, 78, 79, 124,125,126,127, 172,173,174,175,
+ 28, 29, 30, 31, 80, 81, 82, 83, 128,129,130,131, 176,177,178,179,
+ 32, 33, 34, 35, 84, 85, 86, 87, 132,133,134,135, 180,181,182,183,
+ 36, 37, 38, 39, 88, 89, 90, 91, 136,137,138,139, 184,185,186,187,
+ 40, 41, 42, 43, 92, 93, 94, 95, 140,141,142,143, 188,189,190,191,
+ 44, 45, 46, 47, 96, 97, 98, 99, 144,145,146,147, 192,193,194,195,
+ 48, 49, 50, 51 };
+
+ uint8_t hd[4];
+ int b, d, j;
+ int state = 0;
+ uint8_t codeword;
+ uint16_t crc;
+ uint32_t crc1;
+ uint32_t crc2;
+
+ static const uint8_t next_words[4][4] = {
+ {0x2, 0xC, 0x1, 0xF},
+ {0xE, 0x0, 0xD, 0x3},
+ {0x9, 0x7, 0xA, 0x4},
+ {0x5, 0xB, 0x6, 0x8}
+ };
+
+ memset(buf, 0, 12);
+
+ for (b=0; b < 98*2; b += 4) {
+ codeword = (bv[start+deinterleave_tb[b+0]] << 3) +
+ (bv[start+deinterleave_tb[b+1]] << 2) +
+ (bv[start+deinterleave_tb[b+2]] << 1) +
+ bv[start+deinterleave_tb[b+3]] ;
+
+ /* try each codeword in a row of the state transition table */
+ for (j = 0; j < 4; j++) {
+ /* find Hamming distance for candidate */
+ hd[j] = count_bits(codeword ^ next_words[state][j]);
+ }
+ /* find the dibit that matches the most codeword bits (minimum Hamming distance) */
+ state = find_min(hd, 4);
+ /* error if minimum can't be found */
+ if(state == -1)
+ return -1; // decode error, return failure
+ /* It also might be nice to report a condition where the minimum is
+ * non-zero, i.e. an error has been corrected. It probably shouldn't
+ * be a permanent failure, though.
+ *
+ * DISSECTOR_ASSERT(hd[state] == 0);
+ */
+
+ /* append dibit onto output buffer */
+ d = b >> 2; // dibit ctr
+ if (d < 48) {
+ buf[d >> 2] |= state << (6 - ((d%4) * 2));
+ }
+ }
+ crc = crc16(buf, 12);
+ if (crc == 0)
+ return 0; // return OK code
+ crc1 = crc32(buf, 8*8); // try crc32
+ crc2 = (buf[8] << 24) + (buf[9] << 16) + (buf[10] << 8) + buf[11];
+ if (crc1 == crc2)
+ return 0; // return OK code
+ return -2; // trellis decode OK, but CRC error occurred
+}
+
+/*
+ * The private constructor
+ */
+ p25_frame_assembler_impl::p25_frame_assembler_impl(const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue)
+ : gr::block("p25_frame_assembler",
+ gr::io_signature::make (MIN_IN, MAX_IN, sizeof (char)),
+ gr::io_signature::make ((do_output) ? 1 : 0, (do_output) ? 1 : 0, (do_output) ? sizeof(char) : 0 )),
+ write_bufp(0),
+ write_sock(0),
+ d_udp_host(udp_host),
+ d_port(port),
+ d_debug(debug),
+ d_do_imbe(do_imbe),
+ d_do_output(do_output),
+ d_do_msgq(do_msgq),
+ d_msg_queue(queue),
+ symbol_queue(),
+ framer(new p25_framer())
+{
+ gettimeofday(&last_qtime, 0);
+ if (port > 0)
+ init_sock(d_udp_host, d_port);
+}
+
+void
+p25_frame_assembler_impl::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
+{
+ // for do_imbe=false: we output packed bytes (4:1 ratio)
+ // for do_imbe=true: input rate= 4800, output rate= 1600 = 32 * 50 (3:1)
+ const size_t nof_inputs = nof_input_items_reqd.size();
+ int nof_samples_reqd = 4.0 * nof_output_items;
+ if (d_do_imbe)
+ nof_samples_reqd = 3.0 * nof_output_items;
+ std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
+}
+void
+p25_frame_assembler_impl::process_duid(uint32_t const duid, uint32_t const nac, uint8_t const buf[], int const len)
+{
+ char wbuf[256];
+ int p = 0;
+ if (!d_do_msgq)
+ return;
+ if (d_msg_queue->full_p())
+ return;
+ assert (len+2 <= sizeof(wbuf));
+ wbuf[p++] = (nac >> 8) & 0xff;
+ wbuf[p++] = nac & 0xff;
+ if (buf) {
+ memcpy(&wbuf[p], buf, len); // copy data
+ p += len;
+ }
+ gr::message::sptr msg = gr::message::make_from_string(std::string(wbuf, p), duid, 0, 0);
+ d_msg_queue->insert_tail(msg);
+ gettimeofday(&last_qtime, 0);
+// msg.reset();
+}
+
+int
+p25_frame_assembler_impl::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+
+ const uint8_t *in = (const uint8_t *) input_items[0];
+ struct timeval currtime;
+
+ for (int i = 0; i < noutput_items; i++){
+ if(framer->rx_sym(in[i])) { // complete frame was detected
+ if (d_debug >= 10) {
+ fprintf (stderr, "NAC 0x%X DUID 0x%X len %u errs %u ", framer->nac, framer->duid, framer->frame_size >> 1, framer->bch_errors);
+ }
+ if (framer->bch_errors >= 0 &&
+ ((framer->duid == 0x03) ||
+ (framer->duid == 0x05) ||
+ (framer->duid == 0x0A) ||
+ (framer->duid == 0x0F))) {
+ process_duid(framer->duid, framer->nac, NULL, 0);
+ }
+ if ((framer->duid == 0x07 || framer->duid == 0x0c) && framer->bch_errors >= 0) {
+ unsigned int d, b;
+ int rc[3];
+ bit_vector bv1(720);
+ int sizes[3] = {360, 576, 720};
+ uint8_t deinterleave_buf[3][12];
+
+ if (framer->frame_size > 720) {
+ fprintf(stderr, "warning trunk frame size %u exceeds maximum\n", framer->frame_size);
+ framer->frame_size = 720;
+ }
+ for (d=0, b=0; d < framer->frame_size >> 1; d++) {
+ if ((d+1) % 36 == 0)
+ continue; // skip SS
+ bv1[b++] = framer->frame_body[d*2];
+ bv1[b++] = framer->frame_body[d*2+1];
+ }
+ for(int sz=0; sz < 3; sz++) {
+ if (framer->frame_size >= sizes[sz]) {
+ rc[sz] = block_deinterleave(bv1,48+64+sz*196 , deinterleave_buf[sz]);
+ if (framer->duid == 0x07 && rc[sz] == 0)
+ process_duid(framer->duid, framer->nac, deinterleave_buf[sz], 10);
+ }
+ }
+ // two-block mbt is the only format currently supported
+ if (framer->duid == 0x0c
+ && framer->frame_size == 576
+ && rc[0] == 0
+ && rc[1] == 0) {
+ // we copy first 10 bytes from first and
+ // first 8 from second (removes CRC's)
+ uint8_t mbt_block[18];
+ memcpy(mbt_block, deinterleave_buf[0], 10);
+ memcpy(&mbt_block[10], deinterleave_buf[1], 8);
+ process_duid(framer->duid, framer->nac, mbt_block, sizeof(mbt_block));
+ }
+ }
+ if (d_debug >= 10 && framer->duid == 0x00) {
+ ProcHDU(framer->frame_body);
+ } else if (d_debug > 10 && framer->duid == 0x05) {
+ ProcLDU1(framer->frame_body);
+ } else if (d_debug >= 10 && framer->duid == 0x0a) {
+ ProcLDU2(framer->frame_body);
+ } else if (d_debug > 10 && framer->duid == 0x0f) {
+ ProcTDU(framer->frame_body);
+ }
+ if (d_debug >= 10)
+ fprintf(stderr, "\n");
+ if (d_do_imbe && (framer->duid == 0x5 || framer->duid == 0xa)) { // if voice - ldu1 or ldu2
+ for(size_t i = 0; i < nof_voice_codewords; ++i) {
+ voice_codeword cw(voice_codeword_sz);
+ uint32_t E0, ET;
+ uint32_t u[8];
+ char s[128];
+ imbe_deinterleave(framer->frame_body, cw, i);
+ // recover 88-bit IMBE voice code word
+ imbe_header_decode(cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], E0, ET);
+ // output one 32-byte msg per 0.020 sec.
+ // also, 32*9 = 288 byte pkts (for use via UDP)
+ sprintf(s, "%03x %03x %03x %03x %03x %03x %03x %03x\n", u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]);
+ if (d_do_output) {
+ for (size_t j=0; j < strlen(s); j++) {
+ symbol_queue.push_back(s[j]);
+ }
+ }
+ if (write_sock > 0) {
+ memcpy(&write_buf[write_bufp], s, strlen(s));
+ write_bufp += strlen(s);
+ if (write_bufp >= 288) { // 9 * 32 = 288
+ sendto(write_sock, write_buf, 288, 0, (struct sockaddr *)&write_sock_addr, sizeof(write_sock_addr));
+ // FIXME check sendto() rc
+ write_bufp = 0;
+ }
+ }
+ }
+ } // end of imbe/voice
+ if (!d_do_imbe) {
+ // pack the bits into bytes, MSB first
+ size_t obuf_ct = 0;
+ uint8_t obuf[P25_VOICE_FRAME_SIZE/2];
+ for (uint32_t i = 0; i < framer->frame_size; i += 8) {
+ uint8_t b =
+ (framer->frame_body[i+0] << 7) +
+ (framer->frame_body[i+1] << 6) +
+ (framer->frame_body[i+2] << 5) +
+ (framer->frame_body[i+3] << 4) +
+ (framer->frame_body[i+4] << 3) +
+ (framer->frame_body[i+5] << 2) +
+ (framer->frame_body[i+6] << 1) +
+ (framer->frame_body[i+7] );
+ obuf[obuf_ct++] = b;
+ }
+ if (write_sock > 0) {
+ sendto(write_sock, obuf, obuf_ct, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr));
+ }
+ if (d_do_output) {
+ for (size_t j=0; j < obuf_ct; j++) {
+ symbol_queue.push_back(obuf[j]);
+ }
+ }
+ }
+ } // end of complete frame
+ }
+ if (d_do_msgq && !d_msg_queue->full_p()) {
+ // check for timeout
+ gettimeofday(&currtime, 0);
+ int64_t diff_usec = currtime.tv_usec - last_qtime.tv_usec;
+ int64_t diff_sec = currtime.tv_sec - last_qtime.tv_sec ;
+ if (diff_usec < 0) {
+ diff_usec += 1000000;
+ diff_sec -= 1;
+ }
+ diff_usec += diff_sec * 1000000;
+ if (diff_usec >= TIMEOUT_THRESHOLD) {
+ gettimeofday(&last_qtime, 0);
+ gr::message::sptr msg = gr::message::make(-1, 0, 0);
+ d_msg_queue->insert_tail(msg);
+ }
+ }
+ int amt_produce = 0;
+ amt_produce = noutput_items;
+ if (amt_produce > (int)symbol_queue.size())
+ amt_produce = symbol_queue.size();
+ if (amt_produce > 0) {
+ unsigned char *out = (unsigned char *) output_items[0];
+ copy(symbol_queue.begin(), symbol_queue.begin() + amt_produce, out);
+ symbol_queue.erase(symbol_queue.begin(), symbol_queue.begin() + amt_produce);
+ }
+ // printf ("work: ninp[0]: %d nout: %d size %d produce: %d surplus %d\n", ninput_items[0], noutput_items, symbol_queue.size(), amt_produce, surplus);
+ consume_each(noutput_items);
+ // Tell runtime system how many output items we produced.
+ return amt_produce;
+}
+
+void p25_frame_assembler_impl::init_sock(const char* udp_host, int udp_port)
+{
+ memset (&write_sock_addr, 0, sizeof(write_sock_addr));
+ write_sock = socket(PF_INET, SOCK_DGRAM, 17); // UDP socket
+ if (write_sock < 0) {
+ fprintf(stderr, "op25_imbe_vocoder: socket: %d\n", errno);
+ write_sock = 0;
+ return;
+ }
+ if (!inet_aton(udp_host, &write_sock_addr.sin_addr)) {
+ fprintf(stderr, "op25_imbe_vocoder: inet_aton: bad IP address\n");
+ close(write_sock);
+ write_sock = 0;
+ return;
+ }
+ write_sock_addr.sin_family = AF_INET;
+ write_sock_addr.sin_port = htons(udp_port);
+}
+
+ } /* namespace op25_repeater */
+} /* namespace gr */
diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h
new file mode 100644
index 0000000..c8e0a36
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_IMPL_H
+#define INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_IMPL_H
+
+#include <op25_repeater/p25_frame_assembler.h>
+
+#include <gnuradio/msg_queue.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <deque>
+
+#include "p25_framer.h"
+
+typedef std::deque<uint8_t> dibit_queue;
+
+namespace gr {
+ namespace op25_repeater {
+
+ class p25_frame_assembler_impl : public p25_frame_assembler
+ {
+ private:
+
+ void init_sock(const char* udp_host, int udp_port);
+
+ // internal functions
+ typedef std::vector<bool> bit_vector;
+ bool header_codeword(uint64_t acc, uint32_t& nac, uint32_t& duid);
+ void proc_voice_unit(bit_vector& frame_body) ;
+ void process_duid(uint32_t const duid, uint32_t const nac, uint8_t const buf[], int const len);
+ // internal instance variables and state
+ int write_bufp;
+ int write_sock;
+ struct sockaddr_in write_sock_addr;
+ char write_buf[512];
+ const char* d_udp_host;
+ int d_port;
+ int d_debug;
+ bool d_do_imbe;
+ bool d_do_output;
+ bool d_do_msgq;
+ gr::msg_queue::sptr d_msg_queue;
+ dibit_queue symbol_queue;
+ p25_framer* framer;
+ struct timeval last_qtime;
+
+ public:
+ virtual void forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd);
+ // Nothing to declare in this block.
+
+ public:
+ p25_frame_assembler_impl(const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue);
+ ~p25_frame_assembler_impl();
+
+ // Where all the action really happens
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_P25_FRAME_ASSEMBLER_IMPL_H */
diff --git a/op25/gr-op25_repeater/lib/p25_framer.cc b/op25/gr-op25_repeater/lib/p25_framer.cc
new file mode 100644
index 0000000..738b2ff
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/p25_framer.cc
@@ -0,0 +1,161 @@
+/* -*- c++ -*- */
+/*
+ * construct P25 frames out of raw dibits
+ * Copyright 2010, 2011, 2012, 2013 KA1RBI
+ */
+
+#include <vector>
+#include <stdio.h>
+#include <stdint.h>
+#include <bch.h>
+#include <sys/time.h>
+#include <op25_p25_frame.h>
+#include <p25_framer.h>
+
+static const int max_frame_lengths[16] = {
+// lengths are in bits, not symbols
+ 792, // 0 - pdu
+ 0, 0, // 1, 2 - undef
+ 144, // 3 - tdu
+ 0, // 4 - undef
+ P25_VOICE_FRAME_SIZE, // 5 - ldu1
+ 0, // 6 - undef
+ 720, // 7 - trunking (FIXME: are there systems with longer ones?)
+ 0, // 8 - undef
+ 0, // 9 - VSELP "voice PDU"
+ P25_VOICE_FRAME_SIZE, // a - ldu2
+ 0, // b - undef
+ 720, // c - VSELP "voice PDU"
+ 0, 0, // d, e - undef
+ 432 // f - tdu
+};
+
+// constructor
+p25_framer::p25_framer() :
+ reverse_p(0),
+ nid_syms(0),
+ next_bit(0),
+ nid_accum(0),
+ frame_size_limit(0),
+ symbols_received(0),
+ frame_body(P25_VOICE_FRAME_SIZE)
+{
+}
+
+// destructor
+p25_framer::~p25_framer ()
+{
+}
+
+// count no. of 1 bits in masked, xor'ed, FS, return true if < threshold
+static inline bool check_frame_sync(uint64_t ch, int err_threshold) {
+ int errs=0;
+ for (int i=0; i < 48; i++) {
+ errs += (ch & 1);
+ ch = ch >> 1;
+ }
+ if (errs <= err_threshold) return 1;
+ return 0;
+}
+
+/*
+ * Process the 64 bits after the frame sync, which should be the frame NID
+ * 1. verify bch and reject if bch cannot be decoded
+ * 2. extract NAC and DUID
+ * Returns false if decode failure, else true
+ */
+bool p25_framer::nid_codeword(uint64_t acc) {
+ bit_vector cw(64);
+ bool low = acc & 1;
+ // for bch, split bits into codeword vector
+ for (int i=0; i < 64; i++) {
+ acc >>= 1;
+ cw[i] = acc & 1;
+ }
+
+ // do bch decode
+ int rc = bchDec(cw);
+
+ // check if bch decode unsuccessful
+ if (rc < 0) {
+ return false;
+ }
+
+ bch_errors = rc;
+
+ // load corrected bch bits into acc
+ acc = 0;
+ for (int i=63; i>=0; i--) {
+ acc |= cw[i];
+ acc <<= 1;
+ }
+ acc |= low; // FIXME
+
+ nid_word = acc; // reconstructed NID
+ // extract nac and duid
+ nac = (acc >> 52) & 0xfff;
+ duid = (acc >> 48) & 0x00f;
+
+ return true;
+}
+
+/*
+ * rx_sym: called once per received symbol
+ * 1. looks for flags sequences
+ * 2. after flags detected (nid_syms > 0), accumulate 64-bit NID word
+ * 3. do BCH check on completed NID
+ * 4. after valid BCH check (next_bit > 0), accumulate frame data bits
+ *
+ * Returns true when complete frame received, else false
+ */
+bool p25_framer::rx_sym(uint8_t dibit) {
+ symbols_received++;
+ bool rc = false;
+ dibit ^= reverse_p;
+ // FIXME assert(dibit >= 0 && dibit <= 3)
+ nid_accum <<= 2;
+ nid_accum |= dibit;
+ if (nid_syms == 12) {
+ // ignore status dibit
+ nid_accum >>= 2;
+ } else if (nid_syms >= 33) {
+ // nid completely received
+ nid_syms = 0;
+ bool bch_rc = nid_codeword(nid_accum);
+ if (bch_rc) { // if ok to start accumulating frame data
+ next_bit = 48 + 64;
+ frame_size_limit = max_frame_lengths[duid];
+ if (frame_size_limit <= next_bit)
+ // size isn't known a priori -
+ // fall back to max. size and wait for next FS
+ frame_size_limit = P25_VOICE_FRAME_SIZE;
+ }
+ }
+ if (nid_syms > 0) // if nid accumulation in progress
+ nid_syms++; // count symbols in nid
+
+ if(check_frame_sync((nid_accum & P25_FRAME_SYNC_MASK) ^ P25_FRAME_SYNC_MAGIC, 6)) {
+ nid_syms = 1;
+ }
+ if(check_frame_sync((nid_accum & P25_FRAME_SYNC_MASK) ^ P25_FRAME_SYNC_REV_P, 0)) {
+ nid_syms = 1;
+ reverse_p ^= 0x02; // auto flip polarity reversal
+ fprintf(stderr, "Reversed FS polarity detected - autocorrecting\n");
+ }
+ if (next_bit > 0) {
+ frame_body[next_bit++] = (dibit >> 1) & 1;
+ frame_body[next_bit++] = dibit & 1;
+ }
+ // dispose of received frame (if exists) and:
+ // 1. complete frame is received, or
+ // 2. flags is received
+ if ((next_bit > 0) && (next_bit >= frame_size_limit || nid_syms > 0)) {
+ if (nid_syms > 0) // if this was triggered by FS
+ next_bit -= 48; // FS has been added to body - remove it
+ p25_setup_frame_header(frame_body, nid_word);
+ frame_size = next_bit;
+ next_bit = 0;
+ rc = true; // set rc indicating frame available
+ }
+ return rc;
+}
diff --git a/op25/gr-op25_repeater/lib/p25_framer.h b/op25/gr-op25_repeater/lib/p25_framer.h
new file mode 100644
index 0000000..ddaf71c
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/p25_framer.h
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+
+/*
+ * construct P25 frames out of raw dibits
+ * Copyright 2010, KA1RBI
+ *
+ * usage: after constructing, call rx_sym once per received dibit.
+ * frame fields are available for inspection when true is returned
+ */
+
+#ifndef INCLUDED_P25_FRAMER_H
+#define INCLUDED_P25_FRAMER_H
+
+class p25_framer;
+
+class p25_framer
+{
+private:
+ typedef std::vector<bool> bit_vector;
+ // internal functions
+ bool nid_codeword(uint64_t acc);
+ // internal instance variables and state
+ uint8_t reverse_p;
+ int nid_syms;
+ uint32_t next_bit;
+ uint64_t nid_accum;
+
+ uint32_t frame_size_limit;
+
+public:
+ p25_framer(); // constructor
+ ~p25_framer (); // destructor
+ bool rx_sym(uint8_t dibit) ;
+
+ uint32_t symbols_received;
+
+ // info from received frame
+ uint64_t nid_word; // received NID word
+ uint32_t nac; // extracted NAC
+ uint32_t duid; // extracted DUID
+ bit_vector frame_body; // all bits in frame
+ uint32_t frame_size; // number of bits in frame_body
+ uint32_t bch_errors; // number of errors detected in bch
+};
+
+#endif /* INCLUDED_P25_FRAMER_H */
diff --git a/op25/gr-op25_repeater/lib/qa_op25_repeater.cc b/op25/gr-op25_repeater/lib/qa_op25_repeater.cc
new file mode 100644
index 0000000..3c63af3
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/qa_op25_repeater.cc
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 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 class gathers together all the test cases for the gr-filter
+ * directory into a single test suite. As you create new test cases,
+ * add them here.
+ */
+
+#include "qa_op25_repeater.h"
+
+CppUnit::TestSuite *
+qa_op25_repeater::suite()
+{
+ CppUnit::TestSuite *s = new CppUnit::TestSuite("op25_repeater");
+
+ return s;
+}
diff --git a/op25/gr-op25_repeater/lib/qa_op25_repeater.h b/op25/gr-op25_repeater/lib/qa_op25_repeater.h
new file mode 100644
index 0000000..402b5fe
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/qa_op25_repeater.h
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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 _QA_OP25_REPEATER_H_
+#define _QA_OP25_REPEATER_H_
+
+#include <gnuradio/attributes.h>
+#include <cppunit/TestSuite.h>
+
+//! collect all the tests for the gr-filter directory
+
+class __GR_ATTR_EXPORT qa_op25_repeater
+{
+ public:
+ //! return suite of tests for all of gr-filter directory
+ static CppUnit::TestSuite *suite();
+};
+
+#endif /* _QA_OP25_REPEATER_H_ */
diff --git a/op25/gr-op25_repeater/lib/rs.cc b/op25/gr-op25_repeater/lib/rs.cc
new file mode 100644
index 0000000..c14b783
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/rs.cc
@@ -0,0 +1,567 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <vector>
+#include <assert.h>
+#include <op25_imbe_frame.h>
+
+#ifdef DEBUG
+/*
+ * Convert bit vector to hex dump format and print
+ */
+static inline void
+dump_cw(const_bit_vector cw, int len, FILE* fp) // len in bytes
+{
+ int i, j;
+ for (i = 0; i < len; i++){
+ int p = 0;
+ for (j = 0; j < 8; j++){
+ p = (p << 1) + cw[ i*8 + j ];
+ }
+ fprintf(fp, "%02x ", p);
+ if (!((i+1) % 16))
+ fprintf(fp, "\n");
+ }
+ fprintf(fp, "\n");
+}
+#endif // DEBUG
+
+// this table used for HDU and also for TDU codeword mapping.
+// FIXME: possible dup of GOLAY_CODEWORDS in hdu.cc ?
+static const uint16_t hdu_codeword_bits[658] = { // 329 symbols = 324 + 5 pad
+ 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 144, 145, 146, 147,
+ 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
+ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
+ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
+ 212, 213, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
+ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+ 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261,
+ 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 284, 285, 288, 289, 290, 291, 292, 293, 294, 295,
+ 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327,
+ 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
+ 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 360, 361,
+ 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377,
+ 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
+ 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
+ 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425,
+ 426, 427, 428, 429, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443,
+ 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459,
+ 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475,
+ 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491,
+ 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 504, 505, 506, 507, 508, 509,
+ 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525,
+ 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541,
+ 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557,
+ 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573,
+ 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591,
+ 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607,
+ 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623,
+ 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639,
+ 640, 641, 642, 643, 644, 645, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657,
+ 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673,
+ 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689,
+ 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705,
+ 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 720, 721, 722, 723,
+ 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739,
+ 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755,
+ 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771,
+ 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787,
+ 788, 789 };
+
+static const uint32_t gly23127DecTbl[2048] = {
+ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 147459,
+ 1, 2, 2, 3, 2, 3, 3, 4268035, 2, 3, 3, 1574915, 3, 2097155, 294915, 4099,
+ 1, 2, 2, 3, 2, 3, 3, 147459, 2, 3, 3, 147459, 3, 147459, 147459, 147458,
+ 2, 3, 3, 32771, 3, 2051, 3149827, 786435, 3, 274435, 4194307, 2162691, 589827, 5275651, 10243, 147459,
+ 1, 2, 2, 3, 2, 3, 3, 2621443, 2, 3, 3, 8195, 3, 1118211, 294915, 4196355,
+ 2, 3, 3, 135171, 3, 2051, 294915, 1064963, 3, 4210691, 294915, 2162691, 294915, 663555, 294914, 294915,
+ 2, 3, 3, 5505027, 3, 2051, 65539, 45059, 3, 557059, 6147, 2162691, 6299651, 262147, 1572867, 147459,
+ 3, 2051, 548867, 2162691, 2051, 2050, 4325379, 2051, 1179651, 2162691, 2162691, 2162690, 20483, 2051, 294915, 2162691,
+ 1, 2, 2, 3, 2, 3, 3, 2621443, 2, 3, 3, 327683, 3, 43011, 5242883, 4099,
+ 2, 3, 3, 32771, 3, 1441795, 18435, 4099, 3, 4210691, 2236419, 4099, 589827, 4099, 4099, 4098,
+ 2, 3, 3, 32771, 3, 4198403, 270339, 1116163, 3, 3145731, 6147, 4726787, 589827, 262147, 2129923, 147459,
+ 3, 32771, 32771, 32770, 589827, 2121731, 4325379, 32771, 589827, 133123, 1327107, 32771, 589826, 589827, 589827, 4099,
+ 2, 3, 3, 2621443, 3, 2621443, 2621443, 2621442, 3, 4210691, 6147, 1212419, 131075, 262147, 90115, 2621443,
+ 3, 4210691, 1114115, 272387, 12291, 98307, 4325379, 2621443, 4210691, 4210690, 524291, 4210691, 3147779, 4210691, 294915, 4099,
+ 3, 204803, 6147, 16387, 1097731, 262147, 4325379, 2621443, 6147, 262147, 6146, 6147, 262147, 262146, 6147, 262147,
+ 2359299, 1576963, 4325379, 32771, 4325379, 2051, 4325378, 4325379, 40963, 4210691, 6147, 2162691, 589827, 262147, 4325379, 1056771,
+ 1, 2, 2, 3, 2, 3, 3, 268291, 2, 3, 3, 8195, 3, 2097155, 5242883, 622595,
+ 2, 3, 3, 32771, 3, 2097155, 655363, 1064963, 3, 2097155, 86019, 4587523, 2097155, 2097154, 10243, 2097155,
+ 2, 3, 3, 32771, 3, 1581059, 65539, 6291459, 3, 4261891, 2883587, 1052675, 36867, 262147, 10243, 147459,
+ 3, 32771, 32771, 32770, 4472835, 200707, 10243, 32771, 1179651, 540675, 10243, 32771, 10243, 2097155, 10242, 10243,
+ 2, 3, 3, 8195, 3, 4358147, 65539, 1064963, 3, 8195, 8195, 8194, 542723, 262147, 2232323, 8195,
+ 3, 851971, 6293507, 1064963, 12291, 1064963, 1064963, 1064962, 1179651, 38915, 524291, 8195, 4259843, 2097155, 294915, 1064963,
+ 3, 2117635, 65539, 657411, 65539, 262147, 65538, 65539, 1179651, 262147, 4243459, 8195, 262147, 262146, 65539, 262147,
+ 1179651, 4202499, 266243, 32771, 2654211, 2051, 65539, 1064963, 1179650, 1179651, 1179651, 2162691, 1179651, 262147, 10243, 4722691,
+ 2, 3, 3, 32771, 3, 81923, 5242883, 139267, 3, 659459, 5242883, 2115587, 5242883, 262147, 5242882, 5242883,
+ 3, 32771, 32771, 32770, 12291, 4720643, 2424835, 32771, 264195, 1122307, 524291, 32771, 180227, 2097155, 5242883, 4099,
+ 3, 32771, 32771, 32770, 2230275, 262147, 544771, 32771, 24579, 262147, 196611, 32771, 262147, 262146, 5242883, 262147,
+ 32771, 32770, 32770, 32769, 1048579, 32771, 32771, 32770, 6295555, 32771, 32771, 32770, 589827, 262147, 10243, 32771,
+ 3, 1050627, 409603, 4263939, 12291, 262147, 34819, 2621443, 2195459, 262147, 524291, 8195, 262147, 262146, 5242883, 262147,
+ 12291, 2228227, 524291, 32771, 12290, 12291, 12291, 1064963, 524291, 4210691, 524290, 524291, 12291, 262147, 524291, 198659,
+ 4718595, 262147, 3153923, 32771, 262147, 262146, 65539, 262147, 262147, 262146, 6147, 262147, 262146, 262145, 262147, 262146,
+ 83971, 32771, 32771, 32770, 12291, 262147, 4325379, 32771, 1179651, 262147, 524291, 32771, 262147, 262146, 2113539, 262147,
+ 1, 2, 2, 3, 2, 3, 3, 1081347, 2, 3, 3, 327683, 3, 2097155, 536579, 4196355,
+ 2, 3, 3, 135171, 3, 2097155, 18435, 786435, 3, 2097155, 4194307, 57347, 2097155, 2097154, 1245187, 2097155,
+ 2, 3, 3, 2107395, 3, 4198403, 65539, 786435, 3, 557059, 4194307, 1052675, 1312771, 73731, 2129923, 147459,
+ 3, 1130499, 4194307, 786435, 172035, 786435, 786435, 786434, 4194307, 133123, 4194306, 4194307, 20483, 2097155, 4194307, 786435,
+ 2, 3, 3, 135171, 3, 286723, 65539, 4196355, 3, 557059, 3162115, 4196355, 131075, 4196355, 4196355, 4196354,
+ 3, 135171, 135171, 135170, 5767171, 98307, 2105347, 135171, 75779, 1310723, 524291, 135171, 20483, 2097155, 294915, 4196355,
+ 3, 557059, 65539, 16387, 65539, 3276803, 65538, 65539, 557059, 557058, 401411, 557059, 20483, 557059, 65539, 4196355,
+ 2359299, 4202499, 1083395, 135171, 20483, 2051, 65539, 786435, 20483, 557059, 4194307, 2162691, 20482, 20483, 20483, 1056771,
+ 2, 3, 3, 327683, 3, 4198403, 18435, 139267, 3, 327683, 327683, 327682, 131075, 1589251, 2129923, 327683,
+ 3, 532483, 18435, 7340035, 18435, 98307, 18434, 18435, 1085443, 133123, 524291, 327683, 4464643, 2097155, 18435, 4099,
+ 3, 4198403, 1703939, 16387, 4198403, 4198402, 2129923, 4198403, 24579, 133123, 2129923, 327683, 2129923, 4198403, 2129922, 2129923,
+ 2359299, 133123, 77827, 32771, 1048579, 4198403, 18435, 786435, 133123, 133122, 4194307, 133123, 589827, 133123, 2129923, 1056771,
+ 3, 1050627, 4235267, 16387, 131075, 98307, 1314819, 2621443, 131075, 2109443, 524291, 327683, 131074, 131075, 131075, 4196355,
+ 2359299, 98307, 524291, 135171, 98307, 98306, 18435, 98307, 524291, 4210691, 524290, 524291, 131075, 98307, 524291, 1056771,
+ 2359299, 16387, 16387, 16386, 534531, 4198403, 65539, 16387, 5308419, 557059, 6147, 16387, 131075, 262147, 2129923, 1056771,
+ 2359298, 2359299, 2359299, 16387, 2359299, 98307, 4325379, 1056771, 2359299, 133123, 524291, 1056771, 20483, 1056771, 1056771, 1056770,
+ 2, 3, 3, 4734979, 3, 2097155, 65539, 139267, 3, 2097155, 165891, 1052675, 2097155, 2097154, 278531, 2097155,
+ 3, 2097155, 1318915, 67587, 2097155, 2097154, 4231171, 2097155, 2097155, 2097154, 524291, 2097155, 2097154, 2097153, 2097155, 2097154,
+ 3, 393219, 65539, 1052675, 65539, 51203, 65538, 65539, 24579, 1052675, 1052675, 1052674, 4849667, 2097155, 65539, 1052675,
+ 530435, 4202499, 2244611, 32771, 1048579, 2097155, 65539, 786435, 360451, 2097155, 4194307, 1052675, 2097155, 2097154, 10243, 2097155,
+ 3, 1050627, 65539, 2392067, 65539, 528387, 65538, 65539, 4460547, 212995, 524291, 8195, 1089539, 2097155, 65539, 4196355,
+ 49155, 4202499, 524291, 135171, 395267, 2097155, 65539, 1064963, 524291, 2097155, 524290, 524291, 2097155, 2097154, 524291, 2097155,
+ 65539, 4202499, 65538, 65539, 65538, 65539, 65537, 65538, 2099203, 557059, 65539, 1052675, 65539, 262147, 65538, 65539,
+ 4202499, 4202498, 65539, 4202499, 65539, 4202499, 65538, 65539, 1179651, 4202499, 524291, 280579, 20483, 2097155, 65539, 163843,
+ 3, 1050627, 2101251, 139267, 819203, 139267, 139267, 139266, 24579, 4227075, 524291, 327683, 71683, 2097155, 5242883, 139267,
+ 4390915, 282627, 524291, 32771, 1048579, 2097155, 18435, 139267, 524291, 2097155, 524290, 524291, 2097155, 2097154, 524291, 2097155,
+ 24579, 2686979, 4458499, 32771, 1048579, 4198403, 65539, 139267, 24578, 24579, 24579, 1052675, 24579, 262147, 2129923, 526339,
+ 1048579, 32771, 32771, 32770, 1048578, 1048579, 1048579, 32771, 24579, 133123, 524291, 32771, 1048579, 2097155, 397315, 4276227,
+ 1050627, 1050626, 524291, 1050627, 6307843, 1050627, 65539, 139267, 524291, 1050627, 524290, 524291, 131075, 262147, 524291, 53251,
+ 524291, 1050627, 524290, 524291, 12291, 98307, 524291, 4456451, 524290, 524291, 524289, 524290, 524291, 2097155, 524290, 524291,
+ 167939, 1050627, 65539, 16387, 65539, 262147, 65538, 65539, 24579, 262147, 524291, 6422531, 262147, 262146, 65539, 262147,
+ 2359299, 4202499, 524291, 32771, 1048579, 671747, 65539, 2103299, 524291, 69635, 524290, 524291, 4229123, 262147, 524291, 1056771,
+ 1, 2, 2, 3, 2, 3, 3, 1081347, 2, 3, 3, 8195, 3, 4980739, 2164739, 4099,
+ 2, 3, 3, 2375683, 3, 2051, 655363, 4099, 3, 229379, 4194307, 4099, 1073155, 4099, 4099, 4098,
+ 2, 3, 3, 593923, 3, 2051, 270339, 6291459, 3, 3145731, 4194307, 296963, 36867, 73731, 1572867, 147459,
+ 3, 2051, 4194307, 1187843, 2051, 2050, 114691, 2051, 4194307, 540675, 4194306, 4194307, 2490371, 2051, 4194307, 4099,
+ 2, 3, 3, 8195, 3, 2051, 4214787, 458755, 3, 8195, 8195, 8194, 131075, 2146307, 1572867, 8195,
+ 3, 2051, 1114115, 4751363, 2051, 2050, 2105347, 2051, 2625539, 1310723, 149507, 8195, 4259843, 2051, 294915, 4099,
+ 3, 2051, 2260995, 16387, 2051, 2050, 1572867, 2051, 344067, 4329475, 1572867, 8195, 1572867, 2051, 1572866, 1572867,
+ 2051, 2050, 266243, 2051, 2050, 2049, 2051, 2050, 40963, 2051, 4194307, 2162691, 2051, 2050, 1572867, 2051,
+ 2, 3, 3, 4327427, 3, 81923, 270339, 4099, 3, 3145731, 573443, 4099, 131075, 4099, 4099, 4098,
+ 3, 532483, 1114115, 4099, 6324227, 4099, 4099, 4098, 264195, 4099, 4099, 4098, 4099, 4098, 4098, 4097,
+ 3, 3145731, 270339, 16387, 270339, 688131, 270338, 270339, 3145731, 3145730, 196611, 3145731, 4212739, 3145731, 270339, 4099,
+ 151555, 4521987, 2623491, 32771, 1048579, 2051, 270339, 4099, 40963, 3145731, 4194307, 4099, 589827, 4099, 4099, 4098,
+ 3, 299011, 1114115, 16387, 131075, 5251075, 34819, 2621443, 131075, 591875, 6553603, 8195, 131074, 131075, 131075, 4099,
+ 1114115, 2228227, 1114114, 1114115, 802819, 2051, 1114115, 4099, 40963, 4210691, 1114115, 4099, 131075, 4099, 4099, 4098,
+ 4718595, 16387, 16387, 16386, 2166787, 2051, 270339, 16387, 40963, 3145731, 6147, 16387, 131075, 262147, 1572867, 4292611,
+ 40963, 2051, 1114115, 16387, 2051, 2050, 4325379, 2051, 40962, 40963, 40963, 917507, 40963, 2051, 2113539, 4099,
+ 2, 3, 3, 8195, 3, 81923, 655363, 6291459, 3, 8195, 8195, 8194, 36867, 1181699, 278531, 8195,
+ 3, 5246979, 655363, 67587, 655363, 303107, 655362, 655363, 264195, 540675, 3178499, 8195, 4259843, 2097155, 655363, 4099,
+ 3, 393219, 1067011, 6291459, 36867, 6291459, 6291459, 6291458, 36867, 540675, 196611, 8195, 36866, 36867, 36867, 6291459,
+ 2170883, 540675, 266243, 32771, 1048579, 2051, 655363, 6291459, 540675, 540674, 4194307, 540675, 36867, 540675, 10243, 1376259,
+ 3, 8195, 8195, 8194, 3407875, 528387, 34819, 8195, 8195, 8194, 8194, 8193, 4259843, 8195, 8195, 8194,
+ 49155, 2228227, 266243, 8195, 4259843, 2051, 655363, 1064963, 4259843, 8195, 8195, 8194, 4259842, 4259843, 4259843, 8195,
+ 4718595, 1146883, 266243, 8195, 155651, 2051, 65539, 6291459, 2099203, 8195, 8195, 8194, 36867, 262147, 1572867, 8195,
+ 266243, 2051, 266242, 266243, 2051, 2050, 266243, 2051, 1179651, 540675, 266243, 8195, 4259843, 2051, 2113539, 163843,
+ 3, 81923, 2101251, 1835011, 81923, 81922, 34819, 81923, 264195, 4227075, 196611, 8195, 2629635, 81923, 5242883, 4099,
+ 264195, 2228227, 4218883, 32771, 1048579, 81923, 655363, 4099, 264194, 264195, 264195, 4099, 264195, 4099, 4099, 4098,
+ 4718595, 14339, 196611, 32771, 1048579, 81923, 270339, 6291459, 196611, 3145731, 196610, 196611, 36867, 262147, 196611, 526339,
+ 1048579, 32771, 32771, 32770, 1048578, 1048579, 1048579, 32771, 264195, 540675, 196611, 32771, 1048579, 4333571, 2113539, 4099,
+ 4718595, 2228227, 34819, 8195, 34819, 81923, 34818, 34819, 1069059, 8195, 8195, 8194, 131075, 262147, 34819, 8195,
+ 2228227, 2228226, 1114115, 2228227, 12291, 2228227, 34819, 4456451, 264195, 2228227, 524291, 8195, 4259843, 1605635, 2113539, 4099,
+ 4718594, 4718595, 4718595, 16387, 4718595, 262147, 34819, 1183747, 4718595, 262147, 196611, 8195, 262147, 262146, 2113539, 262147,
+ 4718595, 2228227, 266243, 32771, 1048579, 2051, 2113539, 598019, 40963, 69635, 2113539, 5244931, 2113539, 262147, 2113538, 2113539,
+ 2, 3, 3, 1081347, 3, 1081347, 1081347, 1081346, 3, 22531, 4194307, 2752515, 131075, 73731, 278531, 1081347,
+ 3, 532483, 4194307, 67587, 331779, 4341763, 2105347, 1081347, 4194307, 1310723, 4194306, 4194307, 559107, 2097155, 4194307, 4099,
+ 3, 393219, 4194307, 16387, 2637827, 73731, 137219, 1081347, 4194307, 73731, 4194306, 4194307, 73731, 73730, 4194307, 73731,
+ 4194307, 2134019, 4194306, 4194307, 1048579, 2051, 4194307, 786435, 4194306, 4194307, 4194305, 4194306, 4194307, 73731, 4194306, 4194307,
+ 3, 6356995, 788483, 16387, 131075, 528387, 2105347, 1081347, 131075, 1310723, 102403, 8195, 131074, 131075, 131075, 4196355,
+ 49155, 1310723, 2105347, 135171, 2105347, 2051, 2105346, 2105347, 1310723, 1310722, 4194307, 1310723, 131075, 1310723, 2105347, 606211,
+ 1060867, 16387, 16387, 16386, 4489219, 2051, 65539, 16387, 2099203, 557059, 4194307, 16387, 131075, 73731, 1572867, 2363395,
+ 720899, 2051, 4194307, 16387, 2051, 2050, 2105347, 2051, 4194307, 1310723, 4194306, 4194307, 20483, 2051, 4194307, 163843,
+ 3, 532483, 2101251, 16387, 131075, 2361347, 4784131, 1081347, 131075, 4227075, 1058819, 327683, 131074, 131075, 131075, 4099,
+ 532483, 532482, 425987, 532483, 1048579, 532483, 18435, 4099, 2179075, 532483, 4194307, 4099, 131075, 4099, 4099, 4098,
+ 100355, 16387, 16387, 16386, 1048579, 4198403, 270339, 16387, 790531, 3145731, 4194307, 16387, 131075, 73731, 2129923, 526339,
+ 1048579, 532483, 4194307, 16387, 1048578, 1048579, 1048579, 2293763, 4194307, 133123, 4194306, 4194307, 1048579, 311299, 4194307, 4099,
+ 131075, 16387, 16387, 16386, 131074, 131075, 131075, 16387, 131074, 131075, 131075, 16387, 131073, 131074, 131074, 131075,
+ 4200451, 532483, 1114115, 16387, 131075, 98307, 2105347, 4456451, 131075, 1310723, 524291, 2131971, 131074, 131075, 131075, 4099,
+ 16387, 16386, 16386, 16385, 131075, 16387, 16387, 16386, 131075, 16387, 16387, 16386, 131074, 131075, 131075, 16387,
+ 2359299, 16387, 16387, 16386, 1048579, 2051, 561155, 16387, 40963, 69635, 4194307, 16387, 131075, 6815747, 329731, 1056771,
+ 3, 393219, 2101251, 67587, 4204547, 528387, 278531, 1081347, 1638403, 4227075, 278531, 8195, 278531, 2097155, 278530, 278531,
+ 49155, 67587, 67587, 67586, 1048579, 2097155, 655363, 67587, 143363, 2097155, 4194307, 67587, 2097155, 2097154, 278531, 2097155,
+ 393219, 393218, 565251, 393219, 1048579, 393219, 65539, 6291459, 2099203, 393219, 4194307, 1052675, 36867, 73731, 278531, 526339,
+ 1048579, 393219, 4194307, 67587, 1048578, 1048579, 1048579, 28675, 4194307, 540675, 4194306, 4194307, 1048579, 2097155, 4194307, 163843,
+ 49155, 528387, 5373955, 8195, 528387, 528386, 65539, 528387, 2099203, 8195, 8195, 8194, 131075, 528387, 278531, 8195,
+ 49154, 49155, 49155, 67587, 49155, 528387, 2105347, 4456451, 49155, 1310723, 524291, 8195, 4259843, 2097155, 1054723, 163843,
+ 2099203, 393219, 65539, 16387, 65539, 528387, 65538, 65539, 2099202, 2099203, 2099203, 8195, 2099203, 5259267, 65539, 163843,
+ 49155, 4202499, 266243, 3670019, 1048579, 2051, 65539, 163843, 2099203, 69635, 4194307, 163843, 794627, 163843, 163843, 163842,
+ 2101251, 4227075, 2101250, 2101251, 1048579, 81923, 2101251, 139267, 4227075, 4227074, 2101251, 4227075, 131075, 4227075, 278531, 526339,
+ 1048579, 532483, 2101251, 67587, 1048578, 1048579, 1048579, 4456451, 264195, 4227075, 524291, 1196035, 1048579, 2097155, 106499, 4099,
+ 1048579, 393219, 2101251, 16387, 1048578, 1048579, 1048579, 526339, 24579, 4227075, 196611, 526339, 1048579, 526339, 526339, 526338,
+ 1048578, 1048579, 1048579, 32771, 1048577, 1048578, 1048578, 1048579, 1048579, 69635, 4194307, 2367491, 1048578, 1048579, 1048579, 526339,
+ 335875, 1050627, 2101251, 16387, 131075, 528387, 34819, 4456451, 131075, 4227075, 524291, 8195, 131074, 131075, 131075, 3211267,
+ 49155, 2228227, 524291, 4456451, 1048579, 4456451, 4456451, 4456450, 524291, 69635, 524290, 524291, 131075, 26627, 524291, 4456451,
+ 4718595, 16387, 16387, 16386, 1048579, 2138115, 65539, 16387, 2099203, 69635, 1343491, 16387, 131075, 262147, 4206595, 526339,
+ 1048579, 69635, 141315, 16387, 1048578, 1048579, 1048579, 4456451, 69635, 69634, 524291, 69635, 1048579, 69635, 2113539, 163843 };
+
+static const uint32_t hmg1063EncTbl[64] = {
+ 0, 12, 3, 15, 7, 11, 4, 8, 11, 7, 8, 4, 12, 0, 15, 3,
+ 13, 1, 14, 2, 10, 6, 9, 5, 6, 10, 5, 9, 1, 13, 2, 14,
+ 14, 2, 13, 1, 9, 5, 10, 6, 5, 9, 6, 10, 2, 14, 1, 13,
+ 3, 15, 0, 12, 4, 8, 7, 11, 8, 4, 11, 7, 15, 3, 12, 0 };
+static const uint32_t hmg1063DecTbl[16] = {
+ 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 8, 1, 16, 32, 0 };
+
+static const uint32_t rsGFexp[64] = {
+ 1, 2, 4, 8, 16, 32, 3, 6, 12, 24, 48, 35, 5, 10, 20, 40,
+ 19, 38, 15, 30, 60, 59, 53, 41, 17, 34, 7, 14, 28, 56, 51, 37,
+ 9, 18, 36, 11, 22, 44, 27, 54, 47, 29, 58, 55, 45, 25, 50, 39,
+ 13, 26, 52, 43, 21, 42, 23, 46, 31, 62, 63, 61, 57, 49, 33, 0 };
+static const uint32_t rsGFlog[64] = {
+ 63, 0, 1, 6, 2, 12, 7, 26, 3, 32, 13, 35, 8, 48, 27, 18,
+ 4, 24, 33, 16, 14, 52, 36, 54, 9, 45, 49, 38, 28, 41, 19, 56,
+ 5, 62, 25, 11, 34, 31, 17, 47, 15, 23, 53, 51, 37, 44, 55, 40,
+ 10, 61, 46, 30, 50, 22, 39, 43, 29, 60, 42, 21, 20, 59, 57, 58 };
+
+int hmg1063Dec (uint32_t Dat, uint32_t Par) {
+ assert ((Dat < 64) && (Par < 16));
+ return Dat ^ hmg1063DecTbl [ hmg1063EncTbl[Dat] ^ Par];
+}
+
+int
+rsDec (int nroots, int FirstInfo, uint8_t HB[]) {
+
+//RS (63,63-nroots,nroots+1) decoder where nroots = number of parity bits
+// rsDec(8, 39) rsDec(16, 27) rsDec(12, 39)
+
+
+int lambda[18] ;//Err+Eras Locator poly
+int S[17] ;//syndrome poly
+int b[18] ;
+int t[18] ;
+int omega[18] ;
+int root[17] ;
+int reg[18] ;
+int locn[17] ;
+
+int i,j, count, r, el, SynError, DiscrR, q, DegOmega, tmp, num1, num2, den, DegLambda;
+
+//form the syndromes; i.e., evaluate HB(x) at roots of g(x)
+
+for (i = 0; i <= nroots - 1; i++) {
+ S[i] = HB[0];
+}
+for (j = 1; j <= 62; j++) {
+ for (i = 0; i <= nroots - 1; i++) {
+ if (S[i] == 0) {
+ S[i] = HB[j];
+ } else {
+ S[i] = HB[j] ^ rsGFexp[(rsGFlog[S[i]] + i + 1) % 63];
+ }
+ }
+}
+
+
+
+//convert syndromes to index form, checking for nonzero condition
+
+SynError = 0;
+
+for (i = 0; i <= nroots - 1; i++) {
+ SynError = SynError | S[i];
+ S[i] = rsGFlog[S[i]];
+}
+
+if (SynError == 0) {
+ //if syndrome is zero, rsData[] is a codeword and there are
+ //no errors to correct. So return rsData[] unmodified
+ count = 0;
+ goto rsDecFinish;
+}
+
+for (i = 1; i <= nroots; i++) {
+ lambda[i] = 0;
+}
+lambda[0] = 1;
+
+for (i = 0; i <= nroots; i++) {
+ b[i] = rsGFlog[lambda[i]];
+}
+
+
+
+//begin Berlekamp-Massey algorithm to determine error+erasure
+//locator polynomial
+
+r = 0;
+el = 0;
+while ( r < nroots) { //r is the step number
+ r = r + 1;
+ //compute discrepancy at the r-th step in poly-form
+ DiscrR = 0;
+ for (i = 0; i <= r - 1; i++) {
+ if ((lambda[i] != 0) && (S[r - i - 1] != 63)) {
+ DiscrR = DiscrR ^ rsGFexp[(rsGFlog[lambda[i]] + S[r - i - 1]) % 63];
+ }
+ }
+ DiscrR = rsGFlog[DiscrR] ;//index form
+
+ if (DiscrR == 63) {
+ //shift elements upward one step
+ for (i = nroots; i >= 1; i += -1){b[i] = b[i - 1]; } b[0] = 63;
+ } else {
+ //t(x) <-- lambda(x) - DiscrR*x*b(x)
+ t[0] = lambda[0];
+ for (i = 0; i <= nroots - 1; i++) {
+ if (b[i] != 63) {
+ t[i + 1] = lambda[i + 1] ^ rsGFexp[(DiscrR + b[i]) % 63];
+ } else {
+ t[i + 1] = lambda[i + 1];
+ }
+ }
+ if (2 * el <= r - 1) {
+ el = r - el;
+ //b(x) <-- inv(DiscrR) * lambda(x)
+ for (i = 0; i <= nroots; i++) {
+ if (lambda[i]) { b[i] = (rsGFlog[lambda[i]] - DiscrR + 63) % 63; } else { b[i] = 63; }
+ }
+ } else {
+ //shift elements upward one step
+ for (i = nroots; i >= 1; i += -1){b[i] = b[i - 1]; } b[0] = 63;
+ }
+ for (i = 0; i <= nroots; i++) { lambda[i] = t[i]; }
+ }
+} /* end while() */
+
+
+
+//convert lambda to index form and compute deg(lambda(x))
+
+DegLambda = 0;
+for (i = 0; i <= nroots; i++) {
+ lambda[i] = rsGFlog[lambda[i]];
+ if (lambda[i] != 63) { DegLambda = i; }
+}
+
+
+
+//Find roots of the error+erasure locator polynomial by Chien search
+
+for (i = 1; i <= nroots; i++) { reg[i] = lambda[i]; }
+count = 0 ;//number of roots of lambda(x)
+for (i = 1; i <= 63; i++) {
+ q = 1 ;//lambda[0] is always 0
+ for (j = DegLambda; j >= 1; j += -1) {
+ if (reg[j] != 63) {
+ reg[j] = (reg[j] + j) % 63;
+ q = q ^ rsGFexp[reg[j]];
+ }
+ }
+ if (q == 0) { //it is a root
+ //store root (index-form) and error location number
+ root[count] = i;
+ locn[count] = i - 1;
+ //if wehave max possible roots, abort search to save time
+ count = count + 1; if (count == DegLambda) { break; }
+ }
+}
+
+if (DegLambda != count) {
+ //deg(lambda) unequal to number of roots => uncorrectable error detected
+ count = -1;
+ goto rsDecFinish;
+}
+
+
+
+//compute err+eras evaluator poly omega(x)
+// = s(x)*lambda(x) (modulo x**nroots). in index form. Also find deg(omega).
+
+DegOmega = 0;
+for (i = 0; i <= nroots - 1; i++) {
+ tmp = 0;
+ if (DegLambda < i) { j = DegLambda; } else { j = i; }
+ for ( /* j = j */ ; j >= 0; j += -1) {
+ if ((S[i - j] != 63) && (lambda[j] != 63)) {
+ tmp = tmp ^ rsGFexp[(S[i - j] + lambda[j]) % 63];
+ }
+ }
+ if (tmp) { DegOmega = i; }
+ omega[i] = rsGFlog[tmp];
+}
+omega[nroots] = 63;
+
+
+//compute error values in poly-form:
+// num1 = omega(inv(X(l)))
+// num2 = inv(X(l))**(FCR - 1)
+// den = lambda_pr(inv(X(l)))
+
+for (j = count - 1; j >= 0; j += -1) {
+ num1 = 0;
+ for (i = DegOmega; i >= 0; i += -1) {
+ if (omega[i] != 63) {
+ num1 = num1 ^ rsGFexp[(omega[i] + i * root[j]) % 63];
+ }
+ }
+ num2 = rsGFexp[0];
+ den = 0;
+
+ // lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i]
+ if (DegLambda < nroots) { i = DegLambda; } else { i = nroots; }
+ for (i = i & ~1; i >= 0; i += -2) {
+ if (lambda[i + 1] != 63) {
+ den = den ^ rsGFexp[(lambda[i + 1] + i * root[j]) % 63];
+ }
+ }
+ if (den == 0) { count = -1; goto rsDecFinish; }
+
+ // apply error to data
+ if (num1 != 0) {
+ if (locn[j] < FirstInfo) { count = -1; goto rsDecFinish ; } //added by me
+ HB[locn[j]] = HB[locn[j]] ^ (rsGFexp[(rsGFlog[num1] + rsGFlog[num2] + 63 - rsGFlog[den]) % 63]);
+ }
+}
+
+
+rsDecFinish:
+return (count);
+
+}
+
+/*********************************************************************/
+/*********************************************************************/
+/*********************************************************************/
+
+uint32_t gly23127GetSyn (uint32_t pattern) {
+
+uint32_t aux = 0x400000;
+
+while(pattern & 0xFFFFF800) {
+ while ((aux & pattern) == 0) {
+ aux = aux >> 1;
+ }
+ pattern = pattern ^ (aux / 0x800 * 0xC75) ;//generator is C75
+}
+
+return pattern;
+
+}
+
+uint32_t gly24128Dec (uint32_t n) {
+
+//based on gly23127Dec
+
+uint32_t CW = n >> 1 ; //toss the parity bit
+uint32_t correction = gly23127DecTbl[gly23127GetSyn(CW)];
+CW = (CW ^ correction) >> 11;
+
+return CW;
+
+}
+
+void ProcHDU(const_bit_vector A) {
+int i, j, k, ec;
+uint8_t HB[63]; // "hexbit" array
+
+//header code word is 324 dibits (padded by 5 trailing zero dibits)
+// 324 dibits = 648 bits = 36 18-bit Golay codewords
+
+//do (18,6,8) shortened Golay decode - make 36 hexbits for rs dec
+for (i = 0; i <= 26; i++) {
+ HB[i] = 0;
+}
+k = 0;
+for (i = 0; i < 36; i ++) { // 36 codewords
+ uint32_t CW = 0;
+ for (j = 0; j < 18; j++) { // 18 bits / cw
+ CW = (CW << 1) + A [ hdu_codeword_bits[k++] ];
+ }
+ HB[27 + i] = gly24128Dec(CW) & 63;
+}
+
+//do (36,20,17) RS decode
+ec = rsDec(16, 27, HB);
+//120 info bits = 20 hexbits: (27..46)
+ //72 bits MI: (27..38)
+ // 8 bits MFID
+ // 8 bits ALGID
+ //16 bits KID
+ //16 bits TGID
+
+uint32_t MFID = HB[39] * 4 + (HB[40] >> 4);
+uint32_t ALGID = (HB[40] & 15) * 16 + (HB[41] >> 2);
+uint32_t KID = (HB[41] & 3) * 16384 + HB[42] * 256 + HB[43] * 4 + (HB[44] >> 4);
+uint32_t TGID = (HB[44] & 15) * 4096 + HB[45] * 64 + HB[46];
+
+fprintf (stderr, " HDU: rc %d mfid %x alg %x kid %x tgid %d", ec, MFID, ALGID, KID, TGID);
+
+}
+
+void ProcLLDU(const_bit_vector A, uint8_t HB[]) {
+int i, j, k;
+for (i = 0; i <= 38; i++) {
+ HB[i] = 0;
+}
+k = 0;
+for (i = 0; i < 24; i ++) { // 24 10-bit codewords
+ uint32_t CW = 0;
+ for (j = 0; j < 10; j++) { // 10 bits / cw
+ CW = (CW << 1) + A [ imbe_ldu_ls_data_bits[k++] ];
+ }
+ HB[39 + i] = hmg1063Dec( CW >> 4, CW & 0xF );
+}
+
+}
+
+void ProcLC(uint8_t HB[]) {
+ int ec = rsDec(12, 39, HB);
+ int pb = HB[39] >> 5;
+ int sf = (HB[39] & 16) >> 4;
+ int lco = (HB[39] and 15) * 4 + (HB[40] >> 4);
+ fprintf(stderr, " LC: rc %d pb %d sf %d lco %d", ec, pb, sf, lco);
+}
+
+void ProcLDU1(const_bit_vector A) {
+ uint8_t HB[63]; // "hexbit" array
+
+ ProcLLDU(A, HB);
+ ProcLC(HB);
+}
+
+void ProcLDU2(const_bit_vector A) {
+ uint8_t HB[63]; // "hexbit" array
+
+ ProcLLDU(A, HB);
+ int ec = rsDec(8, 39, HB);
+
+ uint32_t ALGID = HB[51] * 4 + (HB[52] >> 4);
+ uint32_t KID = (HB[52] & 15) * 4096 + HB[53] * 64 + HB[54];
+
+ fprintf(stderr, " LDU2: rc %d ALGID %x KID %x MI ", ec, ALGID, KID);
+ for (int i = 39; i <= 50; i++) {
+ fprintf(stderr, "%02x ", HB[ i ]);
+ }
+ // fprintf(stderr, "\n");
+}
+
+void ProcTDU(const_bit_vector A) {
+uint8_t HB[63]; // "hexbit" array
+
+int i, j, k;
+for (i = 0; i <= 38; i++) {
+ HB[i] = 0;
+}
+k = 0;
+for (i = 0; i <= 22; i += 2) {
+ uint32_t CW = 0;
+ for (j = 0; j < 12; j++) { // 12 24-bit codewords
+ CW = (CW << 1) + A [ hdu_codeword_bits[k++] ];
+ CW = (CW << 1) + A [ hdu_codeword_bits[k++] ];
+ }
+ uint32_t D = gly24128Dec(CW);
+ HB[39 + i] = D >> 6;
+ HB[40 + i] = D & 63;
+}
+ProcLC(HB);
+}
+
diff --git a/op25/gr-op25_repeater/lib/rs.h b/op25/gr-op25_repeater/lib/rs.h
new file mode 100644
index 0000000..6b2544f
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/rs.h
@@ -0,0 +1,15 @@
+
+#ifndef INCLUDED_OP25_RS_H
+#define INCLUDED_OP25_RS_H
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <vector>
+#include <op25_imbe_frame.h>
+
+void ProcHDU(const_bit_vector A);
+void ProcTDU(const_bit_vector A);
+void ProcLDU1(const_bit_vector A);
+void ProcLDU2(const_bit_vector A);
+
+#endif
diff --git a/op25/gr-op25_repeater/lib/software_imbe_decoder.cc b/op25/gr-op25_repeater/lib/software_imbe_decoder.cc
new file mode 100644
index 0000000..fecf5c1
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/software_imbe_decoder.cc
@@ -0,0 +1,1436 @@
+/* -*- C++ -*- */
+
+/*
+ * Copyright 2008-2009 Steve Glass
+ *
+ * This file is part of OP25.
+ *
+ * OP25 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.
+ *
+ * OP25 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 OP25; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "software_imbe_decoder.h"
+#include "op25_yank.h"
+#include "op25_imbe_frame.h"
+#include "op25_golay.h"
+#include "op25_hamming.h"
+
+#include <algorithm>
+#include <cstdio>
+#include <cstdlib>
+#include <stdint.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <math.h>
+#include <string.h>
+
+static const int BMTn[3600] = {
+ 3, 3, 4, 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 9, 3, 4,
+ 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4,
+ 5, 6, 7, 8, 9, 10, 3, 1, 1, 1, 2, 2, 4, 5, 6, 7,
+ 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7,
+ 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 8, 3, 4,
+ 5, 6, 7, 8, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7,
+ 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6,
+ 7, 8, 1, 1, 1, 1, 2, 2, 9, 10, 11, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 8, 3, 4, 5, 8, 3, 4, 5, 6, 7,
+ 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1, 1,
+ 1, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 3, 8, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8,
+ 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 3, 4, 5, 1, 1, 1, 1, 2, 2, 6, 7,
+ 8, 9, 10, 11, 12, 13, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, 4, 5, 8,
+ 9, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6,
+ 7, 8, 9, 1, 1, 1, 1, 1, 2, 2, 10, 11, 12, 13, 14, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 3, 8, 9, 3, 4, 5, 6, 7, 8,
+ 9, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 14, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1,
+ 1, 1, 1, 2, 2, 13, 14, 15, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 3, 9, 3, 4, 5, 6, 8, 9, 3, 4, 5, 6, 7, 8,
+ 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 1, 1, 1, 1, 2, 2,
+ 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 3, 4, 5,
+ 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 3, 4, 1, 1, 1, 1, 1, 1, 2, 2, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 3, 4, 3, 4, 5, 6, 7, 8,
+ 9, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 3, 4, 5, 6, 1,
+ 1, 1, 1, 1, 1, 2, 2, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 3, 3, 4, 5, 6, 7, 8, 10, 11, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 3, 4, 5, 6, 7, 8, 1, 1, 1, 1, 1, 1,
+ 2, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 3, 3,
+ 4, 5, 8, 10, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 3, 4, 5,
+ 6, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 2, 2, 11, 12,
+ 13, 14, 15, 16, 17, 18, 19, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 3, 3, 4, 5, 8, 10, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 16, 19, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 12, 13, 14, 15, 16, 17, 19,
+ 20, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 3, 4, 5, 10, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 20,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 14, 15, 16, 17, 18, 20, 21, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 3,
+ 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 15, 18, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 17, 18, 19, 21, 22, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 3, 3, 4, 5, 6, 7,
+ 8, 10, 11, 13, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 19, 20, 22, 23, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 3, 3, 4, 5, 6, 7, 8, 11, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 21, 23, 24, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 3, 3, 4, 5, 6, 8, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 20, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 23, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 3, 3, 4, 5, 8,
+ 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21,
+ 24, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 3, 3, 4, 5, 8, 11, 3, 4, 5, 6,
+ 7, 8, 9, 11, 12, 14, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 25, 26, 3, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 3, 4, 5, 8, 11, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14,
+ 18, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 22, 23, 26, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 4, 5, 11,
+ 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 19, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, 27, 3,
+ 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 3, 4, 5, 3, 4, 5, 6, 7, 8,
+ 9, 12, 13, 16, 20, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 20, 21, 24, 28, 3, 4, 5, 6, 7, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 3, 4, 3, 4, 5, 6, 7, 8, 9, 12, 13, 16, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21,
+ 24, 28, 3, 4, 5, 6, 7, 8, 9, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 3, 4, 3,
+ 4, 5, 6, 7, 8, 9, 12, 13, 16, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 24, 29, 3, 4, 5,
+ 6, 7, 8, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 3, 3, 4, 5, 6, 7, 8, 9,
+ 12, 13, 16, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 20, 21, 25, 30, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 3, 3, 4, 5, 6, 7, 8, 12, 16, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 21, 22, 26, 31,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 3, 3,
+ 4, 5, 6, 7, 8, 12, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 22, 23, 27, 32, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 32, 33, 34, 35, 3, 3, 4, 5, 6, 7, 8,
+ 13, 18, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 18,
+ 19, 23, 24, 28, 33, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 33, 34, 35, 36, 3, 3, 4, 5, 6, 8, 13, 18, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 23, 28, 33, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 3,
+ 3, 4, 5, 6, 8, 13, 18, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 13, 14, 15, 16, 18, 19, 23, 28, 34, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 3, 3, 4, 5, 6, 8,
+ 13, 18, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 18,
+ 19, 23, 24, 29, 35, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32,
+ 33, 35, 36, 37, 38, 3, 3, 4, 5, 6, 8, 13, 18, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 13, 14, 15, 18, 19, 24, 25, 30, 36, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39,
+ 3, 3, 4, 5, 8, 13, 19, 3, 4, 5, 6, 7, 8, 9, 10, 13,
+ 14, 15, 16, 19, 20, 25, 26, 31, 37, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 2, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 31, 32, 33, 34, 35, 37, 38, 39, 40, 3, 3, 4, 5, 8,
+ 14, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 20, 21,
+ 26, 27, 32, 38, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33,
+ 34, 35, 38, 39, 40, 41, 3, 3, 4, 5, 8, 14, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 14, 15, 16, 17, 20, 21, 26, 32, 38, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 38, 39, 40, 41,
+ 42, 3, 3, 4, 5, 8, 14, 3, 4, 5, 6, 7, 8, 9, 10, 14,
+ 15, 16, 17, 20, 21, 26, 32, 39, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 32, 33, 34, 35, 36, 39, 40, 41, 42, 43, 3, 3, 4, 5,
+ 8, 14, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16, 20, 21, 26,
+ 27, 33, 40, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 2, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 33, 34, 35,
+ 36, 37, 40, 41, 42, 43, 44, 3, 4, 5, 8, 14, 3, 4, 5, 6,
+ 7, 8, 9, 10, 14, 15, 16, 20, 21, 27, 28, 34, 41, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 36, 37, 38, 41, 42, 43,
+ 44, 45, 3, 4, 5, 8, 14, 3, 4, 5, 6, 7, 8, 9, 10, 14,
+ 15, 16, 21, 22, 28, 29, 35, 42, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 35, 36, 37, 38, 39, 42, 43, 44, 45, 3, 4, 5,
+ 8, 15, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 22, 23, 29,
+ 30, 36, 43, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 36, 37, 38, 39, 43, 44, 45, 46, 3, 4, 5, 8, 15, 3, 4, 5,
+ 6, 7, 8, 9, 10, 15, 16, 17, 22, 23, 29, 30, 36, 43, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 20, 21, 22,
+ 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 36, 37, 38, 39, 43, 44,
+ 45, 46, 47, 3, 4, 5, 8, 15, 3, 4, 5, 6, 7, 8, 9, 10,
+ 15, 16, 17, 22, 23, 29, 30, 36, 44, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 2, 20, 21, 22, 23, 24, 25, 26, 27,
+ 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 44, 45, 46, 47, 3, 4,
+ 5, 8, 15, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 22, 23, 29,
+ 30, 37, 45, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 2, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 37,
+ 38, 39, 40, 41, 45, 46, 47, 48, 49, 3, 4, 8, 15, 3, 4, 5,
+ 6, 7, 8, 9, 15, 16, 17, 22, 23, 30, 31, 38, 46, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 22, 23,
+ 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 38, 39, 40, 41, 42, 46,
+ 47, 48, 49, 50, 3, 4, 8, 15, 3, 4, 5, 6, 7, 8, 9, 15,
+ 16, 17, 23, 24, 31, 32, 39, 47, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 22, 23, 24, 25, 26, 27, 28,
+ 29, 31, 32, 33, 34, 35, 39, 40, 41, 42, 43, 47, 48, 49, 50, 3,
+ 4, 8, 16, 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 24, 25,
+ 32, 33, 40, 48, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 17, 18, 19, 20, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 2, 22, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35,
+ 36, 40, 41, 42, 43, 44, 48, 49, 50, 51, 3, 4, 8, 16, 3, 4,
+ 5, 6, 7, 8, 9, 10, 16, 17, 18, 24, 25, 32, 33, 40, 48, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20,
+ 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 22,
+ 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 40, 41, 42, 43,
+ 48, 49, 50, 51, 52, 3, 4, 8, 16, 3, 4, 5, 6, 7, 8, 9,
+ 10, 16, 17, 18, 24, 25, 32, 33, 40, 49, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 22, 24, 25, 26, 27, 28,
+ 29, 30, 32, 33, 34, 35, 36, 40, 41, 42, 43, 44, 49, 50, 51, 52
+};
+
+static const int BMTb[3600] = {
+ 512, 256, 256, 256, 256, 256, 256, 128, 128, 128, 128, 128, 128, 128, 64, 64,
+ 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16,
+ 16, 16, 16, 16, 16, 16, 8, 4, 2, 1, 4, 2, 8, 8, 8, 8,
+ 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 256, 256, 256, 128, 128,
+ 128, 128, 128, 128, 64, 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32,
+ 32, 32, 32, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8,
+ 8, 8, 8, 4, 2, 1, 4, 2, 8, 8, 8, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 256, 128, 128, 128, 128, 64, 64, 64, 64, 64,
+ 64, 64, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 2,
+ 1, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 128, 128, 64, 64, 64, 64, 64, 64, 64, 32, 32, 32, 32, 32, 32,
+ 32, 32, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 4, 4, 4, 8, 4, 2, 1, 4, 2, 4, 4,
+ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 64, 64, 64, 64,
+ 64, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4,
+ 4, 4, 4, 16, 8, 4, 2, 1, 4, 2, 4, 4, 4, 4, 4, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 64, 64, 64, 32, 32, 32, 32, 32, 32,
+ 32, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 8,
+ 4, 2, 1, 4, 2, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 64, 64, 32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16,
+ 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 8, 4, 2, 1, 4, 2,
+ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 32, 32, 32,
+ 32, 32, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 2, 2, 32, 16, 8, 4, 2, 1, 4, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 32, 32, 16, 16, 16, 16, 16, 16,
+ 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 32,
+ 16, 8, 4, 2, 1, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 32, 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 32, 16, 8, 4, 2, 1,
+ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 32, 16,
+ 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 64, 32, 16, 8, 4, 2, 1, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 32, 16, 16, 16, 16, 16, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 64, 32, 16, 8, 4, 2, 1, 4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 64, 32, 16, 8, 4,
+ 2, 1, 4, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16,
+ 16, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 16, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 128, 64, 32, 16,
+ 8, 4, 2, 1, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 16, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 256, 128, 64, 32, 16, 8, 4, 2, 1,
+ 4, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 8, 8, 8, 8,
+ 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 16, 8, 8, 8, 8, 8, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 256, 128, 64,
+ 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 512, 256, 128, 64, 32, 16, 8, 4,
+ 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 512, 256,
+ 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1024, 512, 256, 128, 64, 32, 16,
+ 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 8, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1024,
+ 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 8, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64,
+ 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 4,
+ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2,
+ 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 4, 4, 4, 4, 4, 4,
+ 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 8, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128,
+ 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8,
+ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4,
+ 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 4, 4, 4, 4, 4,
+ 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 8, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256,
+ 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 8, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8,
+ 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 4, 4, 4, 4,
+ 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 8, 4, 4, 4, 4, 4, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512,
+ 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 8, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16,
+ 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 4, 4, 4,
+ 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024,
+ 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32,
+ 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4,
+ 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1,
+ 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048,
+ 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64,
+ 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4,
+ 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2,
+ 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128,
+ 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4,
+ 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4,
+ 2, 1, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2048, 1024, 512, 256,
+ 128, 64, 32, 16, 8, 4, 2, 1, 4, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+static const int BitCount[1512] = {
+ 10, 9, 9, 9, 9, 9, 8, 7, 9, 9, 8, 8, 8, 9, 7, 6,
+ 5, 8, 8, 8, 7, 7, 9, 7, 6, 5, 4, 8, 7, 7, 7, 7,
+ 8, 7, 6, 5, 4, 3, 7, 7, 7, 6, 6, 7, 7, 6, 5, 4,
+ 3, 3, 7, 6, 6, 6, 6, 7, 7, 5, 4, 4, 3, 4, 3, 7,
+ 6, 6, 6, 5, 6, 7, 5, 4, 4, 3, 3, 3, 3, 6, 6, 6,
+ 5, 5, 6, 6, 5, 4, 4, 3, 3, 3, 3, 2, 6, 6, 5, 5,
+ 5, 5, 5, 5, 4, 4, 4, 3, 3, 2, 3, 2, 6, 5, 5, 5,
+ 5, 5, 4, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 6, 5, 5,
+ 4, 4, 5, 4, 5, 4, 4, 3, 3, 3, 3, 2, 3, 2, 1, 6,
+ 5, 5, 4, 4, 5, 4, 5, 4, 4, 3, 3, 2, 3, 2, 1, 3,
+ 2, 1, 5, 5, 5, 4, 4, 4, 4, 5, 4, 4, 3, 3, 2, 2,
+ 3, 2, 1, 3, 2, 1, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
+ 3, 2, 3, 2, 2, 3, 2, 1, 2, 2, 1, 5, 4, 4, 4, 4,
+ 4, 3, 4, 4, 3, 4, 3, 2, 3, 2, 2, 2, 2, 1, 2, 2,
+ 1, 5, 4, 4, 4, 4, 4, 3, 3, 4, 3, 3, 3, 3, 2, 3,
+ 2, 1, 2, 2, 1, 2, 2, 1, 5, 4, 4, 4, 3, 4, 3, 3,
+ 4, 3, 3, 3, 3, 2, 3, 2, 1, 2, 2, 1, 2, 1, 1, 1,
+ 5, 4, 4, 3, 3, 4, 3, 3, 4, 3, 3, 3, 2, 2, 3, 2,
+ 1, 2, 2, 1, 1, 2, 2, 1, 1, 5, 4, 4, 3, 3, 4, 3,
+ 2, 4, 3, 2, 3, 2, 2, 3, 2, 2, 1, 2, 2, 1, 1, 2,
+ 2, 1, 1, 4, 4, 4, 3, 3, 4, 3, 2, 4, 3, 2, 3, 2,
+ 2, 2, 3, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 4, 4,
+ 4, 3, 3, 3, 3, 2, 4, 3, 2, 2, 3, 2, 2, 2, 3, 2,
+ 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 4, 4, 4, 3, 3, 3,
+ 3, 2, 2, 3, 3, 2, 2, 3, 2, 2, 1, 3, 2, 1, 1, 2,
+ 1, 1, 1, 2, 1, 1, 1, 4, 4, 3, 3, 3, 3, 3, 2, 2,
+ 3, 3, 2, 2, 3, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1,
+ 2, 1, 1, 1, 1, 4, 4, 3, 3, 3, 3, 3, 2, 2, 3, 3,
+ 2, 2, 3, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 2,
+ 1, 1, 1, 0, 4, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 2,
+ 2, 3, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2,
+ 1, 1, 1, 1, 4, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2, 2,
+ 2, 3, 2, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1,
+ 2, 1, 1, 1, 0, 4, 3, 3, 3, 3, 3, 2, 2, 2, 3, 2,
+ 2, 2, 2, 3, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1,
+ 1, 0, 2, 1, 1, 1, 0, 4, 3, 3, 3, 3, 3, 2, 2, 2,
+ 1, 3, 2, 2, 2, 1, 3, 2, 1, 1, 1, 2, 2, 1, 1, 1,
+ 2, 1, 1, 1, 0, 2, 1, 1, 1, 0, 4, 3, 3, 3, 2, 3,
+ 2, 2, 2, 1, 3, 2, 2, 2, 2, 3, 2, 1, 1, 1, 2, 1,
+ 1, 1, 1, 2, 1, 1, 1, 0, 2, 1, 1, 1, 1, 0, 4, 3,
+ 3, 3, 2, 3, 2, 2, 2, 1, 3, 2, 2, 2, 1, 3, 2, 1,
+ 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 2, 1, 1,
+ 1, 1, 0, 4, 3, 3, 3, 2, 3, 2, 2, 2, 1, 3, 2, 2,
+ 2, 1, 3, 2, 1, 1, 1, 2, 2, 1, 1, 1, 0, 2, 1, 1,
+ 1, 1, 0, 2, 1, 1, 1, 0, 0, 4, 3, 3, 3, 2, 3, 2,
+ 2, 2, 1, 3, 2, 2, 1, 1, 3, 2, 1, 1, 1, 1, 2, 2,
+ 1, 1, 1, 0, 2, 1, 1, 1, 1, 0, 2, 1, 1, 1, 0, 0,
+ 4, 3, 3, 2, 2, 3, 2, 2, 1, 1, 3, 2, 2, 2, 1, 1,
+ 3, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0, 2, 1, 1, 1,
+ 1, 0, 2, 1, 1, 1, 0, 0, 4, 3, 3, 2, 2, 3, 2, 2,
+ 2, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2,
+ 2, 1, 1, 1, 0, 2, 1, 1, 1, 0, 0, 2, 1, 1, 1, 0,
+ 0, 4, 3, 3, 2, 2, 3, 2, 2, 2, 1, 1, 3, 2, 2, 2,
+ 1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
+ 1, 1, 0, 0, 2, 1, 1, 1, 1, 0, 0, 4, 3, 3, 2, 2,
+ 3, 2, 2, 1, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 1, 1,
+ 1, 1, 2, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 0, 0, 2,
+ 1, 1, 1, 1, 0, 0, 4, 3, 3, 2, 2, 3, 2, 2, 1, 1,
+ 1, 3, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1,
+ 1, 1, 0, 0, 2, 1, 1, 1, 1, 0, 0, 2, 1, 1, 1, 1,
+ 0, 0, 3, 3, 3, 2, 2, 3, 2, 2, 1, 1, 1, 3, 2, 2,
+ 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0,
+ 0, 2, 1, 1, 1, 1, 0, 0, 2, 1, 1, 1, 1, 0, 0, 3,
+ 3, 3, 2, 2, 3, 2, 2, 1, 1, 1, 3, 2, 2, 1, 1, 1,
+ 1, 2, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0, 0, 2,
+ 1, 1, 1, 1, 0, 0, 2, 1, 1, 1, 0, 0, 0, 3, 3, 3,
+ 2, 2, 3, 2, 2, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 1,
+ 2, 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0, 0, 2, 1,
+ 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 3, 3, 3, 2,
+ 2, 3, 2, 2, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 1, 2,
+ 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 0, 0, 2, 1, 1,
+ 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 3, 3, 3, 2,
+ 2, 3, 2, 2, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 1, 2,
+ 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 0, 0, 2, 1, 1,
+ 1, 1, 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 3,
+ 2, 2, 3, 2, 2, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 1,
+ 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2,
+ 1, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 3,
+ 3, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1, 3, 2, 2, 1, 1,
+ 1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 0,
+ 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0,
+ 0, 0, 3, 3, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1, 3, 2,
+ 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 2, 2,
+ 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 2, 1,
+ 1, 1, 0, 0, 0, 0, 3, 3, 2, 2, 2, 3, 2, 2, 1, 1,
+ 1, 1, 0, 3, 2, 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1,
+ 1, 1, 0, 2, 2, 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 1,
+ 0, 0, 0, 2, 1, 1, 1, 0, 0, 0, 0, 3, 3, 2, 2, 2,
+ 3, 2, 2, 1, 1, 1, 1, 0, 3, 2, 2, 1, 1, 1, 1, 0,
+ 2, 2, 1, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 0, 0, 0,
+ 2, 1, 1, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0,
+ 0, 3, 3, 2, 2, 2, 3, 2, 2, 1, 1, 1, 1, 0, 3, 2,
+ 2, 1, 1, 1, 1, 0, 2, 2, 1, 1, 1, 1, 1, 0, 2, 2,
+ 1, 1, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 2,
+ 1, 1, 1, 0, 0, 0, 0, 0
+};
+
+static const float StepSize[1512] = {
+ 0.003100, 0.004020, 0.003360, 0.002900, 0.002640, 0.006140, 0.012280, 0.024560, 0.006200, 0.004020, 0.006720, 0.005800, 0.005280, 0.006140, 0.024560, 0.046050,
+ 0.085960, 0.012400, 0.008040, 0.006720, 0.011600, 0.010560, 0.006140, 0.024560, 0.046050, 0.085960, 0.122800, 0.012400, 0.016080, 0.013440, 0.011600, 0.010560,
+ 0.012280, 0.024560, 0.046050, 0.085960, 0.122800, 0.199550, 0.024800, 0.016080, 0.013440, 0.021750, 0.019800, 0.024560, 0.024560, 0.046050, 0.085960, 0.122800,
+ 0.199550, 0.156650, 0.024800, 0.030150, 0.025200, 0.021750, 0.019800, 0.024560, 0.024560, 0.085960, 0.122800, 0.122800, 0.156650, 0.122800, 0.156650, 0.024800,
+ 0.030150, 0.025200, 0.021750, 0.036960, 0.046050, 0.024560, 0.085960, 0.122800, 0.096400, 0.199550, 0.156650, 0.199550, 0.156650, 0.046500, 0.030150, 0.025200,
+ 0.040600, 0.036960, 0.046050, 0.046050, 0.085960, 0.096400, 0.122800, 0.156650, 0.199550, 0.156650, 0.199550, 0.204850, 0.046500, 0.030150, 0.047040, 0.040600,
+ 0.036960, 0.085960, 0.085960, 0.067480, 0.122800, 0.096400, 0.122800, 0.156650, 0.199550, 0.204850, 0.199550, 0.204850, 0.046500, 0.056280, 0.047040, 0.040600,
+ 0.036960, 0.085960, 0.096400, 0.085960, 0.067480, 0.122800, 0.156650, 0.199550, 0.156650, 0.199550, 0.204850, 0.260950, 0.204850, 0.046500, 0.056280, 0.047040,
+ 0.058000, 0.052800, 0.085960, 0.096400, 0.085960, 0.096400, 0.122800, 0.156650, 0.199550, 0.156650, 0.199550, 0.204850, 0.199550, 0.204850, 0.248400, 0.046500,
+ 0.056280, 0.047040, 0.058000, 0.052800, 0.085960, 0.096400, 0.085960, 0.096400, 0.122800, 0.156650, 0.199550, 0.204850, 0.199550, 0.204850, 0.248400, 0.199550,
+ 0.204850, 0.248400, 0.086800, 0.056280, 0.047040, 0.058000, 0.052800, 0.122800, 0.096400, 0.085960, 0.096400, 0.122800, 0.156650, 0.199550, 0.204850, 0.175950,
+ 0.199550, 0.204850, 0.248400, 0.199550, 0.204850, 0.248400, 0.086800, 0.056280, 0.067200, 0.058000, 0.052800, 0.122800, 0.096400, 0.122800, 0.096400, 0.122800,
+ 0.156650, 0.175950, 0.199550, 0.204850, 0.175950, 0.199550, 0.204850, 0.248400, 0.260950, 0.204850, 0.248400, 0.086800, 0.080400, 0.067200, 0.058000, 0.052800,
+ 0.122800, 0.156650, 0.122800, 0.096400, 0.134550, 0.122800, 0.156650, 0.175950, 0.199550, 0.204850, 0.175950, 0.260950, 0.204850, 0.248400, 0.260950, 0.204850,
+ 0.248400, 0.086800, 0.080400, 0.067200, 0.058000, 0.052800, 0.122800, 0.156650, 0.134550, 0.122800, 0.156650, 0.134550, 0.199550, 0.156650, 0.175950, 0.199550,
+ 0.204850, 0.248400, 0.260950, 0.204850, 0.248400, 0.260950, 0.204850, 0.248400, 0.086800, 0.080400, 0.067200, 0.058000, 0.085800, 0.122800, 0.156650, 0.134550,
+ 0.122800, 0.156650, 0.134550, 0.199550, 0.156650, 0.175950, 0.199550, 0.204850, 0.248400, 0.260950, 0.204850, 0.248400, 0.260950, 0.289200, 0.248400, 0.228000,
+ 0.086800, 0.080400, 0.067200, 0.094250, 0.085800, 0.122800, 0.156650, 0.134550, 0.122800, 0.156650, 0.134550, 0.199550, 0.204850, 0.175950, 0.199550, 0.204850,
+ 0.248400, 0.260950, 0.204850, 0.248400, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.086800, 0.080400, 0.067200, 0.094250, 0.085800, 0.122800, 0.156650,
+ 0.175950, 0.122800, 0.156650, 0.175950, 0.199550, 0.204850, 0.175950, 0.199550, 0.204850, 0.175950, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.260950,
+ 0.204850, 0.248400, 0.228000, 0.124000, 0.080400, 0.067200, 0.094250, 0.085800, 0.122800, 0.156650, 0.175950, 0.122800, 0.156650, 0.175950, 0.199550, 0.204850,
+ 0.175950, 0.161500, 0.199550, 0.204850, 0.248400, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000, 0.124000, 0.080400,
+ 0.067200, 0.094250, 0.085800, 0.199550, 0.156650, 0.175950, 0.122800, 0.156650, 0.175950, 0.161500, 0.199550, 0.204850, 0.175950, 0.161500, 0.199550, 0.204850,
+ 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000, 0.124000, 0.080400, 0.067200, 0.094250, 0.085800, 0.199550,
+ 0.156650, 0.175950, 0.161500, 0.199550, 0.156650, 0.175950, 0.161500, 0.199550, 0.204850, 0.175950, 0.228000, 0.199550, 0.204850, 0.248400, 0.228000, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000, 0.124000, 0.080400, 0.109200, 0.094250, 0.085800, 0.199550, 0.156650, 0.175950, 0.161500,
+ 0.199550, 0.156650, 0.175950, 0.161500, 0.199550, 0.204850, 0.175950, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000,
+ 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.124000, 0.080400, 0.109200, 0.094250, 0.085800, 0.199550, 0.156650, 0.175950, 0.161500, 0.199550, 0.156650,
+ 0.175950, 0.161500, 0.199550, 0.204850, 0.175950, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.085800, 0.199550, 0.156650, 0.175950, 0.161500, 0.199550, 0.156650, 0.175950,
+ 0.161500, 0.199550, 0.204850, 0.248400, 0.228000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.214800, 0.124000, 0.130650, 0.109200, 0.094250, 0.085800, 0.199550, 0.204850, 0.175950, 0.161500, 0.199550, 0.204850, 0.175950,
+ 0.161500, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800,
+ 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.085800, 0.199550, 0.204850, 0.175950, 0.161500, 0.199550, 0.204850,
+ 0.175950, 0.161500, 0.152150, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.289200, 0.248400,
+ 0.228000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.085800, 0.199550, 0.204850, 0.175950, 0.161500,
+ 0.214800, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800,
+ 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.112200, 0.199550,
+ 0.204850, 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.175950, 0.161500, 0.152150, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.289200,
+ 0.248400, 0.228000, 0.214800, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.124000, 0.130650,
+ 0.109200, 0.094250, 0.112200, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.248400,
+ 0.228000, 0.214800, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400,
+ 0.228000, 0.214800, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.112200, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.175950,
+ 0.161500, 0.214800, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400,
+ 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.124000, 0.130650, 0.109200, 0.094250, 0.112200, 0.199550, 0.204850,
+ 0.175950, 0.161500, 0.214800, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.260950, 0.204850,
+ 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000,
+ 0.124000, 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.207600,
+ 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000,
+ 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.124000, 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950,
+ 0.161500, 0.214800, 0.207600, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.260950,
+ 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000,
+ 0.000000, 0.124000, 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.207600, 0.199550, 0.204850, 0.175950, 0.161500,
+ 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200,
+ 0.248400, 0.228000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.124000, 0.130650, 0.109200, 0.123250, 0.112200,
+ 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.199550, 0.204850, 0.175950, 0.161500, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000,
+ 0.214800, 0.207600, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.124000, 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800,
+ 0.207600, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400,
+ 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800,
+ 0.000000, 0.000000, 0.201500, 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.199550, 0.204850, 0.175950,
+ 0.228000, 0.214800, 0.207600, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000,
+ 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.201500,
+ 0.130650, 0.109200, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600,
+ 0.198000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.109200,
+ 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000,
+ 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200,
+ 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.109200, 0.123250,
+ 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.260950,
+ 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400,
+ 0.228000, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.109200, 0.123250,
+ 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.260950,
+ 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400,
+ 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.109200,
+ 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000,
+ 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.201500,
+ 0.130650, 0.142800, 0.123250, 0.112200, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800,
+ 0.207600, 0.198000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000,
+ 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000,
+ 0.000000, 0.000000, 0.201500, 0.130650, 0.142800, 0.123250, 0.112200, 0.199550, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.199550, 0.204850,
+ 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.204000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850,
+ 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200,
+ 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.142800, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800,
+ 0.207600, 0.198000, 0.000000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800,
+ 0.207600, 0.198000, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800,
+ 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.000000, 0.201500, 0.130650, 0.142800, 0.123250, 0.112200,
+ 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000,
+ 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000,
+ 0.260950, 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.201500, 0.130650, 0.142800, 0.123250, 0.112200, 0.199550, 0.204850, 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.199550, 0.204850,
+ 0.175950, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850, 0.248400, 0.228000, 0.214800, 0.207600, 0.198000, 0.000000, 0.260950, 0.204850,
+ 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.260950, 0.289200, 0.248400, 0.228000, 0.214800, 0.000000, 0.000000, 0.000000, 0.000000, 0.260950,
+ 0.289200, 0.248400, 0.228000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000
+};
+
+static const float AnnexE[64] = {
+ -2.842205, -2.694235, -2.558260, -2.382850, -2.221042, -2.095574, -1.980845, -1.836058, -1.645556, -1.417658, -1.261301, -1.125631, -0.958207, -0.781591, -0.555837, -0.346976,
+ -0.147249, 0.027755, 0.211495, 0.388380, 0.552873, 0.737223, 0.932197, 1.139032, 1.320995, 1.483433, 1.648297, 1.801447, 1.942731, 2.118613, 2.321486, 2.504443,
+ 2.653909, 2.780654, 2.925355, 3.076390, 3.220825, 3.402869, 3.585096, 3.784606, 3.955521, 4.155636, 4.314009, 4.444150, 4.577542, 4.735552, 4.909493, 5.085264,
+ 5.254767, 5.411894, 5.568094, 5.738523, 5.919215, 6.087701, 6.280685, 6.464201, 6.647736, 6.834672, 7.022583, 7.211777, 7.471016, 7.738948, 8.124863, 8.695827
+};
+
+static const float ws[211] = {
+ 0.000000, 0.020000, 0.040000, 0.060000, 0.080000, 0.100000, 0.120000, 0.140000, 0.160000, 0.180000, 0.200000, 0.220000, 0.240000, 0.260000, 0.280000, 0.300000,
+ 0.320000, 0.340000, 0.360000, 0.380000, 0.400000, 0.420000, 0.440000, 0.460000, 0.480000, 0.500000, 0.520000, 0.540000, 0.560000, 0.580000, 0.600000, 0.620000,
+ 0.640000, 0.660000, 0.680000, 0.700000, 0.720000, 0.740000, 0.760000, 0.780000, 0.800000, 0.820000, 0.840000, 0.860000, 0.880000, 0.900000, 0.920000, 0.940000,
+ 0.960000, 0.980000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,
+ 1.000000, 0.980000, 0.960000, 0.940000, 0.920000, 0.900000, 0.880000, 0.860000, 0.840000, 0.820000, 0.800000, 0.780000, 0.760000, 0.740000, 0.720000, 0.700000,
+ 0.680000, 0.660000, 0.640000, 0.620000, 0.600000, 0.580000, 0.560000, 0.540000, 0.520000, 0.500000, 0.480000, 0.460000, 0.440000, 0.420000, 0.400000, 0.380000,
+ 0.360000, 0.340000, 0.320000, 0.300000, 0.280000, 0.260000, 0.240000, 0.220000, 0.200000, 0.180000, 0.160000, 0.140000, 0.120000, 0.100000, 0.080000, 0.060000,
+ 0.040000, 0.020000, 0.000000
+};
+
+static const float woaa[105] = {
+ 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000,
+ 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.040799, 1.083189, 1.127142, 1.172608, 1.219512, 1.267748, 1.317176, 1.367615,
+ 1.418842, 1.470588, 1.522534, 1.574307, 1.625488, 1.675603, 1.724138, 1.770538, 1.814224, 1.854599, 1.891074, 1.923077, 1.950078, 1.971609, 1.987282, 1.996805,
+ 2.000000, 1.996805, 1.987282, 1.971609, 1.950078, 1.923077, 1.891074, 1.854599, 1.814224, 1.770538, 1.724138, 1.675603, 1.625488, 1.574307, 1.522534, 1.470588,
+ 1.418842, 1.367615, 1.317176, 1.267748, 1.219512, 1.172608, 1.127142, 1.083189, 1.040799
+};
+
+static const float PhzNz[57] = {
+ 0.000000, 3.002978, -0.385743, -1.804058, 0.708389, 3.080091, 0.234237, -2.601564, 2.564900, 0.101063, -0.241570, -2.283176, 0.460491, -1.611275, 2.258339, -2.055267,
+ 1.733923, 2.517236, -1.766211, 0.897032, -2.360999, -0.280836, -2.714514, 2.100092, 2.300326, -1.158767, -2.044268, -2.668387, -2.578737, 0.185036, 1.551429, 2.726814,
+ 2.655614, 3.046857, 0.834348, -0.513595, 1.466037, 0.691121, 0.127319, -2.034924, -1.070655, 0.456588, -2.278682, 1.229021, -2.139595, -0.119750, -0.301534, 0.029391,
+ 0.068775, 0.520336, 2.339119, -0.808328, 1.332154, 2.929768, -0.338316, 0.022767, -1.063795
+};
+
+software_imbe_decoder::software_imbe_decoder()
+{
+ int i,j;
+ //initialize
+ OldL = 0;
+ Old = 1; New = 0;
+ psi1 = 0.0;
+ for(i=0; i < 58; i++) {
+ for(j=0; j < 2; j++) {
+ log2Mu[i][j] = 0.0;
+ }
+ }
+ for(i=0; i < 57; i++) {
+ for(j=0; j < 2; j++) {
+ phi[i][j] = 0.0;
+ }
+ }
+ for(i=0; i < 256; i++) {
+ Olduw[i] = 0.0;
+ }
+ u[0] = 3147;
+ for(i=1; i < 211; i++) {
+ u[i] = next_u(u[i-1]);
+ }
+}
+
+uint32_t
+software_imbe_decoder::next_u(uint32_t u) {
+ return (u * 171 + 11213) % 53125;
+}
+
+software_imbe_decoder::~software_imbe_decoder()
+{
+}
+
+void
+software_imbe_decoder::decode(const voice_codeword& cw)
+{
+ // process input 144-bit IMBE frame - converts to 88-bit frame
+ unsigned int u0 = 0;
+ unsigned int u1,u2,u3,u4,u5,u6,u7;
+ unsigned int E0 = 0;
+ unsigned int ET = 0;
+ unsigned char O[12];
+
+ // PN/Hamming/Golay - etc.
+ imbe_header_decode(cw, u0, u1, u2, u3, u4, u5, u6, u7, E0, ET) ;
+
+ //replace the sync bit(LSB of u7) with the BOT flag
+ u7 = u7 | 0x01; //ECC procedure called above always returns u7 LSB = 0
+
+ O[0] = (((u0 / 16) & 240) + (u1 / 256));
+ O[1] = (((u2 / 16) & 240) + (u3 / 256));
+ O[2] = (((u4 / 8) & 224) + ((u5 / 64) & 28) + (u6 / 512));
+ O[3] = (((u6 / 2) & 128) + u7);
+ O[4] = (u0 & 255);
+ O[5] = (u1 & 255);
+ O[6] = (u2 & 255);
+ O[7] = (u3 & 255);
+ O[8] = (u4 & 255);
+ O[9] = (u5 & 255);
+ O[10] = (u6 & 255);
+ O[11] = E0 + 4 * ET;
+
+ decode_audio(O); // process 88-bit frame
+}
+
+void
+software_imbe_decoder::adaptive_smoothing(float SE, float ER, float ET)
+{
+ float VM;
+ float YM;
+ int ell;
+
+ if(ER <= .005 && ET <= 4) {
+ VM = 1E+38; //infinity
+ } else if( ER <= .0125 && ET == 0) { //(guessing typo in std)
+ VM = 45.255 * powf(SE, .375) / exp(277.6 * ER);
+ } else {
+ VM = 1.414 * powf(SE, .375);
+ }
+
+ float AM = 0;
+ for(ell = 1; ell <= L; ell++) {
+ if(M[ell][ New] > VM) vee[ell][ New] = 1; //CAUTION:
+ AM = AM + M[ell][ New]; //smoothed vee(ell) replaces unsmoothed!
+ }
+
+ float TM = (ER <= .005 && ET <= 6) ? 20480 : 6000 - 300 * ET; // + TM; /* ToDo: uninitialized! */
+ if(TM <= AM) {
+ YM = TM / AM;
+ for(ell = 1; ell <= L; ell++) {
+ M[ell][ New] = M[ell][New] * YM;
+ }
+ }
+}
+
+void
+software_imbe_decoder::fft(float REX[], float IMX[])
+{
+ int I;
+ int J;
+ int K;
+ int H;
+ int KpH;
+ int Ht2;
+ float tmp_f;
+ float l_Ui, l_Uq, Theta, Si, Sq, Ti, Xi, Tq, Xq;
+
+ J = 64;
+ for(I = 1; I <= 126; I++) {
+#define SWAP(x,y) tmp_f=x;x=y;y=tmp_f
+ if(I < J) { SWAP(REX[J], REX[I]); SWAP(IMX[J], IMX[I]); }
+#undef SWAP
+ K = 64;
+ while(K <= J) { J = J - K; K = K / 2; }
+ J = J + K;
+ }
+
+ H = 1;
+ for(I = 1; I <= 7; I++) {
+ Ht2 = H * 2; l_Ui = 1; l_Uq = 0;
+ Theta = M_PI / H; Si = cos(Theta); Sq = -sin(Theta);
+ for(J = 1; J <= H; J++) {
+ for(K = J - 1; K <= 127; K+=Ht2) {
+ KpH = K + H;
+
+ Ti = REX[KpH] * l_Ui - IMX[KpH] * l_Uq; Xi = REX[K];
+ Tq = REX[KpH] * l_Uq + IMX[KpH] * l_Ui; Xq = IMX[K];
+
+ REX[KpH] = Xi - Ti; REX[K] = Xi + Ti;
+ IMX[KpH] = Xq - Tq; IMX[K] = Xq + Tq;
+ }
+ Ti = l_Ui;
+ l_Ui = Ti * Si - l_Uq * Sq;
+ l_Uq = Ti * Sq + l_Uq * Si;
+ }
+ H = Ht2;
+ }
+
+}
+
+void
+software_imbe_decoder::decode_audio(uint8_t *A)
+{
+ uint32_t u0, u1, u2, u3, u4, u5, u6, u7, E0, ET;
+ int K;
+ int en, tmp_f;
+ float SE = 0, ER = 0;
+
+ imbe_frame_unpack(A, u0, u1, u2, u3, u4, u5, u6, u7, E0, ET);
+
+ ER = .95 * ER + .000365 * ET;
+ if( ER > .0875) {
+ // Huh?!
+ } else if(u0 >= 3328 || E0 >= 2 || ET >=(10 + 40 * ER)) {
+ // Whuh?!
+ } else {
+ K = rearrange(u0, u1, u2, u3, u4, u5, u6, u7); // re-arrange the bits from u to b (ToDo: make 'b' return value ???)
+ decode_vuv(K);
+
+ int Len3, Start3, Len8, Start8;
+ Len3 = L - 1;
+ Start3 =((Len3 * (Len3 - 1)) / 2) - 28;
+ Len8 = L - 6;
+ Start8 =((Len8 * (Len8 - 1)) / 2) - 3;
+
+ decode_spectral_amplitudes(Start3, Start8);
+ enhance_spectral_amplitudes(SE);
+ adaptive_smoothing(SE, ER, ET);
+
+ // (8000 samp/sec) * (1 sec / 50 compressed voice frames) = 160 samples/frame
+
+ //synth:
+ synth_unvoiced();// ToDo: make suv return value?
+ synth_voiced(); // ToDo: make sv return value?
+
+ //output:
+ audio_samples *samples = audio();
+ for(en = 0; en <= 159; en++) {
+ // The unvoiced samples are loud and the voiced are low...I don't know why.
+ // Most of the difference is compensated by removing the 146.6433 factor
+ // in the synth_unvoiced procedure. The final tweak is done by raising the
+ // voiced samples:
+ float sample = suv[en] + sv[en] * 4; //balance v/uv loudness
+// if(abs((int)sample) > 32767) {
+// sample = 32767 * (sample < 0) ? -1 : 1; // * sgn(sample)
+// }
+ sample /= 32768.0;
+ samples->push_back(sample);
+ }
+ }
+ OldL = L;
+ Oldw0 = w0;
+ tmp_f = Old; Old = New; New = tmp_f;
+}
+
+void
+software_imbe_decoder::decode_spectral_amplitudes(int Start3, int Start8)
+{
+ float G[7]; //Can we use C(1 to 6,1) for this?
+ int J[7];
+ float C[7][ 11] ;
+ float T[57];
+
+ float Tmp ;
+ float Tk ;
+ float TD;
+ float Tp ;
+
+ int P3, P8, eye, jay, kay, ell, em, iTk;
+
+ P3 = Start3; P8 = Start8;
+
+ G[1] = AnnexE[bee[2]];
+
+ for(eye = 2; eye <= 6; eye++) {
+ G[eye] = StepSize[P3] *(bee[eye + 1] - powf(2 ,(BitCount[P3] - 1)) + .5);
+ P3 = P3 + 1;
+ }
+
+ for(eye = 1; eye <= 6; eye++) {
+ Tmp = G[1];
+ for(em = 2; em <= 6; em++) {
+ Tmp = Tmp + 2 * G[em] * cos(M_PI *(em - 1) *(eye - .5) / 6);
+ }
+ //R(eye) = Tmp
+ C[eye][1] = Tmp;
+ }
+
+ ell = 8;
+ for(eye = 1; eye <= 6; eye++) {
+ J[eye] =(L + eye - 1) / 6; //Prediction Residual Block Length
+ // FOR kay = 2 TO J(eye)
+ for(kay = 2; kay <= J[eye]; kay++) {
+ C[eye][ kay] = StepSize[P3] *(bee[ell] - powf(2 ,(BitCount[P3] - 1)) + .5);
+ P3 = P3 + 1; P8 = P8 + 1; ell = ell + 1;
+ }
+ }
+
+ ell = 0;
+ for(eye = 1; eye <= 6; eye++) {
+ for(jay = 1; jay <= J[eye]; jay++) {
+ Tmp = C[eye][ 1];
+ // FOR kay = 2 TO J(eye)
+ for(kay = 2; kay <= J[eye]; kay++) {
+ Tmp = Tmp + 2 * C[eye][ kay] * cos(M_PI *(kay - 1) *(jay - .5) / J[eye]);
+ }
+ ell = ell + 1; T[ell] = Tmp;
+ }
+ }
+ if(ell != L) exit(1);
+
+ // *******
+ // we have the residuals in T(ell); now to sum with the predictions
+ // *******
+
+ // first, set up the assumptions about the previous frame values
+ // Note: L means L(0); OldL means L(-1)
+ if(OldL == 0) { OldL = 30; for( ell = 0; ell <= 57; ell++) { log2Mu[ell][ Old] = 1; } }
+ for(ell = OldL + 1; ell <= L + 1; ell++) { log2Mu[ell][ Old] = log2Mu[OldL][ Old]; }
+
+ // make the predictions and sum with T(ell)
+ if(L <= 15)
+ Tp = .4;
+ else if(L <= 24)
+ Tp = .03 * L - .05;
+ else
+ Tp = .7;
+
+ Tmp = 0;
+ for(ell = 1; ell <= L; ell++) {
+ Tk =((float)OldL /(float)L) *(float)ell;
+ iTk =(int) Tk;
+ TD = Tk - iTk;
+ // temporarily use Mu(ell, New) as temp
+ Mu[ell][ New] = Tp *((1 - TD) * log2Mu[iTk][ Old] + TD * log2Mu[iTk + 1][ Old]);
+ Tmp = Tmp + Mu[ell][ New];
+ }
+ Tmp = Tmp / L;
+ for(ell = 1; ell <= L; ell++) {
+ log2Mu[ell][ New] = T[ell] + Mu[ell][ New] - Tmp;
+ // Mu(ell, New) no longer temp
+ Mu[ell][ New] = powf(2 ,log2Mu[ell][ New]);
+ }
+}
+
+void
+software_imbe_decoder::decode_vuv(int K)
+{
+ int bee1, ell, kay;
+ bee1 = bee[1];
+ for(ell = 1; ell <= L; ell++) {
+ if(ell <= 36)
+ kay =(ell + 2) / 3;
+ else
+ kay = 12;
+
+ //vee(ell, New) = (bee1 \(2 ^(K - kay))) - 2 *(bee1 \(2 ^(K + 1 - kay)))
+ vee[ell][ New] = ((bee1 & (1 << (K - kay))) > 0) ? 1 : 0;
+ }
+}
+
+void
+software_imbe_decoder::enhance_spectral_amplitudes(float& SE)
+{
+ float RM0;
+ float RM1;
+ float Tmp;
+ float K1;
+ float K2;
+ float K3;
+ float W;
+ int ell;
+
+ RM0 = 0; RM1 = 0;
+ for(ell = 1; ell <= L; ell++) {
+ Tmp = powf(Mu[ell][ New] , 2);
+ RM0 = RM0 + Tmp;
+ RM1 = RM1 + Tmp * cos(w0 * ell);
+ }
+
+ K1 = .96 * M_PI /(w0 * RM0 *(powf(RM0 , 2) - powf(RM1 , 2)));
+ K2 = powf(RM0 , 2) + powf(RM1 , 2);
+ K3 = 2 * RM0 * RM1;
+
+ Tmp = 0;
+ for(ell = 1; ell <= L; ell++) {
+ W = sqrt(Mu[ell][ New]) * powf((K1 *(K2 - K3 * cos(w0 * ell))) , .25);
+ if((8 * ell) <= L)
+ M[ell][ New] = Mu[ell][ New];
+ else if(W > 1.2)
+ M[ell][ New] = Mu[ell][ New] * 1.2;
+ else if(W < .5)
+ M[ell][ New] = Mu[ell][ New] * .5;
+ else
+ M[ell][ New] = Mu[ell][ New] * W;
+ Tmp = Tmp + powf(M[ell][ New] , 2);
+ }
+
+ Tmp = sqrt(RM0 / Tmp);
+
+ for(ell = 1; ell <= L; ell++) {
+ M[ell][ New] = M[ell][ New] * Tmp;
+ }
+
+ // update SE
+ SE = .95 * SE + .05 * RM0; if(SE < 10000) SE = 10000;
+
+}
+
+void
+software_imbe_decoder::ifft(float FDi[], float FDq[], float TD[]) // ToDo: replace "real IFFT" with fftw3 IFFT proc!
+{
+ //Inverse FFT:
+ // transform 129-point freq domain(FDx) to 256-point time domain(TD)
+
+ float Ai[128];
+ float Aq[128];
+
+ int I;
+ int J;
+ int K;
+ int H;
+ float l_Ui, l_Uq, Si, Sq, Ti, Tq, Xi, Xq;
+
+ for(I = 0; I <= 63; I++) {
+ J = I + 64; //64 to 127
+ K = I * 2; //0 to 126(step 2)
+ H = 128 - K; //128 to 2(step 2)
+ Ai[I] = FDi[K] + FDq[K];
+ Aq[I] = FDi[K + 1] + FDq[K + 1];
+ Ai[J] = FDi[H] - FDq[H];
+ Aq[J] = FDi[H - 1] - FDq[H - 1];
+ }
+
+ fft(Ai, Aq);
+
+ for(I = 1; I <= 63; I++) {
+ J = 128 - I; //127 to 65
+ K = I + 128; //129 to 191
+ H = J + 128; //255 to 193
+ FDi[K] = (Aq[I] + Aq[J]) / 2;
+ FDi[H] = FDi[K] ; //a
+ FDq[K] = -(Ai[I] - Ai[J]) / 2;
+ FDq[H] = -FDq[K] ; //b
+ FDi[I] = (Ai[I] + Ai[J]) / 2;
+ FDi[J] = FDi[I] ; //c
+ FDq[I] = (Aq[I] - Aq[J]) / 2;
+ FDq[J] = -FDq[I] ; //d
+ }
+
+ // I,J=64 K,H=192
+ FDi[192] = Aq[64]; //a
+ FDq[192] = 0 ; //b
+ FDi[64] = Ai[64] ; //c (new)
+ FDq[64] = 0 ; //d
+
+ //I=0 J,K=128 H=256 ( Ax(128) wraps to Ax(0))
+ FDi[128] = Aq[0] ; //a
+ FDq[128] = 0 ; //b
+ FDi[0] = Ai[0] ; //c (new)
+ FDq[0] = 0 ; //d
+
+ l_Ui = 1; l_Uq = 0;
+ Si = cos(M_PI / 128); Sq = -sin(M_PI / 128);
+ for(I = 0; I <= 127; I++) {
+ J = I + 128 ; //128 TO 255
+
+ Ti = FDi[J] * l_Ui - FDq[J] * l_Uq; Xi = FDi[I];
+ Tq = FDi[J] * l_Uq + FDq[J] * l_Ui; Xq = FDq[I];
+
+
+ TD[I + 128] =((Xi + Ti) -(Xq + Tq));
+ TD[I ] =((Xi - Ti) -(Xq - Tq));
+
+ Ti = l_Ui;
+ l_Ui = Ti * Si - l_Uq * Sq;
+ l_Uq = Ti * Sq + l_Uq * Si;
+ }
+}
+
+uint16_t
+software_imbe_decoder::rearrange(uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7)
+{
+ int K;
+ int I, ubit, Seq, col;
+
+ bee[0] =((u0 / 16) & 0xfc) |((u7 / 2) & 3);
+
+ w0 = 4 * M_PI /(bee[0] + 39.5);
+
+ L =(int)(.9254 * floorf((M_PI / w0) + .25)); if(L < 9 || L > 56) exit(2);
+
+ if( L > 36) {
+ K = 12;
+ } else {
+ K =((L + 2) / 3);
+ if(K > 12)
+ exit(3);
+ }
+
+ for(I = 1; I <= L + 1; I++) { bee[I] = 0; }
+
+ bee[2] =(u0 & 56) |((u7 / 8) & 1);
+
+
+ Seq =(L - 9) * 75;
+
+ ubit = 4;
+ for(I = 0; I <= 2; I++) {
+ if( u0 & ubit) {
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 2048;
+ for(I = 0; I <= 11; I++) {
+ if(u1 & ubit){
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1; ubit = ubit / 2;
+ }
+
+ ubit = 2048;
+ for(I = 0; I <= 11; I++) {
+ if(u2 & ubit){
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 2048;
+ for(I = 0; I <= 11; I++) {
+ if(u3 & ubit) {
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 1024;
+ for(I = 0; I <= 10; I++) {
+ if(u4 & ubit) {
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 1024;
+ for(I = 0; I <= 10; I++) {
+ if(u5 & ubit) {
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 1024;
+ for(I = 0; I <= 10; I++) {
+ if(u6 & ubit){
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ ubit = 64;
+ for(I = 4; I <= 6; I++) {
+ if(u7 & ubit) {
+ col = BMTn[Seq];
+ bee[col] = bee[col] + BMTb[Seq];
+ }
+ Seq = Seq + 1;
+ ubit = ubit / 2;
+ }
+
+ return K;
+}
+
+void
+software_imbe_decoder::synth_unvoiced()
+{
+ float Uwi[256];
+ float Uwq[256];
+ float uw[256];
+
+ float Tmp;
+
+ int ell, bl, em, al, en;
+
+ // Generate the next 160 samples of white noise
+ for (en = 0; en < 51; en++) {
+ u[en] = u[en + 160];
+ }
+ for (; en < 211; en++) {
+ u[en] = next_u(u[en-1]);
+ }
+
+ ell = 0; bl =(int) ceilf(128 / M_PI *(ell + .5) * w0);
+ for(em = 0; em <= bl - 1; em++) {
+ Uwi[em] = 0; Uwq[em] = 0;
+ }
+
+ Luv = 0;
+ for(ell = 1; ell <= L; ell++) {
+ al = bl; bl =(int) ceilf(128 / M_PI * (ell + .5) * w0);
+ if(vee[ell][New]) {
+ // FOR em = al TO bl - 1
+ for(em = al; em <= bl - 1; em++) {
+ Uwi[em] = 0; Uwq[em] = 0;
+ }
+ } else {
+ Luv = Luv + 1;
+ for(em = al; em <= bl - 1; em++) {
+ Uwi[em] = 0;
+ Uwq[em] = 0;
+ for (en = 0; en < 211; en++) {
+ float exp = -0.0078125 * M_PI * em * (en - 105);
+ Uwi[em] = Uwi[em] + u[en] * ws[en] * cos(exp);
+ Uwq[em] = Uwq[em] + u[en] * ws[en] * sin(exp);
+ }
+ }
+ //precompute Tmp = <most of big hairy equation>
+ Tmp = 0;
+ // FOR en = al TO bl - 1
+ for(en = al; en <= bl - 1; en++) {
+ Tmp += powf(Uwi[en], 2) + powf(Uwq[en], 2);
+ }
+ // 0.91652 is my best guess at what the unvoiced scaling
+ // coefficient is supposed to be
+ Tmp = 0.91652 * M[ell][New] / sqrt(Tmp /(bl - al));
+ //now do the rest of b.h.e.
+ for(em = al; em <= bl - 1; em++) {
+ Uwi[em] =(Uwi[em]) * Tmp;
+ Uwq[em] =(Uwq[em]) * Tmp;
+ }
+ }
+ }
+ // finally do over-freq
+ // FOR em = bl TO 128
+ for(em = bl; em <= 128; em++) {
+ Uwi[em] = 0; Uwq[em] = 0;
+ }
+
+ ifft(Uwi, Uwq, uw);
+
+ // ws(n)*uw(n,-1) + ws(n-159)*uw(n-159,0) uw(-128 to 127)
+ //suv(n) = --------------------------------------
+ // (ws(n)^2) +(ws(n-159)^2) ws(-105 to 105)
+
+ for(en = 0; en <= 55; en++) {
+ suv[en] = Olduw[en+128];
+ }
+ for(en = 56; en <= 104; en++) {
+ suv[en] =(ws[en+105] * Olduw[en+128] + ws[en - 55] * uw[en - 32]) * woaa[en];
+ }
+ for(en = 105; en <= 159; en++) {
+ suv[en] = uw[en - 32];
+ }
+
+ for(en = -128; en <= 127; en++) {
+ Olduw[en+128] = uw[en+128];
+ }
+}
+
+void
+software_imbe_decoder::synth_voiced()
+{
+ float MaxL;
+ float Tmp;
+ float Dpl;
+ float Dwl;
+ float THa;
+ float THb;
+ float MNew;
+ float MOld;
+ float Mb;
+
+ int ell, en;
+
+ if( L > OldL) {
+ MaxL = L;
+ } else {
+ MaxL = OldL;
+ }
+
+ psi1 = psi1 +(Oldw0 + w0) * 80;
+ psi1 = remainderf(psi1, 2 * M_PI); // ToDo: decide if its 2pi or pi^2
+
+ for(ell = 1; ell <= L/4; ell++) {
+ phi[ell][ New] = psi1 * ell;
+ }
+ Tmp = Luv / L;
+ for(; ell <= MaxL; ell++) {
+ phi[ell][ New] = psi1 * ell /* + Tmp * PhzNz[ell] */;
+ }
+
+ for(en = 0; en <= 159; en++) {
+ sv[en] = 0;
+ }
+
+ for(ell = 1; ell <= MaxL; ell++) {
+
+ if(ell > L) {
+ MNew = 0;
+ } else {
+ MNew = M[ell][ New];
+ }
+
+ if(ell > OldL) {
+ MOld = 0;
+ } else {
+ MOld = M[ell][ Old];
+ }
+
+ if(vee[ell][ New]) {
+ if ( vee[ell][ Old]) {
+ if(ell < 8 && fabsf(w0 - Oldw0) < .1 * w0) { // (fine transition)
+ Dpl = phi[ell][ New] - phi[ell][ Old] -(Oldw0 + w0) * ell * 80;
+ Dwl = .00625 * (Dpl - 2 * M_PI * floorf((Dpl + M_PI) / (2 * M_PI)));
+ THa = (Oldw0 * (float)ell + Dwl);
+ THb = (w0 - Oldw0) * ell * .003125;
+ Mb = .00625 *(MNew - MOld);
+ for(en = 0; en <= 159; en++) {
+ sv[en] = sv[en] +(MOld + en * Mb) * cos(phi[ell][ Old] +(THa + THb * en) * en);
+ }
+ } else { // (coarse transition)
+ for(en = 0; en <= 55; en++) {
+ sv[en] = sv[en] + ws[en+105] * MOld * cos(Oldw0 * en * ell + phi[ell] [ Old]);
+ }
+ for(en = 56; en <= 105; en++) {
+ sv[en] = sv[en] + ws[en+105] * MOld * cos(Oldw0 * en * ell + phi[ell][ Old]);
+ sv[en] = sv[en] + ws[en-55] * MNew * cos(w0 *(en - 160) * ell + phi[ell][ New]);
+ }
+ for(en = 106; en <= 159; en++) {
+ sv[en] = sv[en] + ws[en-55] * MNew * cos(w0 *(en - 160) * ell + phi[ell][ New]);
+ }
+ }
+ } else {
+ for(en = 56; en <= 159; en++) {
+ sv[en] = sv[en] + ws[en-55] * MNew * cos(w0 *(en - 160) * ell + phi[ell][ New]);
+ }
+ }
+ } else {
+ if( vee[ell][Old]) {
+ for(en = 0; en <= 105; en++) {
+ sv[en] = sv[en] + ws[en+105] * MOld * cos(Oldw0 * en * ell + phi[ell][ Old]);
+ }
+ }
+ }
+ }
+}
+
diff --git a/op25/gr-op25_repeater/lib/software_imbe_decoder.h b/op25/gr-op25_repeater/lib/software_imbe_decoder.h
new file mode 100644
index 0000000..aae1e70
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/software_imbe_decoder.h
@@ -0,0 +1,103 @@
+/* -*- C++ -*- */
+
+/*
+ * Copyright 2008-2009 Steve Glass
+ *
+ * This file is part of OP25.
+ *
+ * OP25 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.
+ *
+ * OP25 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 OP25; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_SOFTWARE_IMBE_DECODER_H
+#define INCLUDED_SOFTWARE_IMBE_DECODER_H
+
+#include "imbe_decoder.h"
+
+#include <stdint.h>
+
+/**
+ * A software implementation of the imbe_decoder interface.
+ */
+class software_imbe_decoder : public imbe_decoder {
+public:
+
+ /**
+ * Default constructor for the software_imbe_decoder.
+ */
+ software_imbe_decoder();
+
+ /**
+ * Destructor for the software_imbe_decoder.
+ */
+ virtual ~software_imbe_decoder();
+
+ /**
+ * Decode the compressed audio.
+ *
+ * \cw in IMBE codeword (including parity check bits).
+ */
+ virtual void decode(const voice_codeword& cw);
+
+private:
+
+ //NOTE: Single-letter variable names are upper case only; Lower
+ // case if needed is spelled. e.g. L, ell
+
+ // global Seq ER ?
+
+ int bee[58]; //Encoded Spectral Amplitudes
+ float M[57][2]; //Enhanced Spectral Amplitudes
+ float Mu[57][2]; //Unenhanced Spectral Amplitudes
+ int vee[57][2]; //V/UV decisions
+ float suv[160]; //Unvoiced samples
+ float sv[160]; //Voiced samples
+ float log2Mu[58][2];
+ float Olduw[256];
+ float psi1;
+ float phi[57][2];
+ uint32_t u[211];
+
+ int Old;
+ int New;
+ int L;
+ int OldL;
+ float w0;
+ float Oldw0;
+ float Luv; //number of unvoiced spectral amplitudes
+
+ char sym_b[4096];
+ char RxData[4096];
+ int sym_bp;
+ int ErFlag;
+
+ uint32_t pngen15(uint32_t& pn);
+ uint32_t pngen23(uint32_t& pn);
+ uint32_t next_u(uint32_t u);
+ void decode_audio(uint8_t *);
+ void decode_spectral_amplitudes(int, int );
+ void decode_vuv(int );
+ void adaptive_smoothing(float, float, float );
+ void fft(float i[], float q[]);
+ void enhance_spectral_amplitudes(float&);
+ void ifft(float i[], float q[], float[]);
+ uint16_t rearrange(uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7);
+ void synth_unvoiced();
+ void synth_voiced();
+ void unpack(uint8_t *buf, uint32_t& u0, uint32_t& u1, uint32_t& u2, uint32_t& u3, uint32_t& u4, uint32_t& u5, uint32_t& u6, uint32_t& u7, uint32_t& E0, uint32_t& ET);
+};
+
+
+#endif /* INCLUDED_SOFTWARE_IMBE_DECODER_H */
diff --git a/op25/gr-op25_repeater/lib/test_op25_repeater.cc b/op25/gr-op25_repeater/lib/test_op25_repeater.cc
new file mode 100644
index 0000000..4c9f42e
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/test_op25_repeater.cc
@@ -0,0 +1,47 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cppunit/TextTestRunner.h>
+#include <cppunit/XmlOutputter.h>
+
+#include <gnuradio/unittests.h>
+#include "qa_op25_repeater.h"
+#include <iostream>
+
+int
+main (int argc, char **argv)
+{
+ CppUnit::TextTestRunner runner;
+ std::ofstream xmlfile(get_unittest_path("op25_repeater.xml").c_str());
+ CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
+
+ runner.addTest(qa_op25_repeater::suite());
+ runner.setOutputter(xmlout);
+
+ bool was_successful = runner.run("", false);
+
+ return was_successful ? 0 : 1;
+}
diff --git a/op25/gr-op25_repeater/lib/vocoder_impl.cc b/op25/gr-op25_repeater/lib/vocoder_impl.cc
new file mode 100644
index 0000000..fe3c33c
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/vocoder_impl.cc
@@ -0,0 +1,523 @@
+/* -*- c++ -*- */
+/*
+ * GNU Radio interface for Pavel Yazev's Project 25 IMBE Encoder/Decoder
+ *
+ * Copyright 2009 Pavel Yazev E-mail: pyazev@gmail.com
+ * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include "vocoder_impl.h"
+
+#include <vector>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "imbe_vocoder/imbe_vocoder.h"
+#include "p25_frame.h"
+#include "op25_imbe_frame.h"
+
+namespace gr {
+ namespace op25_repeater {
+
+/* bits to be preset to 1 for all transmitted frames */
+static const bool ldu1_preset[] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0-35 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 36-71 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 72-107 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 108-143 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-179 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 180-215 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 216-251 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 252-287 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 288-323 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 324-359 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 360-395 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 396-431 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 432-467 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 468-503 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 504-539 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 540-575 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 576-611 */
+ 0,1,0,1,1,0,1,1,0,1,0,1,0,1,0,1,1,0,0,1,0,1,0,1,0,1,1,0,0,0,0,0,0,0,1,0, /* 612-647 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 648-683 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 684-719 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 720-755 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, /* 756-791 */
+ 1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,1,0,0,1, /* 792-827 */
+ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 828-863 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 864-899 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 900-935 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 936-971 */
+ 0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,1,0,1,1,0, /* 972-1007 */
+ 0,1,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1008-1043 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1044-1079 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1080-1115 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1116-1151 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,1,1, /* 1152-1187 */
+ 1,1,1,1,0,0,1,1,1,1,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1188-1223 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1224-1259 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1260-1295 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1296-1331 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1, /* 1332-1367 */
+ 1,1,1,0,1,1,0,1,1,1,0,0,1,0,1,1,0,1,0,0,0,1,1,0,1,1,1,0,0,1,0,0,0,0,0,0, /* 1368-1403 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1404-1439 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1440-1475 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1476-1511 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1512-1547 */
+ 1,0,1,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0, /* 1548-1583 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1584-1619 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1620-1655 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1656-1691 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 /* 1692-1727 */
+};
+
+static const bool ldu2_preset[] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0-35 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 36-71 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 72-107 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 108-143 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-179 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 180-215 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 216-251 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 252-287 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 288-323 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 324-359 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 360-395 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 396-431 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 432-467 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 468-503 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 504-539 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 540-575 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 576-611 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 612-647 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 648-683 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 684-719 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 720-755 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 756-791 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 792-827 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 828-863 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 864-899 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 900-935 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 936-971 */
+ 0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 972-1007 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1008-1043 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1044-1079 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1080-1115 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1116-1151 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,0,0,0,1,0,1,1,0,1,0,0, /* 1152-1187 */
+ 1,0,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1188-1223 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1224-1259 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1260-1295 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1296-1331 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,1,0,1,0,1,1, /* 1332-1367 */
+ 1,1,1,1,0,1,0,0,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0, /* 1368-1403 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1404-1439 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1440-1475 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1476-1511 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1512-1547 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1548-1583 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1584-1619 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1620-1655 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1656-1691 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 1692-1727 */
+};
+
+static void clear_bits(bit_vector& v) {
+ for (size_t i=0; i<v.size(); i++) {
+ v[i]=0;
+ }
+}
+
+ vocoder::sptr
+ vocoder::make(bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag)
+ {
+ return gnuradio::get_initial_sptr
+ (new vocoder_impl(encode_flag, verbose_flag, stretch_amt, udp_host, udp_port, raw_vectors_flag));
+ }
+
+//////////////////////////////////////////////////////////////
+// enc/dec udp operation
+// dec no byte input; short output
+// dec yes byte input; null output
+// enc no short input; char output
+// enc yes short input; null output
+
+#define M_IN(encode_flag, udp_port) (1)
+#define M_OUT(encode_flag, udp_port) ((udp_port) ? 0 : 1)
+#define S_IN(encode_flag, udp_port) ((encode_flag) ? sizeof(int16_t) : sizeof(uint8_t))
+#define S_OUT(encode_flag, udp_port) ((udp_port) ? 0 : ((encode_flag) ? sizeof(uint8_t) : sizeof(int16_t)))
+
+ /*
+ * The private constructor
+ */
+ vocoder_impl::vocoder_impl(bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag)
+ : gr::block("vocoder",
+ gr::io_signature::make (M_IN(encode_flag, udp_port), M_IN(encode_flag, udp_port), S_IN(encode_flag, udp_port)),
+ gr::io_signature::make (M_OUT(encode_flag, udp_port), M_OUT(encode_flag, udp_port), S_OUT(encode_flag, udp_port))),
+ frame_cnt(0),
+ write_sock(0),
+ write_bufp(0),
+ peak_amplitude(0),
+ peak(0),
+ samp_ct(0),
+ rxbufp(0),
+ codeword_ct(0),
+ sampbuf_ct(0),
+ stretch_count(0),
+ save_l(0),
+ f_body(P25_VOICE_FRAME_SIZE)
+ {
+ opt_encode_flag = encode_flag;
+ opt_dump_raw_vectors = raw_vectors_flag;
+ opt_verbose = verbose_flag;
+ opt_udp_port = udp_port;
+
+ opt_stretch_amt = 0;
+ if (stretch_amt < 0) {
+ opt_stretch_sign = -1;
+ opt_stretch_amt = 0 - stretch_amt;
+ } else {
+ opt_stretch_sign = 1;
+ opt_stretch_amt = stretch_amt;
+ }
+
+ if (opt_udp_port == 0)
+ if (encode_flag) {
+ // local output to gr source
+ // encoding: an LDU's worth of dibits
+ set_output_multiple(P25_VOICE_FRAME_SIZE >> 1);
+ } else {
+ // decoding: an LDU's worth of audio samples
+ // set_output_multiple(FRAME * nof_voice_codewords);
+ }
+ else
+ // remote UDP output
+ init_sock(udp_host, opt_udp_port);
+
+ clear_bits(f_body);
+
+ const char *p = getenv("IMBE");
+ if (p && strcasecmp(p, "soft") == 0)
+ d_software_imbe_decoder = true;
+ else
+ d_software_imbe_decoder = false;
+ }
+
+ /*
+ * Our virtual destructor.
+ */
+ vocoder_impl::~vocoder_impl()
+ {
+ }
+
+static const int STATS_INTERVAL = 20;
+static const int SAMP_INTERVAL = 8192;
+
+void vocoder_impl::append_imbe_codeword(bit_vector& frame_body, int16_t frame_vector[], unsigned int& codeword_ct)
+{
+ voice_codeword cw(voice_codeword_sz);
+ uint8_t obuf[P25_VOICE_FRAME_SIZE/2];
+ // construct 144-bit codeword from 88 bits of parameters
+ imbe_header_encode(cw, frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]);
+
+ // add codeword to voice data unit
+ imbe_interleave(frame_body, cw, codeword_ct);
+
+ // after the ninth and final codeword added, dispose of frame
+ if (++codeword_ct >= nof_voice_codewords) {
+ static const uint64_t hws[2] = { 0x293555ef2c653437LL, 0x293aba93bec26a2bLL };
+ int ldu_type = frame_cnt & 1; // set ldu_type = 0(LDU1) or 1(LDU2)
+ const bool* ldu_preset = (ldu_type == 0) ? ldu1_preset : ldu2_preset;
+
+ p25_setup_frame_header(frame_body, hws[ldu_type]);
+ for (size_t i = 0; i < frame_body.size(); i++) {
+ frame_body[i] = frame_body[i] | ldu_preset[i];
+ }
+ // finally, output the frame
+ if (opt_udp_port > 0) {
+ // pack the bits into bytes, MSB first
+ size_t obuf_ct = 0;
+ for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 8) {
+ uint8_t b =
+ (frame_body[i+0] << 7) +
+ (frame_body[i+1] << 6) +
+ (frame_body[i+2] << 5) +
+ (frame_body[i+3] << 4) +
+ (frame_body[i+4] << 3) +
+ (frame_body[i+5] << 2) +
+ (frame_body[i+6] << 1) +
+ (frame_body[i+7] );
+ obuf[obuf_ct++] = b;
+ }
+ sendto(write_sock, obuf, obuf_ct, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr));
+ } else {
+ for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 2) {
+ uint8_t dibit =
+ (frame_body[i+0] << 1) +
+ (frame_body[i+1] );
+ output_queue.push_back(dibit);
+ }
+ }
+ codeword_ct = 0;
+ frame_cnt++;
+ if (opt_verbose && (frame_cnt % STATS_INTERVAL) == 0) {
+ gettimeofday(&tv, &tz);
+ int s = tv.tv_sec - oldtv.tv_sec;
+ int us = tv.tv_usec - oldtv.tv_usec;
+ if (us < 0) {
+ us = us + 1000000;
+ s = s - 1;
+ }
+ float f = us;
+ f /= 1000000;
+ f += s;
+ fprintf (stderr, "time %f peak %5d\n", f / STATS_INTERVAL, peak_amplitude);
+ oldtv = tv;
+ }
+ clear_bits(f_body);
+ }
+}
+
+void vocoder_impl::rxchar(char c)
+{
+ int16_t snd[FRAME];
+ int16_t frame_vector[8];
+ int u[8];
+
+ if (c < ' ') {
+ if (c == '\n') {
+ rxbuf[rxbufp] = 0;
+ sscanf(rxbuf, "%x %x %x %x %x %x %x %x", &u[0], &u[1], &u[2], &u[3], &u[4], &u[5], &u[6], &u[7]);
+ rxbufp = 0;
+ // decode 88 bits, outputs 160 sound samples (8000 rate)
+ if (d_software_imbe_decoder) {
+ voice_codeword cw(voice_codeword_sz);
+ imbe_header_encode(cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]);
+ software_decoder.decode(cw);
+ audio_samples *samples = software_decoder.audio();
+ for (int i=0; i < FRAME; i++) {
+ if (samples->size() > 0) {
+ snd[i] = (int16_t)(samples->front() * 32768.0);
+ samples->pop_front();
+ } else {
+ snd[i] = 0;
+ }
+ }
+ } else {
+ for (int i=0; i < 8; i++) {
+ frame_vector[i] = u[i];
+ }
+ /* TEST*/ frame_vector[7] >>= 1;
+ vocoder.imbe_decode(frame_vector, snd);
+ }
+ if (opt_udp_port > 0) {
+ sendto(write_sock, snd, FRAME * sizeof(int16_t), 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr));
+ } else {
+ // add generated samples to output queue
+ for (int i = 0; i < FRAME; i++) {
+ output_queue_decode.push_back(snd[i]);
+ }
+ }
+ }
+ return;
+ }
+ rxbuf[rxbufp++] = c;
+ if (rxbufp >= RXBUF_MAX) {
+ rxbufp = RXBUF_MAX - 1;
+ }
+}
+
+void vocoder_impl::compress_frame(int16_t snd[])
+{
+ int16_t frame_vector[8];
+
+ // encode 160 audio samples into 88 bits (u0-u7)
+ vocoder.imbe_encode(frame_vector, snd);
+
+ // if dump option, dump u0-u7 to output
+ if (opt_dump_raw_vectors) {
+ char s[128];
+ sprintf(s, "%03x %03x %03x %03x %03x %03x %03x %03x\n", frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]);
+ memcpy(&write_buf[write_bufp], s, strlen(s));
+ write_bufp += strlen(s);
+ if (write_bufp >= 288) {
+ sendto(write_sock, write_buf, 288, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr));
+ write_bufp = 0;
+ }
+ return;
+ }
+ append_imbe_codeword(f_body, frame_vector, codeword_ct);
+}
+
+void vocoder_impl::add_sample(int16_t samp)
+{
+ // add one sample to 160-sample frame buffer and process if filled
+ sampbuf[sampbuf_ct++] = samp;
+ if (sampbuf_ct >= FRAME) {
+ compress_frame(sampbuf);
+ sampbuf_ct = 0;
+ }
+
+ // track signal amplitudes
+ int16_t asamp = (samp < 0) ? 0 - samp : samp;
+ peak = (asamp > peak) ? asamp : peak;
+ if (++samp_ct >= SAMP_INTERVAL) {
+ peak_amplitude = peak;
+ peak = 0;
+ samp_ct = 0;
+ }
+}
+
+void vocoder_impl::compress_samp(int16_t samp)
+{
+ // Apply sample rate slew to accomodate sound card rate discrepancy -
+ // workaround for USRP underrun problem occurring when sound card
+ // capture rate is slower than the correct rate
+
+ // FIXME: autodetect proper value for opt_stretch_amt
+ // perhaps by steering the LDU output rate to a 180.0 msec. rate
+
+ stretch_count++;
+ if (opt_stretch_amt != 0 && stretch_count >= opt_stretch_amt) {
+ stretch_count = 0;
+ if (opt_stretch_sign < 0)
+ // spill this samp
+ return;
+ // repeat this samp
+ add_sample(samp);
+ }
+ add_sample(samp);
+}
+
+void vocoder_impl::init_sock(char* udp_host, int udp_port)
+{
+ memset (&write_sock_addr, 0, sizeof(write_sock_addr));
+ write_sock = socket(PF_INET, SOCK_DGRAM, 17); // UDP socket
+ if (write_sock < 0) {
+ fprintf(stderr, "vocoder: socket: %d\n", errno);
+ write_sock = 0;
+ return;
+ }
+ if (!inet_aton(udp_host, &write_sock_addr.sin_addr)) {
+ fprintf(stderr, "vocoder: bad IP address\n");
+ close(write_sock);
+ write_sock = 0;
+ return;
+ }
+ write_sock_addr.sin_family = AF_INET;
+ write_sock_addr.sin_port = htons(udp_port);
+}
+
+void
+vocoder_impl::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
+{
+ /* When encoding, this block consumes 8000 symbols/s and produces 4800
+ * samples/s. That's a sampling rate of 5/3 or 1.66667.
+ *
+ * When decoding, the block consumes one line of text per voice codeword.
+ * Each line of text is exactly 32 bytes. It outputs 160 samples for each
+ * codeword; the ratio is thus 32/160 = 0.2.
+ *
+ * Thanks to Matt Mills for catching a bug where this value wasn't set correctly
+ */
+ const size_t nof_inputs = nof_input_items_reqd.size();
+ const int nof_samples_reqd = (opt_encode_flag) ? (1.66667 * nof_output_items) : (0.2 * nof_output_items);
+ std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
+}
+
+int
+vocoder_impl::general_work_decode (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *in = (const char *) input_items[0];
+
+ for (int i = 0; i < ninput_items[0]; i++){
+ rxchar(in[i]);
+ }
+
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+
+ consume_each (ninput_items[0]);
+
+ uint16_t *out = reinterpret_cast<uint16_t*>(output_items[0]);
+ const int n = std::min(static_cast<int>(output_queue_decode.size()), noutput_items);
+ if(0 < n) {
+ copy(output_queue_decode.begin(), output_queue_decode.begin() + n, out);
+ output_queue_decode.erase(output_queue_decode.begin(), output_queue_decode.begin() + n);
+ }
+ // Tell runtime system how many output items we produced.
+ return n;
+}
+
+int
+vocoder_impl::general_work_encode (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const short *in = (const short *) input_items[0];
+
+ for (int i = 0; i < ninput_items[0]; i++){
+ compress_samp(in[i]);
+ }
+
+ // Tell runtime system how many input items we consumed on
+ // each input stream.
+
+ consume_each (ninput_items[0]);
+
+ if (opt_udp_port > 0) // in udp option, we are a gr sink only
+ return 0;
+
+ uint8_t *out = reinterpret_cast<uint8_t*>(output_items[0]);
+ const int n = std::min(static_cast<int>(output_queue.size()), noutput_items);
+ if(0 < n) {
+ copy(output_queue.begin(), output_queue.begin() + n, out);
+ output_queue.erase(output_queue.begin(), output_queue.begin() + n);
+ }
+ // Tell runtime system how many output items we produced.
+ return n;
+}
+
+int
+vocoder_impl::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ if (opt_encode_flag)
+ return general_work_encode(noutput_items, ninput_items, input_items, output_items);
+ else
+ return general_work_decode(noutput_items, ninput_items, input_items, output_items);
+}
+
+ } /* namespace op25_repeater */
+} /* namespace gr */
diff --git a/op25/gr-op25_repeater/lib/vocoder_impl.h b/op25/gr-op25_repeater/lib/vocoder_impl.h
new file mode 100644
index 0000000..51529d9
--- /dev/null
+++ b/op25/gr-op25_repeater/lib/vocoder_impl.h
@@ -0,0 +1,114 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_OP25_REPEATER_VOCODER_IMPL_H
+#define INCLUDED_OP25_REPEATER_VOCODER_IMPL_H
+
+#include <op25_repeater/vocoder.h>
+
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <vector>
+#include <deque>
+
+#include "imbe_vocoder/imbe_vocoder.h"
+
+#include "imbe_decoder.h"
+#include "software_imbe_decoder.h"
+
+namespace gr {
+ namespace op25_repeater {
+
+ typedef std::vector<bool> bit_vector;
+ class vocoder_impl : public vocoder
+ {
+ private:
+ // Nothing to declare in this block.
+
+ public:
+ vocoder_impl(bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag);
+ ~vocoder_impl();
+
+ void forecast (int noutput_items, gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ int general_work_encode (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ int general_work_decode (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ private:
+ static const int RXBUF_MAX = 80;
+
+ /* data items */
+ int frame_cnt ;
+ int write_sock;
+ struct sockaddr_in write_sock_addr;
+ int write_bufp;
+ char write_buf[512];
+ struct timeval tv;
+ struct timezone tz;
+ struct timeval oldtv;
+ int peak_amplitude;
+ int peak;
+ int samp_ct;
+ char rxbuf[RXBUF_MAX];
+ int rxbufp ;
+ unsigned int codeword_ct ;
+ int16_t sampbuf[FRAME];
+ size_t sampbuf_ct ;
+ int stretch_count ;
+ uint8_t save_l;
+ bit_vector f_body;
+ imbe_vocoder vocoder;
+ software_imbe_decoder software_decoder;
+ bool d_software_imbe_decoder;
+
+ std::deque<uint8_t> output_queue;
+ std::deque<uint16_t> output_queue_decode;
+
+ bool opt_encode_flag;
+ bool opt_dump_raw_vectors;
+ bool opt_verbose;
+ int opt_stretch_amt;
+ int opt_stretch_sign;
+ int opt_udp_port;
+ /* local methods */
+ void append_imbe_codeword(bit_vector& frame_body, int16_t frame_vector[], unsigned int& codeword_ct);
+ void rxchar(char c);
+ void compress_frame(int16_t snd[]);
+ void add_sample(int16_t samp);
+ void compress_samp(int16_t samp);
+ void init_sock(char* udp_host, int udp_port);
+ };
+
+ } // namespace op25_repeater
+} // namespace gr
+
+#endif /* INCLUDED_OP25_REPEATER_VOCODER_IMPL_H */
diff --git a/op25/gr-op25_repeater/python/CMakeLists.txt b/op25/gr-op25_repeater/python/CMakeLists.txt
new file mode 100644
index 0000000..9958577
--- /dev/null
+++ b/op25/gr-op25_repeater/python/CMakeLists.txt
@@ -0,0 +1,47 @@
+# 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 python install macros
+########################################################################
+include(GrPython)
+if(NOT PYTHONINTERP_FOUND)
+ return()
+endif()
+
+########################################################################
+# Install python sources
+########################################################################
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/op25_repeater
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+include(GrTest)
+
+set(GR_TEST_TARGET_DEPS gnuradio-op25_repeater)
+set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
+GR_ADD_TEST(qa_vocoder ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_vocoder.py)
+GR_ADD_TEST(qa_gardner_costas_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_gardner_costas_cc.py)
+GR_ADD_TEST(qa_p25_frame_assembler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_p25_frame_assembler.py)
+GR_ADD_TEST(qa_fsk4_slicer_fb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_fsk4_slicer_fb.py)
diff --git a/op25/gr-op25_repeater/python/__init__.py b/op25/gr-op25_repeater/python/__init__.py
new file mode 100644
index 0000000..4628ad6
--- /dev/null
+++ b/op25/gr-op25_repeater/python/__init__.py
@@ -0,0 +1,54 @@
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This application 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.
+#
+# This application 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.
+#
+
+# The presence of this file turns this directory into a Python package
+
+'''
+This is the GNU Radio OP25_REPEATER module. Place your Python package
+description here (python/__init__.py).
+'''
+
+# ----------------------------------------------------------------
+# Temporary workaround for ticket:181 (swig+python problem)
+import sys
+_RTLD_GLOBAL = 0
+try:
+ from dl import RTLD_GLOBAL as _RTLD_GLOBAL
+except ImportError:
+ try:
+ from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
+ except ImportError:
+ pass
+
+if _RTLD_GLOBAL != 0:
+ _dlopenflags = sys.getdlopenflags()
+ sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
+# ----------------------------------------------------------------
+
+
+# import swig generated symbols into the op25_repeater namespace
+from op25_repeater_swig import *
+
+# import any pure python here
+#
+
+# ----------------------------------------------------------------
+# Tail of workaround
+if _RTLD_GLOBAL != 0:
+ sys.setdlopenflags(_dlopenflags) # Restore original flags
+# ----------------------------------------------------------------
diff --git a/op25/gr-op25_repeater/python/build_utils.py b/op25/gr-op25_repeater/python/build_utils.py
new file mode 100644
index 0000000..cf58a97
--- /dev/null
+++ b/op25/gr-op25_repeater/python/build_utils.py
@@ -0,0 +1,226 @@
+#
+# Copyright 2004,2009,2012 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.
+#
+
+"""Misc utilities used at build time
+"""
+
+import re, os, os.path
+from build_utils_codes import *
+
+
+# set srcdir to the directory that contains Makefile.am
+try:
+ srcdir = os.environ['srcdir']
+except KeyError, e:
+ srcdir = "."
+srcdir = srcdir + '/'
+
+# set do_makefile to either true or false dependeing on the environment
+try:
+ if os.environ['do_makefile'] == '0':
+ do_makefile = False
+ else:
+ do_makefile = True
+except KeyError, e:
+ do_makefile = False
+
+# set do_sources to either true or false dependeing on the environment
+try:
+ if os.environ['do_sources'] == '0':
+ do_sources = False
+ else:
+ do_sources = True
+except KeyError, e:
+ do_sources = True
+
+name_dict = {}
+
+def log_output_name (name):
+ (base, ext) = os.path.splitext (name)
+ ext = ext[1:] # drop the leading '.'
+
+ entry = name_dict.setdefault (ext, [])
+ entry.append (name)
+
+def open_and_log_name (name, dir):
+ global do_sources
+ if do_sources:
+ f = open (name, dir)
+ else:
+ f = None
+ log_output_name (name)
+ return f
+
+def expand_template (d, template_filename, extra = ""):
+ '''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
+ '''
+ global do_sources
+ output_extension = extract_extension (template_filename)
+ template = open_src (template_filename, 'r')
+ output_name = d['NAME'] + extra + '.' + output_extension
+ log_output_name (output_name)
+ if do_sources:
+ output = open (output_name, 'w')
+ do_substitution (d, template, output)
+ output.close ()
+ template.close ()
+
+def output_glue (dirname):
+ output_makefile_fragment ()
+ output_ifile_include (dirname)
+
+def output_makefile_fragment ():
+ global do_makefile
+ if not do_makefile:
+ return
+# overwrite the source, which must be writable; this should have been
+# checked for beforehand in the top-level Makefile.gen.gen .
+ f = open (os.path.join (os.environ.get('gendir', os.environ.get('srcdir', '.')), 'Makefile.gen'), 'w')
+ f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
+ output_subfrag (f, 'h')
+ output_subfrag (f, 'i')
+ output_subfrag (f, 'cc')
+ f.close ()
+
+def output_ifile_include (dirname):
+ global do_sources
+ if do_sources:
+ f = open ('%s_generated.i' % (dirname,), 'w')
+ f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
+ files = name_dict.setdefault ('i', [])
+ files.sort ()
+ f.write ('%{\n')
+ for file in files:
+ f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
+ f.write ('%}\n\n')
+ for file in files:
+ f.write ('%%include <%s>\n' % (file,))
+
+def output_subfrag (f, ext):
+ files = name_dict.setdefault (ext, [])
+ files.sort ()
+ f.write ("GENERATED_%s =" % (ext.upper ()))
+ for file in files:
+ f.write (" \\\n\t%s" % (file,))
+ f.write ("\n\n")
+
+def extract_extension (template_name):
+ # template name is something like: GrFIRfilterXXX.h.t
+ # we return everything between the penultimate . and .t
+ mo = re.search (r'\.([a-z]+)\.t$', template_name)
+ if not mo:
+ raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,)
+ return mo.group (1)
+
+def open_src (name, mode):
+ global srcdir
+ return open (os.path.join (srcdir, name), mode)
+
+def do_substitution (d, in_file, out_file):
+ def repl (match_obj):
+ key = match_obj.group (1)
+ # print key
+ return d[key]
+
+ inp = in_file.read ()
+ out = re.sub (r"@([a-zA-Z0-9_]+)@", repl, inp)
+ out_file.write (out)
+
+
+
+copyright = '''/* -*- c++ -*- */
+/*
+ * Copyright 2003,2004 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.
+ */
+'''
+
+def is_complex (code3):
+ if i_code (code3) == 'c' or o_code (code3) == 'c':
+ return '1'
+ else:
+ return '0'
+
+
+def standard_dict (name, code3, package='gr'):
+ d = {}
+ d['NAME'] = name
+ d['NAME_IMPL'] = name+'_impl'
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['GUARD_NAME_IMPL'] = 'INCLUDED_%s_%s_IMPL_H' % (package.upper(), name.upper())
+ d['BASE_NAME'] = re.sub ('^' + package + '_', '', name)
+ d['SPTR_NAME'] = '%s_sptr' % name
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
+
+
+def standard_dict2 (name, code3, package):
+ d = {}
+ d['NAME'] = name
+ d['BASE_NAME'] = name
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
+
+def standard_impl_dict2 (name, code3, package):
+ d = {}
+ d['NAME'] = name
+ d['IMPL_NAME'] = name
+ d['BASE_NAME'] = name.rstrip("impl").rstrip("_")
+ d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper())
+ d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten'
+ d['COPYRIGHT'] = copyright
+ d['FIR_TYPE'] = "fir_filter_" + code3
+ d['CFIR_TYPE'] = "fir_filter_" + code3[0:2] + 'c'
+ d['TYPE'] = i_type (code3)
+ d['I_TYPE'] = i_type (code3)
+ d['O_TYPE'] = o_type (code3)
+ d['TAP_TYPE'] = tap_type (code3)
+ d['IS_COMPLEX'] = is_complex (code3)
+ return d
diff --git a/op25/gr-op25_repeater/python/build_utils_codes.py b/op25/gr-op25_repeater/python/build_utils_codes.py
new file mode 100644
index 0000000..9ea96ba
--- /dev/null
+++ b/op25/gr-op25_repeater/python/build_utils_codes.py
@@ -0,0 +1,52 @@
+#
+# Copyright 2004 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.
+#
+
+def i_code (code3):
+ return code3[0]
+
+def o_code (code3):
+ if len (code3) >= 2:
+ return code3[1]
+ else:
+ return code3[0]
+
+def tap_code (code3):
+ if len (code3) >= 3:
+ return code3[2]
+ else:
+ return code3[0]
+
+def i_type (code3):
+ return char_to_type[i_code (code3)]
+
+def o_type (code3):
+ return char_to_type[o_code (code3)]
+
+def tap_type (code3):
+ return char_to_type[tap_code (code3)]
+
+
+char_to_type = {}
+char_to_type['s'] = 'short'
+char_to_type['i'] = 'int'
+char_to_type['f'] = 'float'
+char_to_type['c'] = 'gr_complex'
+char_to_type['b'] = 'unsigned char'
diff --git a/op25/gr-op25_repeater/python/qa_fsk4_slicer_fb.py b/op25/gr-op25_repeater/python/qa_fsk4_slicer_fb.py
new file mode 100755
index 0000000..f8292d1
--- /dev/null
+++ b/op25/gr-op25_repeater/python/qa_fsk4_slicer_fb.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This 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.
+#
+# This software 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 software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import op25_repeater_swig as op25_repeater
+
+class qa_fsk4_slicer_fb (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_fsk4_slicer_fb, "qa_fsk4_slicer_fb.xml")
diff --git a/op25/gr-op25_repeater/python/qa_gardner_costas_cc.py b/op25/gr-op25_repeater/python/qa_gardner_costas_cc.py
new file mode 100755
index 0000000..8c0add6
--- /dev/null
+++ b/op25/gr-op25_repeater/python/qa_gardner_costas_cc.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This 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.
+#
+# This software 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 software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import op25_repeater_swig as op25_repeater
+
+class qa_gardner_costas_cc (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_gardner_costas_cc, "qa_gardner_costas_cc.xml")
diff --git a/op25/gr-op25_repeater/python/qa_p25_frame_assembler.py b/op25/gr-op25_repeater/python/qa_p25_frame_assembler.py
new file mode 100755
index 0000000..4bbca93
--- /dev/null
+++ b/op25/gr-op25_repeater/python/qa_p25_frame_assembler.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This 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.
+#
+# This software 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 software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import op25_repeater_swig as op25_repeater
+
+class qa_p25_frame_assembler (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_p25_frame_assembler, "qa_p25_frame_assembler.xml")
diff --git a/op25/gr-op25_repeater/python/qa_vocoder.py b/op25/gr-op25_repeater/python/qa_vocoder.py
new file mode 100755
index 0000000..fcaafc4
--- /dev/null
+++ b/op25/gr-op25_repeater/python/qa_vocoder.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2013 <+YOU OR YOUR COMPANY+>.
+#
+# This 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.
+#
+# This software 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 software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import op25_repeater_swig as op25_repeater
+
+class qa_vocoder (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_vocoder, "qa_vocoder.xml")
diff --git a/op25/gr-op25_repeater/swig/CMakeLists.txt b/op25/gr-op25_repeater/swig/CMakeLists.txt
new file mode 100644
index 0000000..1d88bbd
--- /dev/null
+++ b/op25/gr-op25_repeater/swig/CMakeLists.txt
@@ -0,0 +1,57 @@
+# 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 swig generation macros
+########################################################################
+find_package(SWIG)
+find_package(PythonLibs 2)
+if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
+ return()
+endif()
+include(GrSwig)
+include(GrPython)
+
+########################################################################
+# Setup swig generation
+########################################################################
+foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
+endforeach(incdir)
+
+set(GR_SWIG_LIBRARIES gnuradio-op25_repeater)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/op25_repeater_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+
+GR_SWIG_MAKE(op25_repeater_swig op25_repeater_swig.i)
+
+########################################################################
+# Install the build swig module
+########################################################################
+GR_SWIG_INSTALL(TARGETS op25_repeater_swig DESTINATION ${GR_PYTHON_DIR}/op25_repeater)
+
+########################################################################
+# Install swig .i files for development
+########################################################################
+install(
+ FILES
+ op25_repeater_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/op25_repeater_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/op25_repeater/swig
+)
diff --git a/op25/gr-op25_repeater/swig/op25_repeater_swig.i b/op25/gr-op25_repeater/swig/op25_repeater_swig.i
new file mode 100644
index 0000000..59e7476
--- /dev/null
+++ b/op25/gr-op25_repeater/swig/op25_repeater_swig.i
@@ -0,0 +1,26 @@
+/* -*- c++ -*- */
+
+#define OP25_REPEATER_API
+
+%include "gnuradio.i" // the common stuff
+
+//load generated python docstrings
+%include "op25_repeater_swig_doc.i"
+
+%{
+#include "op25_repeater/vocoder.h"
+#include "op25_repeater/gardner_costas_cc.h"
+#include "op25_repeater/p25_frame_assembler.h"
+#include "op25_repeater/fsk4_slicer_fb.h"
+%}
+
+%include "op25_repeater/vocoder.h"
+GR_SWIG_BLOCK_MAGIC2(op25_repeater, vocoder);
+
+%include "op25_repeater/gardner_costas_cc.h"
+GR_SWIG_BLOCK_MAGIC2(op25_repeater, gardner_costas_cc);
+%include "op25_repeater/p25_frame_assembler.h"
+GR_SWIG_BLOCK_MAGIC2(op25_repeater, p25_frame_assembler);
+
+%include "op25_repeater/fsk4_slicer_fb.h"
+GR_SWIG_BLOCK_MAGIC2(op25_repeater, fsk4_slicer_fb);