[med-svn] [libbpp-raa] 01/13: Imported Upstream version 2.1.0
Andreas Tille
tille at debian.org
Thu Apr 21 16:05:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository libbpp-raa.
commit 546117d18e5db9cf94fdccb1dc58f4394c71cde7
Author: Andreas Tille <tille at debian.org>
Date: Thu Apr 21 17:32:39 2016 +0200
Imported Upstream version 2.1.0
---
AUTHORS.txt | 2 +
CMakeLists.txt | 172 +++
COPYING.txt | 505 +++++++
ChangeLog | 11 +
Doxyfile | 1890 ++++++++++++++++++++++++
INSTALL.txt | 12 +
bpp-raa.spec | 197 +++
debian/changelog | 36 +
debian/compat | 1 +
debian/control | 29 +
debian/copyright | 66 +
debian/libbpp-raa-dev.install | 3 +
debian/libbpp-raa1.install | 1 +
debian/postinst | 43 +
debian/postrm | 45 +
debian/prerm | 27 +
debian/rules | 119 ++
debian/source/format | 1 +
src/Bpp/Raa.all | 6 +
src/Bpp/Raa/RAA.cpp | 555 ++++++++
src/Bpp/Raa/RAA.h | 489 +++++++
src/Bpp/Raa/RAA_acnuc.c | 3092 ++++++++++++++++++++++++++++++++++++++++
src/Bpp/Raa/RAA_acnuc.h | 233 +++
src/Bpp/Raa/RaaList.cpp | 119 ++
src/Bpp/Raa/RaaList.h | 152 ++
src/Bpp/Raa/RaaSeqAttributes.h | 77 +
src/Bpp/Raa/RaaSpeciesTree.cpp | 115 ++
src/Bpp/Raa/RaaSpeciesTree.h | 141 ++
src/Bpp/Raa/md5.c | 310 ++++
src/Bpp/Raa/misc_acnuc.c | 754 ++++++++++
src/Bpp/Raa/parser.c | 114 ++
src/Bpp/Raa/parser.h | 15 +
src/Bpp/Raa/zsockr.c | 145 ++
src/CMakeLists.txt | 54 +
34 files changed, 9531 insertions(+)
diff --git a/AUTHORS.txt b/AUTHORS.txt
new file mode 100644
index 0000000..4f7ab60
--- /dev/null
+++ b/AUTHORS.txt
@@ -0,0 +1,2 @@
+Manolo Gouy <manolo.gouy at univ-lyon1.fr>
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..ed38906
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,172 @@
+# CMake script for Bio++ Remote Acnuc Access
+# Author: Sylvain Gaillard and Julien Dutheil
+# Created: 11/09/2009
+
+# Global parameters
+cmake_minimum_required(VERSION 2.6)
+project(bpp-raa C CXX)
+if(NOT DEFINED CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "Release")
+endif(NOT DEFINED CMAKE_BUILD_TYPE)
+set(CMAKE_CXX_FLAGS "-Wall")
+
+IF(NOT NO_DEP_CHECK)
+ SET(NO_DEP_CHECK FALSE CACHE BOOL
+ "Disable dependencies check for building distribution only."
+ FORCE)
+ENDIF(NOT NO_DEP_CHECK)
+
+IF(NO_DEP_CHECK)
+ MESSAGE("-- Dependencies checking disabled. Only distribution can be built.")
+ELSE(NO_DEP_CHECK)
+
+# Libtool-like version number
+# CURRENT:REVISION:AGE => file.so.(C-A).A.R
+# current: The most recent interface number that this library implements.
+# revision: The implementation number of the current interface.
+# age: The difference between the newest and oldest interfaces that this
+# library implements.
+# In other words, the library implements all the interface numbers in the
+# range from number current - age to current.
+set(BPPRAA_VERSION_CURRENT "2")
+set(BPPRAA_VERSION_REVISION "1")
+set(BPPRAA_VERSION_AGE "1")
+
+# Effective version number computation
+math(EXPR BPPRAA_VERSION_MAJOR "${BPPRAA_VERSION_CURRENT} -
+${BPPRAA_VERSION_AGE}")
+set(BPPRAA_VERSION_MINOR ${BPPRAA_VERSION_AGE})
+set(BPPRAA_VERSION_PATCH ${BPPRAA_VERSION_REVISION})
+set(BPPRAA_VERSION "${BPPRAA_VERSION_MAJOR}.${BPPRAA_VERSION_MINOR}.${BPPRAA_VERSION_PATCH}")
+
+# Set the CMAKE_PREFIX_PATH for the find_library fonction when using non
+# standard install location
+IF(CMAKE_INSTALL_PREFIX)
+ SET(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}" ${CMAKE_PREFIX_PATH})
+ENDIF(CMAKE_INSTALL_PREFIX)
+
+#here is a useful function:
+MACRO(IMPROVED_FIND_LIBRARY OUTPUT_LIBS lib_name include_to_find)
+ #start:
+ FIND_PATH(${lib_name}_INCLUDE_DIR ${include_to_find})
+ SET(${lib_name}_NAMES ${lib_name} ${lib_name}lib ${lib_name}dll)
+ FIND_LIBRARY(${lib_name}_LIBRARY NAMES ${${lib_name}_NAMES} PATH_SUFFIXES lib${LIB_SUFFIX})
+
+ IF(${lib_name}_LIBRARY)
+ MESSAGE("-- Library ${lib_name} found here:")
+ MESSAGE(" includes : ${${lib_name}_INCLUDE_DIR}")
+ MESSAGE(" libraries: ${${lib_name}_LIBRARY}")
+ ELSE(${lib_name}_LIBRARY)
+ MESSAGE(FATAL_ERROR "${lib_name} required but not found.")
+ ENDIF(${lib_name}_LIBRARY)
+
+ #add the dependency:
+ INCLUDE_DIRECTORIES(${${lib_name}_INCLUDE_DIR})
+ SET(${OUTPUT_LIBS} ${${OUTPUT_LIBS}} ${${lib_name}_LIBRARY})
+ENDMACRO(IMPROVED_FIND_LIBRARY)
+
+#Find the Bio++ libraries:
+IMPROVED_FIND_LIBRARY(LIBS bpp-seq Bpp/Seq/Alphabet/Alphabet.h)
+#Not explicitely needed:
+#IMPROVED_FIND_LIBRARY(LIBS bpp-core Bpp/Clonable.h)
+
+# Find the zlib installation
+find_package(ZLIB REQUIRED)
+include_directories(${ZLIB_INCLUDE_DIR})
+set(LIBS ${LIBS} ${ZLIB_LIBRARIES})
+
+# Subdirectories
+add_subdirectory(src)
+
+# Doxygen
+find_package(Doxygen)
+if (DOXYGEN_FOUND)
+ ADD_CUSTOM_TARGET (apidoc cp Doxyfile ${CMAKE_BINARY_DIR}/Doxyfile-build
+ COMMAND echo "OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}" >> ${CMAKE_BINARY_DIR}/Doxyfile-build
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile-build
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ ADD_CUSTOM_TARGET (apidoc-stable cp Doxyfile ${CMAKE_BINARY_DIR}/Doxyfile-stable
+ COMMAND echo "OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}" >> ${CMAKE_BINARY_DIR}/Doxyfile-stable
+ COMMAND echo "HTML_HEADER=header.html" >> ${CMAKE_BINARY_DIR}/Doxyfile-stable
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile-stable
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+endif (DOXYGEN_FOUND)
+
+ENDIF(NO_DEP_CHECK)
+
+# Packager
+set(CPACK_PACKAGE_NAME "libbpp-raa")
+set(CPACK_PACKAGE_VENDOR "Bio++ Development Team")
+set(CPACK_PACKAGE_VERSION "2.1.0")
+set(CPACK_PACKAGE_VERSION_MAJOR "2")
+set(CPACK_PACKAGE_VERSION_MINOR "1")
+set(CPACK_PACKAGE_VERSION_PATCH "0")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Bio++ Remote Acnuc Access library")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
+set(CPACK_RESOURCE_FILE_AUTHORS "${CMAKE_SOURCE_DIR}/AUTHORS.txt")
+set(CPACK_RESOURCE_FILE_INSTALL "${CMAKE_SOURCE_DIR}/INSTALL.txt")
+set(CPACK_SOURCE_GENERATOR "TGZ")
+SET(CPACK_SOURCE_IGNORE_FILES
+ "CMakeFiles"
+ "Makefile"
+ "_CPack_Packages"
+ "CMakeCache.txt"
+ ".*\\\\.cmake"
+ ".*\\\\.git"
+ ".*\\\\.gz"
+ ".*\\\\.deb"
+ ".*\\\\.rpm"
+ ".*\\\\.dmg"
+ ".*\\\\.sh"
+ ".*\\\\..*\\\\.swp"
+ "src/\\\\..*"
+ "src/libbpp*"
+ "debian/tmp"
+ "debian/libbpp.*/"
+ "debian/libbpp.*\\\\.so.*"
+ "debian/libbpp.*\\\\.a"
+ "debian/libbpp.*\\\\.substvars"
+ "debian/libbpp.*\\\\.debhelper"
+ "debian/debhelper\\\\.log"
+ "html"
+ "Raa.tag"
+ "Testing"
+ "build-stamp"
+ "install_manifest.txt"
+ "DartConfiguration.tcl"
+ ${CPACK_SOURCE_IGNORE_FILES}
+)
+IF (MACOS)
+ SET(CPACK_GENERATOR "Bundle")
+ENDIF()
+
+SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+SET(CPACK_DEBSOURCE_PACKAGE_FILE_NAME "lib${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.orig")
+INCLUDE(CPack)
+
+#This adds the 'dist' target
+ADD_CUSTOM_TARGET(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
+# 'clean' is not (yet) a first class target. However, we need to clean the directories before building the sources:
+IF("${CMAKE_GENERATOR}" MATCHES "Make")
+ ADD_CUSTOM_TARGET(make_clean
+ COMMAND ${CMAKE_MAKE_PROGRAM} clean
+ WORKING_DIRECTORY ${CMAKE_CURRENT_DIR}
+ )
+ ADD_DEPENDENCIES(dist make_clean)
+ENDIF()
+
+IF(NOT NO_DEP_CHECK)
+IF (UNIX)
+#This creates deb packages:
+ADD_CUSTOM_TARGET(origdist COMMAND cp ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz ../${CPACK_DEBSOURCE_PACKAGE_FILE_NAME}.tar.gz)
+ADD_DEPENDENCIES(origdist dist)
+ADD_CUSTOM_TARGET(deb dpkg-buildpackage -uc -us -i${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz)
+ADD_DEPENDENCIES(deb origdist)
+
+#This creates rpm packages:
+ADD_CUSTOM_TARGET(rpm rpmbuild -ta ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz)
+ADD_DEPENDENCIES(rpm dist)
+
+ENDIF()
+
+ENDIF(NOT NO_DEP_CHECK)
diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644
index 0000000..a36324d
--- /dev/null
+++ b/COPYING.txt
@@ -0,0 +1,505 @@
+
+ CeCILL FREE SOFTWARE LICENSE AGREEMENT
+
+
+ Notice
+
+This Agreement is a Free Software license agreement that is the result
+of discussions between its authors in order to ensure compliance with
+the two main principles guiding its drafting:
+
+ * firstly, compliance with the principles governing the distribution
+ of Free Software: access to source code, broad rights granted to
+ users,
+ * secondly, the election of a governing law, French law, with which
+ it is conformant, both as regards the law of torts and
+ intellectual property law, and the protection that it offers to
+ both authors and holders of the economic rights over software.
+
+The authors of the CeCILL (for Ce[a] C[nrs] I[nria] L[logiciel] L[ibre])
+license are:
+
+Commissariat � l'Energie Atomique - CEA, a public scientific, technical
+and industrial establishment, having its principal place of business at
+31-33 rue de la F�d�ration, 75752 Paris cedex 15, France.
+
+Centre National de la Recherche Scientifique - CNRS, a public scientific
+and technological establishment, having its principal place of business
+at 3 rue Michel-Ange 75794 Paris cedex 16, France.
+
+Institut National de Recherche en Informatique et en Automatique -
+INRIA, a public scientific and technological establishment, having its
+principal place of business at Domaine de Voluceau, Rocquencourt, BP
+105, 78153 Le Chesnay cedex, France.
+
+
+ Preamble
+
+The purpose of this Free Software license agreement is to grant users
+the right to modify and redistribute the software governed by this
+license within the framework of an open source distribution model.
+
+The exercising of these rights is conditional upon certain obligations
+for users so as to preserve this status for all subsequent redistributions.
+
+In consideration of access to the source code and the rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty and the software's author, the holder of the
+economic rights, and the successive licensors only have limited liability.
+
+In this respect, the risks associated with loading, using, modifying
+and/or developing or reproducing the software by the user are brought to
+the user's attention, given its Free Software status, which may make it
+complicated to use, with the result that its use is reserved for
+developers and experienced professionals having in-depth computer
+knowledge. Users are therefore encouraged to load and test the
+Software's suitability as regards their requirements in conditions
+enabling the security of their systems and/or data to be ensured and,
+more generally, to use and operate it in the same conditions of
+security. This Agreement may be freely reproduced and published,
+provided it is not altered, and that no provisions are either added or
+removed herefrom.
+
+This Agreement may apply to any or all software for which the holder of
+the economic rights decides to submit the use thereof to its provisions.
+
+
+ Article 1 - DEFINITIONS
+
+For the purpose of this Agreement, when the following expressions
+commence with a capital letter, they shall have the following meaning:
+
+Agreement: means this license agreement, and its possible subsequent
+versions and annexes.
+
+Software: means the software in its Object Code and/or Source Code form
+and, where applicable, its documentation, "as is" when the Licensee
+accepts the Agreement.
+
+Initial Software: means the Software in its Source Code and possibly its
+Object Code form and, where applicable, its documentation, "as is" when
+it is first distributed under the terms and conditions of the Agreement.
+
+Modified Software: means the Software modified by at least one
+Contribution.
+
+Source Code: means all the Software's instructions and program lines to
+which access is required so as to modify the Software.
+
+Object Code: means the binary files originating from the compilation of
+the Source Code.
+
+Holder: means the holder(s) of the economic rights over the Initial
+Software.
+
+Licensee: means the Software user(s) having accepted the Agreement.
+
+Contributor: means a Licensee having made at least one Contribution.
+
+Licensor: means the Holder, or any other individual or legal entity, who
+distributes the Software under the Agreement.
+
+Contribution: means any or all modifications, corrections, translations,
+adaptations and/or new functions integrated into the Software by any or
+all Contributors, as well as any or all Internal Modules.
+
+Module: means a set of sources files including their documentation that
+enables supplementary functions or services in addition to those offered
+by the Software.
+
+External Module: means any or all Modules, not derived from the
+Software, so that this Module and the Software run in separate address
+spaces, with one calling the other when they are run.
+
+Internal Module: means any or all Module, connected to the Software so
+that they both execute in the same address space.
+
+GNU GPL: means the GNU General Public License version 2 or any
+subsequent version, as published by the Free Software Foundation Inc.
+
+Parties: mean both the Licensee and the Licensor.
+
+These expressions may be used both in singular and plural form.
+
+
+ Article 2 - PURPOSE
+
+The purpose of the Agreement is the grant by the Licensor to the
+Licensee of a non-exclusive, transferable and worldwide license for the
+Software as set forth in Article 5 hereinafter for the whole term of the
+protection granted by the rights over said Software.
+
+
+ Article 3 - ACCEPTANCE
+
+3.1 The Licensee shall be deemed as having accepted the terms and
+conditions of this Agreement upon the occurrence of the first of the
+following events:
+
+ * (i) loading the Software by any or all means, notably, by
+ downloading from a remote server, or by loading from a physical
+ medium;
+ * (ii) the first time the Licensee exercises any of the rights
+ granted hereunder.
+
+3.2 One copy of the Agreement, containing a notice relating to the
+characteristics of the Software, to the limited warranty, and to the
+fact that its use is restricted to experienced users has been provided
+to the Licensee prior to its acceptance as set forth in Article 3.1
+hereinabove, and the Licensee hereby acknowledges that it has read and
+understood it.
+
+
+ Article 4 - EFFECTIVE DATE AND TERM
+
+
+ 4.1 EFFECTIVE DATE
+
+The Agreement shall become effective on the date when it is accepted by
+the Licensee as set forth in Article 3.1.
+
+
+ 4.2 TERM
+
+The Agreement shall remain in force for the entire legal term of
+protection of the economic rights over the Software.
+
+
+ Article 5 - SCOPE OF RIGHTS GRANTED
+
+The Licensor hereby grants to the Licensee, who accepts, the following
+rights over the Software for any or all use, and for the term of the
+Agreement, on the basis of the terms and conditions set forth hereinafter.
+
+Besides, if the Licensor owns or comes to own one or more patents
+protecting all or part of the functions of the Software or of its
+components, the Licensor undertakes not to enforce the rights granted by
+these patents against successive Licensees using, exploiting or
+modifying the Software. If these patents are transferred, the Licensor
+undertakes to have the transferees subscribe to the obligations set
+forth in this paragraph.
+
+
+ 5.1 RIGHT OF USE
+
+The Licensee is authorized to use the Software, without any limitation
+as to its fields of application, with it being hereinafter specified
+that this comprises:
+
+ 1. permanent or temporary reproduction of all or part of the Software
+ by any or all means and in any or all form.
+
+ 2. loading, displaying, running, or storing the Software on any or
+ all medium.
+
+ 3. entitlement to observe, study or test its operation so as to
+ determine the ideas and principles behind any or all constituent
+ elements of said Software. This shall apply when the Licensee
+ carries out any or all loading, displaying, running, transmission
+ or storage operation as regards the Software, that it is entitled
+ to carry out hereunder.
+
+
+ 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
+
+The right to make Contributions includes the right to translate, adapt,
+arrange, or make any or all modifications to the Software, and the right
+to reproduce the resulting Software.
+
+The Licensee is authorized to make any or all Contributions to the
+Software provided that it includes an explicit notice that it is the
+author of said Contribution and indicates the date of the creation thereof.
+
+
+ 5.3 RIGHT OF DISTRIBUTION
+
+In particular, the right of distribution includes the right to publish,
+transmit and communicate the Software to the general public on any or
+all medium, and by any or all means, and the right to market, either in
+consideration of a fee, or free of charge, one or more copies of the
+Software by any means.
+
+The Licensee is further authorized to distribute copies of the modified
+or unmodified Software to third parties according to the terms and
+conditions set forth hereinafter.
+
+
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
+
+The Licensee is authorized to distribute true copies of the Software in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Software is
+redistributed, the Licensee allows future Licensees unhindered access to
+the full Source Code of the Software by indicating how to access it, it
+being understood that the additional cost of acquiring the Source Code
+shall not exceed the cost of transferring the data.
+
+
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
+
+When the Licensee makes a Contribution to the Software, the terms and
+conditions for the distribution of the Modified Software become subject
+to all the provisions of this Agreement.
+
+The Licensee is authorized to distribute the Modified Software, in
+Source Code or Object Code form, provided that said distribution
+complies with all the provisions of the Agreement and is accompanied by:
+
+ 1. a copy of the Agreement,
+
+ 2. a notice relating to the limitation of both the Licensor's
+ warranty and liability as set forth in Articles 8 and 9,
+
+and that, in the event that only the Object Code of the Modified
+Software is redistributed, the Licensee allows future Licensees
+unhindered access to the full Source Code of the Modified Software by
+indicating how to access it, it being understood that the additional
+cost of acquiring the Source Code shall not exceed the cost of
+transferring the data.
+
+
+ 5.3.3 DISTRIBUTION OF EXTERNAL MODULES
+
+When the Licensee has developed an External Module, the terms and
+conditions of this Agreement do not apply to said External Module, that
+may be distributed under a separate license agreement.
+
+
+ 5.3.4 COMPATIBILITY WITH THE GNU GPL
+
+The Licensee can include a code that is subject to the provisions of one
+of the versions of the GNU GPL in the Modified or unmodified Software,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+The Licensee can include the Modified or unmodified Software in a code
+that is subject to the provisions of one of the versions of the GNU GPL,
+and distribute that entire code under the terms of the same version of
+the GNU GPL.
+
+
+ Article 6 - INTELLECTUAL PROPERTY
+
+
+ 6.1 OVER THE INITIAL SOFTWARE
+
+The Holder owns the economic rights over the Initial Software. Any or
+all use of the Initial Software is subject to compliance with the terms
+and conditions under which the Holder has elected to distribute its work
+and no one shall be entitled to modify the terms and conditions for the
+distribution of said Initial Software.
+
+The Holder undertakes that the Initial Software will remain ruled at
+least by the current license, for the duration set forth in article 4.2.
+
+
+ 6.2 OVER THE CONTRIBUTIONS
+
+A Licensee who develops a Contribution is the owner of the intellectual
+property rights over this Contribution as defined by applicable law.
+
+
+ 6.3 OVER THE EXTERNAL MODULES
+
+A Licensee who develops an External Module is the owner of the
+intellectual property rights over this External Module as defined by
+applicable law and is free to choose the type of agreement that shall
+govern its distribution.
+
+
+ 6.4 JOINT PROVISIONS
+
+The Licensee expressly undertakes:
+
+ 1. not to remove, or modify, in any manner, the intellectual property
+ notices attached to the Software;
+
+ 2. to reproduce said notices, in an identical manner, in the copies
+ of the Software modified or not.
+
+The Licensee undertakes not to directly or indirectly infringe the
+intellectual property rights of the Holder and/or Contributors on the
+Software and to take, where applicable, vis-�-vis its staff, any and all
+measures required to ensure respect of said intellectual property rights
+of the Holder and/or Contributors.
+
+
+ Article 7 - RELATED SERVICES
+
+7.1 Under no circumstances shall the Agreement oblige the Licensor to
+provide technical assistance or maintenance services for the Software.
+
+However, the Licensor is entitled to offer this type of services. The
+terms and conditions of such technical assistance, and/or such
+maintenance, shall be set forth in a separate instrument. Only the
+Licensor offering said maintenance and/or technical assistance services
+shall incur liability therefor.
+
+7.2 Similarly, any Licensor is entitled to offer to its licensees, under
+its sole responsibility, a warranty, that shall only be binding upon
+itself, for the redistribution of the Software and/or the Modified
+Software, under terms and conditions that it is free to decide. Said
+warranty, and the financial terms and conditions of its application,
+shall be subject of a separate instrument executed between the Licensor
+and the Licensee.
+
+
+ Article 8 - LIABILITY
+
+8.1 Subject to the provisions of Article 8.2, the Licensee shall be
+entitled to claim compensation for any direct loss it may have suffered
+from the Software as a result of a fault on the part of the relevant
+Licensor, subject to providing evidence thereof.
+
+8.2 The Licensor's liability is limited to the commitments made under
+this Agreement and shall not be incurred as a result of in particular:
+(i) loss due the Licensee's total or partial failure to fulfill its
+obligations, (ii) direct or consequential loss that is suffered by the
+Licensee due to the use or performance of the Software, and (iii) more
+generally, any consequential loss. In particular the Parties expressly
+agree that any or all pecuniary or business loss (i.e. loss of data,
+loss of profits, operating loss, loss of customers or orders,
+opportunity cost, any disturbance to business activities) or any or all
+legal proceedings instituted against the Licensee by a third party,
+shall constitute consequential loss and shall not provide entitlement to
+any or all compensation from the Licensor.
+
+
+ Article 9 - WARRANTY
+
+9.1 The Licensee acknowledges that the scientific and technical
+state-of-the-art when the Software was distributed did not enable all
+possible uses to be tested and verified, nor for the presence of
+possible defects to be detected. In this respect, the Licensee's
+attention has been drawn to the risks associated with loading, using,
+modifying and/or developing and reproducing the Software which are
+reserved for experienced users.
+
+The Licensee shall be responsible for verifying, by any or all means,
+the product's suitability for its requirements, its good working order,
+and for ensuring that it shall not cause damage to either persons or
+properties.
+
+9.2 The Licensor hereby represents, in good faith, that it is entitled
+to grant all the rights over the Software (including in particular the
+rights set forth in Article 5).
+
+9.3 The Licensee acknowledges that the Software is supplied "as is" by
+the Licensor without any other express or tacit warranty, other than
+that provided for in Article 9.2 and, in particular, without any warranty
+as to its commercial value, its secured, safe, innovative or relevant
+nature.
+
+Specifically, the Licensor does not warrant that the Software is free
+from any error, that it will operate without interruption, that it will
+be compatible with the Licensee's own equipment and software
+configuration, nor that it will meet the Licensee's requirements.
+
+9.4 The Licensor does not either expressly or tacitly warrant that the
+Software does not infringe any third party intellectual property right
+relating to a patent, software or any other property right. Therefore,
+the Licensor disclaims any and all liability towards the Licensee
+arising out of any or all proceedings for infringement that may be
+instituted in respect of the use, modification and redistribution of the
+Software. Nevertheless, should such proceedings be instituted against
+the Licensee, the Licensor shall provide it with technical and legal
+assistance for its defense. Such technical and legal assistance shall be
+decided on a case-by-case basis between the relevant Licensor and the
+Licensee pursuant to a memorandum of understanding. The Licensor
+disclaims any and all liability as regards the Licensee's use of the
+name of the Software. No warranty is given as regards the existence of
+prior rights over the name of the Software or as regards the existence
+of a trademark.
+
+
+ Article 10 - TERMINATION
+
+10.1 In the event of a breach by the Licensee of its obligations
+hereunder, the Licensor may automatically terminate this Agreement
+thirty (30) days after notice has been sent to the Licensee and has
+remained ineffective.
+
+10.2 A Licensee whose Agreement is terminated shall no longer be
+authorized to use, modify or distribute the Software. However, any
+licenses that it may have granted prior to termination of the Agreement
+shall remain valid subject to their having been granted in compliance
+with the terms and conditions hereof.
+
+
+ Article 11 - MISCELLANEOUS
+
+
+ 11.1 EXCUSABLE EVENTS
+
+Neither Party shall be liable for any or all delay, or failure to
+perform the Agreement, that may be attributable to an event of force
+majeure, an act of God or an outside cause, such as defective
+functioning or interruptions of the electricity or telecommunications
+networks, network paralysis following a virus attack, intervention by
+government authorities, natural disasters, water damage, earthquakes,
+fire, explosions, strikes and labor unrest, war, etc.
+
+11.2 Any Failure by either Party, on one or more occasions, to invoke
+one or more of the provisions hereof, shall under no circumstances be
+interpreted as being a waiver by the interested Party of its right to
+invoke said provision(s) subsequently.
+
+11.3 The Agreement cancels and replaces any or all previous agreements,
+whether written or oral, between the Parties and having the same
+purpose, and constitutes the entirety of the agreement between said
+Parties concerning said purpose. No supplement or modification to the
+terms and conditions hereof shall be effective as between the Parties
+unless it is made in writing and signed by their duly authorized
+representatives.
+
+11.4 In the event that one or more of the provisions hereof were to
+conflict with a current or future applicable act or legislative text,
+said act or legislative text shall prevail, and the Parties shall make
+the necessary amendments so as to comply with said act or legislative
+text. All other provisions shall remain effective. Similarly, invalidity
+of a provision of the Agreement, for any reason whatsoever, shall not
+cause the Agreement as a whole to be invalid.
+
+
+ 11.5 LANGUAGE
+
+The Agreement is drafted in both French and English and both versions
+are deemed authentic.
+
+
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
+
+12.1 Any person is authorized to duplicate and distribute copies of this
+Agreement.
+
+12.2 So as to ensure coherence, the wording of this Agreement is
+protected and may only be modified by the authors of the License, who
+reserve the right to periodically publish updates or new versions of the
+Agreement, each with a separate number. These subsequent versions may
+address new issues encountered by Free Software.
+
+12.3 Any Software distributed under a given version of the Agreement may
+only be subsequently distributed under the same version of the Agreement
+or a subsequent version, subject to the provisions of Article 5.3.4.
+
+
+ Article 13 - GOVERNING LAW AND JURISDICTION
+
+13.1 The Agreement is governed by French law. The Parties agree to
+endeavor to seek an amicable solution to any disagreements or disputes
+that may arise during the performance of the Agreement.
+
+13.2 Failing an amicable solution within two (2) months as from their
+occurrence, and unless emergency proceedings are necessary, the
+disagreements or disputes shall be referred to the Paris Courts having
+jurisdiction, by the more diligent Party.
+
+
+Version 2.0 dated 2005-05-21.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..ce44d20
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,11 @@
+07/03/13 -*- version 2.1.0 -*-
+
+09/02/12 -*- version 2.0.3 -*-
+
+09/06/11 -*- version 2.0.2 -*-
+
+28/02/11 -*- version 2.0.1 -*-
+
+07/02/11 -*- version 2.0.0 -*-
+
+??/??/?? -*- version 1.0.0 -*-
diff --git a/Doxyfile b/Doxyfile
new file mode 100644
index 0000000..28449ad
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,1890 @@
+# Doxyfile 1.8.3.1-20130209
+
+# 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 sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME = bpp-raa
+
+# 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 = 2.1.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO =
+
+# 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, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, 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 = YES
+
+# 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. Note that you specify absolute paths here, but also
+# relative paths, which will be relative from the directory where doxygen is
+# started.
+
+STRIP_FROM_PATH = ./src/
+
+# 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 = ./src/
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# 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 = 2
+
+# 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 =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST =
+
+# 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, CSharp, 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 MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented classes,
+# or namespaces to their corresponding documentation. Such a link can be
+# prevented in individual cases by by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+
+AUTOLINK_SUPPORT = YES
+
+# 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 makes 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 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 the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields or simple typedef fields will be shown
+# inline in the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO (the default), structs, classes, and unions are shown on a separate
+# page (for HTML and Man pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# 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 penalty.
+# 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 roughly 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
+
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_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_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE = 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 = NO
+
+# 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 namespaces 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# 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
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = 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 section-label ... \endif
+# and \cond section-label ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro 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 macros 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
+
+# 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. To 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 =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path. Do not use
+# file names with spaces, bibtex cannot handle them.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# 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 = NO
+
+# 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
+
+# The WARN_NO_PARAMDOC option can be enabled 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 = src
+
+# 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS = Raa*.h \
+ *.cpp \
+ RAA.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 be
+# 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.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system 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 or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+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
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page (index.html).
+# This can be useful if you have a project on for instance GitHub and want reuse
+# the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# 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 = YES
+
+# 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, C++ and Fortran 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 = 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 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 = YES
+
+# 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. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+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 left blank doxygen will
+# generate a default style sheet. Note that it is recommended to use
+# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
+# tag will in the future become obsolete.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
+# user-defined cascading style sheet that is included after the standard
+# style sheets created by doxygen. Using this option one can overrule
+# certain style aspects. This is preferred over using HTML_STYLESHEET
+# since it does not replace the standard style sheet and is therefor more
+# robust against future updates. Doxygen will copy the style sheet file to
+# the output directory.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = 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.
+
+HTML_DYNAMIC_SECTIONS = YES
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
+# entries shown in the various tree structured indices initially; the user
+# can expand and collapse entries dynamically later on. Doxygen will expand
+# the tree to such a level that at most the specified number of entries are
+# visible (unless a fully collapsed tree already exceeds this amount).
+# So setting the number of entries 1 will produce a full collapsed tree by
+# default. 0 is a special value representing an infinite number of entries
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# 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 = YES
+
+# 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 = "Bio++ RAA"
+
+# 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 = bpp.RAA
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
+# identify the documentation publisher. This should be a reverse domain-name
+# style string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# 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 = org.doxygen.Project
+
+# 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 =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX = NO
+
+# 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.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE = 4
+
+# 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
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# 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
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
+# SVG. The default value is HTML-CSS, which is slower, but has the best
+# compatibility.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax. However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS =
+
+# When the SEARCHENGINE tag is enabled 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), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript.
+# There are two flavours of web server based search depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools.
+# See the manual for details.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain
+# the search results. Doxygen ships with an example indexer (doxyindexer) and
+# search engine (doxysearch.cgi) which are based on the open source search engine
+# library Xapian. See the manual for configuration details.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will returned the search results when EXTERNAL_SEARCH is enabled.
+# Doxygen ships with an example search engine (doxysearch) which is based on
+# the open source search engine library Xapian. See the manual for configuration
+# details.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
+# of to a relative location where the documentation can be found.
+# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# 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.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+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, 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 = amsmath
+
+# 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 =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
+# or other source files which should be copied to the LaTeX output directory.
+# Note that the files will be copied as-is; there are no commands or markers
+# available.
+
+LATEX_EXTRA_FILES =
+
+# 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 = NO
+
+# 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
+
+# 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
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# 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 style sheet 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 = NO
+
+# 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 related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
+# that can be used to generate PDF.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK 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 docbook will be used as the default path.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# 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
+# pointed to by INCLUDE_PATH will be searched when 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 that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these 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. For each
+# tag file the location of the external documentation should be added. 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. 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 = ../bpp-core/BppCore.tag=../../bpp-core/html \
+ ../bpp-seq/BppSeq.tag=../../bpp-seq/html
+
+# 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 = BppRaa.tag
+
+# 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
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
+# in the related pages index. If set to NO, only the current project's
+# pages will be listed.
+
+EXTERNAL_PAGES = 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 also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# 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 = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You 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 Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
+
+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
+# 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 the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# managable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# 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 generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG = NO
+
+# 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 MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_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/INSTALL.txt b/INSTALL.txt
new file mode 100644
index 0000000..c8859da
--- /dev/null
+++ b/INSTALL.txt
@@ -0,0 +1,12 @@
+This software needs cmake >= 2.6 to build.
+
+After installing cmake, run it with the following command:
+cmake -DCMAKE_INSTALL_PREFIX=[where to install, for instance /usr/local or $HOME/.local] .
+
+If available, you can also use ccmake instead of cmake for a more user-friendly interface.
+
+Then compile and install the software with
+make install
+
+You may also consider installing and using the software checkinstall for easier system administration.
+
diff --git a/bpp-raa.spec b/bpp-raa.spec
new file mode 100644
index 0000000..c735f72
--- /dev/null
+++ b/bpp-raa.spec
@@ -0,0 +1,197 @@
+%define _basename bpp-raa
+%define _version 2.1.0
+%define _release 1
+%define _prefix /usr
+
+URL: http://biopp.univ-montp2.fr/
+
+Name: %{_basename}
+Version: %{_version}
+Release: %{_release}
+License: CECILL-2.0
+Vendor: The Bio++ Project
+Source: http://biopp.univ-montp2.fr/repos/sources/%{_basename}-%{_version}.tar.gz
+Summary: Bio++ Remote Acnuc Access library
+Group: Development/Libraries/C and C++
+Requires: bpp-core = %{_version}
+Requires: bpp-seq = %{_version}
+
+BuildRoot: %{_builddir}/%{_basename}-root
+BuildRequires: cmake >= 2.6.0
+BuildRequires: gcc-c++ >= 4.0.0
+BuildRequires: libbpp-core2 = %{_version}
+BuildRequires: libbpp-core-devel = %{_version}
+BuildRequires: libbpp-seq9 = %{_version}
+BuildRequires: libbpp-seq-devel = %{_version}
+BuildRequires: zlib >= 1.2.3
+BuildRequires: zlib-devel >= 1.2.3
+
+AutoReq: yes
+AutoProv: yes
+
+%description
+This library contains utilitary and classes to query public database (GenBank, EMBL, SwissProt, etc) using acnuc.
+It is part of the Bio++ project.
+
+%package -n libbpp-raa1
+Summary: Bio++ Remote Acnuc Access library
+Group: Development/Libraries/C and C++
+
+%description -n libbpp-raa1
+This library contains utilitary and classes to query public database (GenBank, EMBL, SwissProt, etc) using acnuc.
+It is part of the Bio++ project.
+
+%package -n libbpp-raa-devel
+Summary: Libraries, includes to develop applications with %{_basename}
+Group: Development/Libraries/C and C++
+Requires: libbpp-raa1 = %{_version}
+Requires: libbpp-seq9 = %{_version}
+Requires: libbpp-seq-devel = %{_version}
+Requires: libbpp-core2 = %{_version}
+Requires: libbpp-core-devel = %{_version}
+Requires: zlib >= 1.2.3
+Requires: zlib-devel >= 1.2.3
+
+%description -n libbpp-raa-devel
+The libbpp-raa-devel package contains the header files and static libraries for
+building applications which use %{_basename}.
+
+%prep
+%setup -q
+
+%build
+CFLAGS="$RPM_OPT_FLAGS"
+CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_TESTING=OFF"
+if [ %{_lib} == 'lib64' ] ; then
+ CMAKE_FLAGS="$CMAKE_FLAGS -DLIB_SUFFIX=64"
+fi
+cmake $CMAKE_FLAGS .
+make
+
+%install
+make DESTDIR=$RPM_BUILD_ROOT install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -n libbpp-raa1 -p /sbin/ldconfig
+
+%post -n libbpp-raa-devel
+createGeneric() {
+ echo "-- Creating generic include file: $1.all"
+ #Make sure we run into subdirectories first:
+ dirs=()
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ dirs+=( "$file" )
+ fi
+ done
+ for dir in ${dirs[@]}
+ do
+ createGeneric $dir
+ done
+ #Now list all files, including newly created .all files:
+ if [ -f $1.all ]
+ then
+ rm $1.all
+ fi
+ dir=`basename $1`
+ for file in "$1"/*
+ do
+ if [ -f "$file" ] && ( [ "${file##*.}" == "h" ] || [ "${file##*.}" == "all" ] )
+ then
+ file=`basename $file`
+ echo "#include \"$dir/$file\"" >> $1.all
+ fi
+ done;
+}
+# Actualize .all files
+createGeneric %{_prefix}/include/Bpp
+exit 0
+
+%preun -n libbpp-raa-devel
+removeGeneric() {
+ if [ -f $1.all ]
+ then
+ echo "-- Remove generic include file: $1.all"
+ rm $1.all
+ fi
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ removeGeneric $file
+ fi
+ done
+}
+# Actualize .all files
+removeGeneric %{_prefix}/include/Bpp
+exit 0
+
+%postun -n libbpp-raa1 -p /sbin/ldconfig
+
+%postun -n libbpp-raa-devel
+createGeneric() {
+ echo "-- Creating generic include file: $1.all"
+ #Make sure we run into subdirectories first:
+ dirs=()
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ dirs+=( "$file" )
+ fi
+ done
+ for dir in ${dirs[@]}
+ do
+ createGeneric $dir
+ done
+ #Now list all files, including newly created .all files:
+ if [ -f $1.all ]
+ then
+ rm $1.all
+ fi
+ dir=`basename $1`
+ for file in "$1"/*
+ do
+ if [ -f "$file" ] && ( [ "${file##*.}" == "h" ] || [ "${file##*.}" == "all" ] )
+ then
+ file=`basename $file`
+ echo "#include \"$dir/$file\"" >> $1.all
+ fi
+ done;
+}
+# Actualize .all files
+createGeneric %{_prefix}/include/Bpp
+exit 0
+
+%files -n libbpp-raa1
+%defattr(-,root,root)
+%doc AUTHORS.txt COPYING.txt INSTALL.txt ChangeLog
+%{_prefix}/%{_lib}/lib*.so.*
+
+%files -n libbpp-raa-devel
+%defattr(-,root,root)
+%doc AUTHORS.txt COPYING.txt INSTALL.txt ChangeLog
+%{_prefix}/%{_lib}/lib*.so
+%{_prefix}/%{_lib}/lib*.a
+%{_prefix}/include/*
+
+%changelog
+* Thu Mar 07 2013 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.1.0-1
+- Compatibility update.
+* Thu Feb 09 2012 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.0.3-1
+- Compatibility update.
+* Thu Jun 09 2011 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.0.2-1
+- Compatibility update.
+* Mon Feb 28 2011 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.0.1-1
+* Mon Feb 07 2011 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.0.0-1
+* Thu Mar 25 2010 Julien Dutheil <julien.dutheil at univ-montp2.fr> 1.0.0-1
+* Wed Jun 24 2009 Julien Dutheil <jdutheil at birc.au.dk> 0.1.0-1
+- First draft of the spec file
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..31bcfe7
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,36 @@
+libbpp-raa (2.1.0-1) unstable; urgency=low
+
+ * Recompilation because of dependencies.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Thu, 07 Mar 2013 11:46:00 +0100
+
+libbpp-raa (2.0.3-1) unstable; urgency=low
+
+ * Recompilation because of dependencies.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Thu, 09 Feb 2012 16:45:00 +0100
+
+libbpp-raa (2.0.2-1) unstable; urgency=low
+
+ * RFP: Bio++ -- The Bio++ bioinformatics libraries. (Closes: #616373).
+ * Packages are now non-native.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Thu, 09 Jun 2011 11:00:00 +0100
+
+libbpp-raa (2.0.1) unstable; urgency=low
+
+ * Fixed copyright and rules issue in package.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Mon, 28 Feb 2011 09:00:00 +0100
+
+libbpp-raa (2.0.0) unstable; urgency=low
+
+ * Compatibility with Bio++ 2.0.0.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Mon, 07 Feb 2011 09:00:00 +0100
+
+libbpp-raa (1.0.0) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr> Thu, 25 Mar 2010 15:30:13 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..09319a1
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,29 @@
+Source: libbpp-raa
+Section: libs
+Priority: optional
+Maintainer: Loic Dachary <loic at dachary.org>
+Uploaders: Julien Dutheil <julien.dutheil at univ-montp2.fr>
+Build-Depends: debhelper (>= 5), cmake (>= 2.6),
+ zlib1g-dev (>= 1.2.3), libbpp-seq-dev (>= 2.1.0), zlib1g (>= 1.2.3)
+Standards-Version: 3.9.1
+
+Package: libbpp-raa-dev
+Section: libdevel
+Architecture: any
+Depends: libbpp-raa1 (= ${binary:Version}), ${misc:Depends},
+ zlib1g-dev (>= 1.2.3), libbpp-seq-dev (>= 2.1.0)
+Description: Bio++ Remote Acnuc Access library development files.
+ This library contains utilitary and classes to query public databases
+ (GenBank, EMBL, SwissProt, etc) using acnuc.
+ It is part of the Bio++ project.
+
+Package: libbpp-raa1
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ zlib1g (>= 1.2.3), libbpp-seq9 (>= 2.1.0)
+Description: Bio++ Remote Acnuc Access library.
+ This library contains utilitary and classes to query public databases
+ (GenBank, EMBL, SwissProt, etc) using acnuc.
+ It is part of the Bio++ project.
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..5cdafed
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,66 @@
+This package was debianized by Julien Dutheil <julien.dutheil at univ-montp2.fr> on
+Thu, 07 Mar 2013 11:46:00 +0100.
+
+It was downloaded from <http://kimura.univ-montp2.fr/Repositories/sources>
+
+Upstream Author:
+
+ Julien Dutheil <julien.dutheil at univ-montp2.fr>
+
+Copyright:
+
+ Copyright (C) 2013 Bio++ Development Team
+
+License:
+
+ This package 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 2 of the License, or
+ (at your option) any later version.
+
+ This package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2013, Julien Dutheil <julien.dutheil at univ-montp2.fr> and
+is licensed under the GPL, see above.
+
+The provided software is distributed under the CeCILL license:
+
+ This software is governed by the CeCILL license under French law and
+ abiding by the rules of distribution of free software. You can use,
+ modify and/ or redistribute the software under the terms of the CeCILL
+ license as circulated by CEA, CNRS and INRIA at the following URL
+ "http://www.cecill.info".
+
+ As a counterpart to the access to the source code and rights to copy,
+ modify and redistribute granted by the license, users are provided only
+ with a limited warranty and the software's author, the holder of the
+ economic rights, and the successive licensors have only limited
+ liability.
+
+ In this respect, the user's attention is drawn to the risks associated
+ with loading, using, modifying and/or developing or reproducing the
+ software by the user in light of its specific status of free software,
+ that may mean that it is complicated to manipulate, and that also
+ therefore means that it is reserved for developers and experienced
+ professionals having in-depth computer knowledge. Users are therefore
+ encouraged to load and test the software's suitability as regards their
+ requirements in conditions enabling the security of their systems and/or
+ data to be ensured and, more generally, to use and operate it in the
+ same conditions as regards security.
+
+ The fact that you are presently reading this means that you have had
+ knowledge of the CeCILL license and that you accept its terms.
+
+The complete text of the license may be found here:
+http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
+
diff --git a/debian/libbpp-raa-dev.install b/debian/libbpp-raa-dev.install
new file mode 100644
index 0000000..7d74f2b
--- /dev/null
+++ b/debian/libbpp-raa-dev.install
@@ -0,0 +1,3 @@
+debian/tmp/usr/include/*
+debian/tmp/usr/lib/lib*.a
+debian/tmp/usr/lib/lib*.so
diff --git a/debian/libbpp-raa1.install b/debian/libbpp-raa1.install
new file mode 100644
index 0000000..c45ebcf
--- /dev/null
+++ b/debian/libbpp-raa1.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/lib*.so.*
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..cf9e925
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,43 @@
+#! /bin/bash
+
+# Abort if any command returns an error value
+set -e
+
+createGeneric() {
+ echo "-- Creating generic include file: $1.all"
+ #Make sure we run into subdirectories first:
+ dirs=()
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ dirs+=( "$file" )
+ fi
+ done
+ for dir in ${dirs[@]}
+ do
+ createGeneric $dir
+ done
+ #Now list all files, including newly created .all files:
+ if [ -f $1.all ]
+ then
+ rm $1.all
+ fi
+ dir=`basename $1`
+ for file in "$1"/*
+ do
+ if [ -f "$file" ] && ( [ "${file##*.}" == "h" ] || [ "${file##*.}" == "all" ] )
+ then
+ file=`basename $file`
+ echo "#include \"$dir/$file\"" >> $1.all
+ fi
+ done;
+}
+
+if [ "$1" = "configure" ]; then
+ # Actualize .all files
+ createGeneric /usr/include/Bpp
+fi
+
+exit 0
diff --git a/debian/postrm b/debian/postrm
new file mode 100755
index 0000000..3931669
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,45 @@
+#! /bin/bash
+
+# Abort if any command returns an error value
+set -e
+
+createGeneric() {
+ echo "-- Creating generic include file: $1.all"
+ #Make sure we run into subdirectories first:
+ dirs=()
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ dirs+=( "$file" )
+ fi
+ done
+ for dir in ${dirs[@]}
+ do
+ createGeneric $dir
+ done
+ #Now list all files, including newly created .all files:
+ if [ -f $1.all ]
+ then
+ rm $1.all
+ fi
+ dir=`basename $1`
+ for file in "$1"/*
+ do
+ if [ -f "$file" ] && ( [ "${file##*.}" == "h" ] || [ "${file##*.}" == "all" ] )
+ then
+ file=`basename $file`
+ echo "#include \"$dir/$file\"" >> $1.all
+ fi
+ done;
+}
+
+if [ "$1" = "remove" ]; then
+ # Automatically added by dh_makeshlibs
+ ldconfig
+ # Actualize .all files
+ createGeneric /usr/include/Bpp
+fi
+
+exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100755
index 0000000..5aefd24
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+# Abort if any command returns an error value
+set -e
+
+removeGeneric() {
+ if [ -f $1.all ]
+ then
+ echo "-- Remove generic include file: $1.all"
+ rm $1.all
+ fi
+ for file in "$1"/*
+ do
+ if [ -d "$file" ]
+ then
+ # Recursion:
+ removeGeneric $file
+ fi
+ done
+}
+
+if [ "$1" = "remove" ]; then
+ # Actualize .all files
+ removeGeneric /usr/include/Bpp
+fi
+
+exit 0
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..c943581
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,119 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# 24/01/10 Modification for use with CMake by Julien Dutheil.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+# shared library versions
+version=`ls src/lib*.so.* | \
+ awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
+major=`ls src/lib*.so.* | \
+ awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
+
+configure:
+ cmake -DCMAKE_INSTALL_PREFIX=/usr .
+
+config.status: configure
+ dh_testdir
+
+build: build-stamp
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) clean;
+ [ ! -f Makefile ] || rm Makefile;
+ [ ! -f src/Makefile ] || rm src/Makefile;
+ rm -f config.sub config.guess
+ rm -f build-stamp
+ rm -f CMakeCache.txt
+ rm -f *.cmake
+ rm -f src/*.cmake
+ #rm -f test/*.cmake
+ rm -rf CMakeFiles
+ rm -rf src/CMakeFiles
+ #rm -rf test/CMakeFiles
+ rm -rf _CPack_Packages
+ #rm -rf Testing
+ #rm -f DartConfiguration.tcl
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp
+ $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+ dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_python
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/src/Bpp/Raa.all b/src/Bpp/Raa.all
new file mode 100644
index 0000000..08ab51b
--- /dev/null
+++ b/src/Bpp/Raa.all
@@ -0,0 +1,6 @@
+#include "Raa/RaaSpeciesTree.h"
+#include "Raa/parser.h"
+#include "Raa/RaaList.h"
+#include "Raa/RaaSeqAttributes.h"
+#include "Raa/RAA_acnuc.h"
+#include "Raa/RAA.h"
diff --git a/src/Bpp/Raa/RAA.cpp b/src/Bpp/Raa/RAA.cpp
new file mode 100644
index 0000000..4127f9c
--- /dev/null
+++ b/src/Bpp/Raa/RAA.cpp
@@ -0,0 +1,555 @@
+/*
+ * RAA.cpp
+ *
+ *
+ */
+
+
+#include "RAA.h"
+
+extern "C" {
+ int get_ncbi_gc_number(int gc);
+ int sock_printf(raa_db_access *raa_current_db, const char *fmt, ...);
+ }
+
+using namespace std;
+using namespace bpp;
+
+RAA::RAA(const string &dbname, int port, const string &server) throw (int)
+{
+ kw_pattern = NULL;
+ current_address.div = -1;
+ int error = raa_acnucopen_alt((char *)server.c_str(), port, (char *)dbname.c_str(), (char *)"Bio++", &raa_data);
+ if(error) {
+ throw error;
+ }
+}
+
+
+RAA::RAA(int port, const string &server) throw(int)
+{
+ kw_pattern = NULL;
+ int error = raa_open_socket((char *)server.c_str(), port, (char *)"Bio++", &raa_data);
+ if(error) {
+ throw error;
+ }
+}
+
+
+RAA::~RAA()
+{
+ if(raa_data != NULL) raa_acnucclose(raa_data);
+ if(kw_pattern) delete kw_pattern;
+}
+
+
+Sequence *RAA::getSeq_both(const string &name_or_accno, int rank, int maxlength)
+{
+ int length;
+ char *name, *description;
+ if(rank == 0) name = raa_getattributes(raa_data, name_or_accno.c_str(), &rank, &length, NULL, NULL, NULL,
+ &description, NULL, NULL);
+ else name = raa_seqrank_attributes(raa_data, rank, &length, NULL, NULL, NULL,
+ &description, NULL, NULL);
+ if(length > maxlength) return NULL;
+ string sname = name;
+ vector<string> comment(1, string(description) );
+ string *cseq = new string(length + 1, ' ');
+ if(cseq == NULL) return NULL;
+ raa_gfrag(this->raa_data, rank, 1, length, (char *)cseq->data());
+ cseq->resize(length);
+ const Alphabet *alphab;
+ if(raa_data->swissprot || raa_data->nbrf) alphab = &AlphabetTools::PROTEIN_ALPHABET;
+ else alphab = &AlphabetTools::DNA_ALPHABET;
+ Sequence *seq = new BasicSequence(sname, *cseq, comment, alphab);
+ delete cseq;
+ return seq;
+}
+
+
+Sequence *RAA::getSeq(const string &name_or_accno, int maxlength)
+{
+ return getSeq_both(name_or_accno, 0, maxlength);
+}
+
+
+Sequence *RAA::getSeq(int seqrank, int maxlength)
+{
+ if(seqrank < 2 || seqrank > raa_data->nseq) return NULL;
+ return getSeq_both(string(""), seqrank, maxlength);
+}
+
+
+int RAA::getSeqFrag(int seqrank, int first, int length, string &sequence)
+{
+ if(seqrank < 2 || seqrank > raa_data->nseq) return 0;
+ sequence = "";
+ char *p = (char *)malloc(length + 1);
+ if(p == NULL) return 0;
+ int l = raa_gfrag(this->raa_data, seqrank, first, length, p);
+ if(l > 0) {
+ majuscules(p);
+ sequence = p;
+ }
+ free(p);
+ return l;
+}
+
+
+int RAA::getSeqFrag(const string &name_or_accno, int first, int length, string &sequence)
+{
+ int seqrank;
+ raa_getattributes(raa_data, name_or_accno.c_str(), &seqrank, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ if(seqrank == 0) return 0;
+ return getSeqFrag(seqrank, first, length, sequence);
+}
+
+
+RaaSeqAttributes *RAA::getAttributes(const string &name_or_accno)
+{
+ char *description, *species, *access;
+ int acnuc_gc;
+ RaaSeqAttributes *myattr = new RaaSeqAttributes();
+ char *name = raa_getattributes(this->raa_data, name_or_accno.c_str(), &myattr->rank, &myattr->length,
+ &myattr->frame, &acnuc_gc, &access, &description, &species, NULL);
+ myattr->raa = this;
+ myattr->name = name;
+ myattr->description = description;
+ myattr->accno = access;
+ myattr->species = species;
+ myattr->ncbi_gc = get_ncbi_gc_number(acnuc_gc);
+ return myattr;
+}
+
+
+RaaSeqAttributes *RAA::getAttributes(int seqrank)
+{
+ char *description, *species, *access;
+ int acnuc_gc;
+ if(seqrank < 2 || seqrank > raa_data->nseq) return NULL;
+ RaaSeqAttributes *myattr = new RaaSeqAttributes();
+ char *name = raa_seqrank_attributes(this->raa_data, seqrank, &myattr->length,
+ &myattr->frame, &acnuc_gc, &access, &description, &species, NULL);
+ if(name == NULL) return NULL;
+ myattr->rank =seqrank;
+ myattr->raa = this;
+ myattr->name= name;
+ myattr->description = description;
+ myattr->accno = access;
+ myattr->species = species;
+ myattr->ncbi_gc = get_ncbi_gc_number(acnuc_gc);
+ return myattr;
+}
+
+
+int RAA::knownDatabases(vector<string> &name, vector<string> &description)
+{
+ char **cname, **cdescription;
+
+ int count = raa_knowndbs(raa_data, &cname, &cdescription);
+ name.resize(count);
+ description.resize(count);
+ for(int i = 0; i < count; i++) {
+ name[i] = cname[i]; free(cname[i]);
+ description[i] = cdescription[i]; free(cdescription[i]);
+ }
+ if(count > 0) { free(cname); free(cdescription); }
+ return count;
+}
+
+
+int RAA::openDatabase(const string &dbname, char *(*getpasswordf)(void *), void *p)
+{
+ current_address.div = -1;
+ return raa_opendb_pw(raa_data, (char *)dbname.c_str(), p, getpasswordf);
+}
+
+
+void RAA::closeDatabase()
+{
+ sock_fputs(this->raa_data, (char *)"acnucclose\n");
+ read_sock(this->raa_data);
+}
+
+
+string RAA::getFirstAnnotLine(int seqrank)
+{
+ if(seqrank < 2 || seqrank > raa_data->nseq) return "";
+ raa_seq_to_annots(raa_data, seqrank, ¤t_address.faddr, ¤t_address.div);
+ char *p = raa_read_annots(raa_data, current_address.faddr, current_address.div);
+ string retval(p);
+ return retval;
+}
+
+
+string RAA::getNextAnnotLine()
+{
+ if(current_address.div == -1) return NULL;
+ char *p = raa_next_annots(raa_data, ¤t_address.faddr);
+ if(p != NULL) {
+ string retval(p);
+ return retval;
+ }
+ else return NULL;
+}
+
+
+RaaAddress RAA::getCurrentAnnotAddress()
+{
+ return current_address;
+}
+
+
+string RAA::getAnnotLineAtAddress(RaaAddress address)
+{
+ current_address = address;
+ char *p = raa_read_annots(raa_data, current_address.faddr, current_address.div);
+ string retval(p);
+ return retval;
+}
+
+
+Sequence *RAA::translateCDS(int seqrank) throw(BadCharException)
+{
+ char *descript;
+ if(seqrank < 2 || seqrank > raa_data->nseq) return NULL;
+ char *prot = raa_translate_cds(raa_data, seqrank);
+ if(prot == NULL) return NULL;
+ int l = strlen(prot) - 1;
+ if(l >= 0 && prot[l] == '*') prot[l] = 0;
+ char *name = raa_seqrank_attributes(raa_data, seqrank, NULL, NULL, NULL, NULL, &descript, NULL, NULL);
+ string *sname = new string(name);
+ string *pstring = new string(prot);
+ if(sname == NULL || pstring == NULL) return NULL;
+ Sequence *Sprot;
+ try {
+ Sprot = new BasicSequence(*sname, *pstring, &AlphabetTools::PROTEIN_ALPHABET );
+ }
+ catch (BadCharException e){
+ delete sname;
+ delete pstring;
+ throw e;
+ }
+ delete sname;
+ delete pstring;
+ vector<string> comment(1, string(descript) );
+ Sprot->setComments(comment);
+ return Sprot;
+}
+
+
+Sequence *RAA::translateCDS(const string &name) throw(BadCharException)
+{
+ int rank;
+ rank = raa_isenum(raa_data, (char *)name.c_str());
+ if(rank == 0) return NULL;
+ Sequence *Sprot;
+ try {
+ Sprot = translateCDS(rank);
+ }
+ catch (BadCharException e){
+ throw e;
+ }
+ return Sprot;
+}
+
+
+char RAA::translateInitCodon(int seqrank)
+{
+ if(seqrank < 2 || seqrank > raa_data->nseq) return 0;
+ return raa_translate_init_codon(raa_data, seqrank);
+}
+
+
+RaaList *RAA::processQuery(const string &query, const string &listname) throw(string)
+{
+ char *message;
+ int type, rank;
+ int err = raa_proc_query(raa_data, (char *)query.c_str(), &message, (char *)listname.c_str(), &rank, NULL,
+ NULL, &type);
+ if(err) {
+ string errmess = message;
+ free(message);
+ throw errmess;
+ }
+ RaaList *mylist = new RaaList();
+ mylist->myraa = this;
+ mylist->rank = rank;
+ mylist->name = listname;
+ if(type=='S') mylist->type = &RaaList::LIST_SEQUENCES;
+ else if(type=='K') mylist->type = &RaaList::LIST_KEYWORDS;
+ else mylist->type = &RaaList::LIST_SPECIES;
+ return mylist;
+}
+
+
+RaaList *RAA::createEmptyList(const string &listname, const string &kind) throw(int)
+{
+ int err, lrank;
+ char type, *p, *q;
+ sock_printf(raa_data, (char *)"getemptylist&name=%s\n", listname.c_str() );
+ char *reponse = read_sock(raa_data);
+ p = strchr(reponse, '=');
+ if(p) q = strchr(p+1, '=');
+ sscanf(p+1, "%d", &err);
+
+ if(err != 0) {
+ throw err;
+ }
+ sscanf(q+1, "%d", &lrank);
+ if(kind == RaaList::LIST_SEQUENCES) type='S';
+ else if(kind == RaaList::LIST_KEYWORDS) type='K';
+ else type='E';
+ sock_printf(raa_data, "setliststate&lrank=%d&type=%c\n", lrank, type);
+ read_sock(raa_data);
+ RaaList *mylist = new RaaList();
+ mylist->myraa = this;
+ mylist->rank = lrank;
+ mylist->name = listname;
+ mylist->type = &kind;
+ return mylist;
+}
+
+
+void RAA::deleteList(RaaList *list)
+{
+ raa_releaselist(raa_data, list->rank);
+ delete list;
+}
+
+
+int RAA::keywordPattern(const string &pattern)
+{
+ current_kw_match = 2;
+ if(kw_pattern) delete kw_pattern;
+ kw_pattern = new string(pattern);
+ return raa_data->WIDTH_KW;
+}
+
+
+int RAA::nextMatchingKeyword(string &matching)
+{
+ char *keyword;
+ if(current_kw_match==2) current_kw_match = raa_nextmatchkey(raa_data, 2, (char*)kw_pattern->c_str(), &keyword);
+ else current_kw_match = raa_nextmatchkey(raa_data, current_kw_match, NULL, &keyword);
+ if(current_kw_match) matching = keyword;
+ return current_kw_match;
+}
+
+
+static int treeloadprogress(int percent, void *data)
+{
+ bool *first =(bool *)data;
+ if(*first) {
+ cout << "Starting species tree download\n";
+ *first = false;
+ }
+ cout << '.'; fflush(stdout);
+ return false;
+}
+
+
+RaaSpeciesTree *RAA::loadSpeciesTree(bool showprogress)
+{
+ bool init_load_mess = true;
+ int err = raa_loadtaxonomy(raa_data, (char *)"ROOT", showprogress ? treeloadprogress : NULL, &init_load_mess, NULL, NULL);
+ if(err) return NULL;
+ if( showprogress && (!init_load_mess) ) cout << "\nSpecies tree download completed\n";
+ RaaSpeciesTree *tree = new RaaSpeciesTree();
+ tree->raa_data = raa_data;
+ tree->sp_tree = raa_data->sp_tree;
+ tree->tid_to_rank = raa_data->tid_to_rank;
+ tree->max_tid = raa_data->max_tid;
+ tree->max_sp = raa_read_first_rec(raa_data, raa_spec);
+ return tree;
+}
+
+
+void RAA::freeSpeciesTree(RaaSpeciesTree *tree)
+{
+ int i;
+ struct raa_pair *p, *q;
+ for(i = 2; i <= tree->max_sp; i++) {
+ if(raa_data->sp_tree[i] == NULL) continue;
+ free(raa_data->sp_tree[i]->name);
+ if(raa_data->sp_tree[i]->libel != NULL) free(raa_data->sp_tree[i]->libel);
+ if(raa_data->sp_tree[i]->libel_upcase != NULL) free(raa_data->sp_tree[i]->libel_upcase);
+ p = raa_data->sp_tree[i]->list_desc;
+ while(p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+ free(raa_data->sp_tree[i]);
+ }
+ if(raa_data->tid_to_rank != NULL) free(raa_data->tid_to_rank);
+ if(raa_data->sp_tree != NULL) free(raa_data->sp_tree);
+ raa_data->sp_tree = NULL;
+ raa_data->tid_to_rank = NULL;
+ delete tree;
+}
+
+
+vector<string> RAA::listDirectFeatureKeys()
+{
+ int total, num;
+ vector<string> ftkeys;
+
+ total = raa_read_first_rec(raa_data, raa_smj);
+ for(num = 2; num <= total; num++) {
+ char *name = raa_readsmj(raa_data, num, NULL, NULL);
+ if(strncmp(name, "04", 2) != 0) continue;
+ if(strcmp(name, "04ID") == 0) continue;
+ if(strcmp(name, "04LOCUS") == 0) continue;
+ ftkeys.push_back(name + 2);
+ }
+ return ftkeys;
+}
+
+
+static void godownkey(raa_db_access *raa_data, unsigned int p3, vector<string>& ftkeys)
+{
+ unsigned next;
+ int value;
+ char *name;
+
+ next = raa_readshrt(raa_data, p3, &value);
+ name = raa_readkey(raa_data, abs(value), NULL, NULL, NULL, NULL);
+ ftkeys.push_back(name);
+
+ while(next != 0) {
+ next = raa_readshrt(raa_data, next, &value);
+ godownkey(raa_data, value, ftkeys);
+ }
+}
+
+
+vector<string> RAA::listAllFeatureKeys()
+{
+ vector<string> ftkeys;
+ int rank, pdesc;
+
+ rank = raa_iknum(raa_data, (char *)"misc_feature", raa_key);
+ raa_readkey(raa_data, rank, NULL, NULL, &pdesc, NULL);
+ godownkey(raa_data, pdesc, ftkeys);
+ return ftkeys;
+}
+
+
+RaaList *RAA::getDirectFeature(const string &seqname, const string &featurekey, const string &listname, const string &matching)
+{
+ char query[80];
+ RaaList *list1;
+ int matchinglist, err;
+ sprintf(query, "n=%s and t=%s", seqname.c_str(), featurekey.c_str());
+ string squery = query;
+ try {
+ list1 = processQuery(squery, listname);
+ }
+ catch (string s) {
+ return NULL;
+ }
+ if(matching.empty() || list1->getCount() == 0) return list1;
+ sock_printf(raa_data, "prep_getannots&nl=1\n%s|%s\n", raa_data->embl ? "FT" : "FEATURES", featurekey.c_str());
+ char *p = read_sock(raa_data);
+ if(strncmp(p, "code=0", 6) != 0) return NULL;
+ err = raa_modifylist(raa_data, list1->getRank(), (char *)"scan", (char *)matching.c_str(), &matchinglist, NULL, NULL);
+ if(err != 0 || raa_bcount(raa_data, matchinglist) == 0) {
+ delete list1;
+ if(err == 0) raa_releaselist(raa_data, matchinglist);
+ return NULL;
+ }
+ raa_setlistname(raa_data, matchinglist, (char *)listname.c_str());
+ RaaList *list2 = new RaaList();
+ list2->rank = matchinglist;
+ list2->myraa = this;
+ list2->name = listname;
+ list2->type = &RaaList::LIST_SEQUENCES;
+ delete list1;
+ return list2;
+}
+
+
+struct extract_data {
+ char line[100];
+};
+
+
+void *RAA::prepareGetAnyFeature(int seqrank, const string &featurekey) throw(string)
+{
+ char *p, *line;
+ int l;
+
+ if(seqrank < 2 || seqrank > raa_data->nseq) throw "Incorrect first argument";
+ struct extract_data *data = new struct extract_data;
+ sock_printf(raa_data, "extractseqs&seqnum=%d&format=fasta&operation=feature&feature=%s&zlib=F\n", seqrank, featurekey.c_str());
+ line = read_sock(raa_data);
+ if(strcmp(line, "code=0") == 0) {
+ p = read_sock(raa_data);
+ strcpy(data->line, p);
+ return (void *)data;
+ }
+ delete data;
+ p = strstr(line, "message=");
+ if(p == NULL) return NULL;
+ p += 8;
+ if(*p == '"') p++;
+ l = strlen(p);
+ if(p[l-1] == '"') p[l-1] = 0;
+ string message = p;
+ throw message;
+}
+
+
+Sequence *RAA::getNextFeature(void *v)
+{
+ char *p;
+ Sequence *seq;
+ string name;
+ struct extract_data *data = (struct extract_data *)v;
+
+ while( data->line[0] == 27 /* esc */ ) {
+ p = read_sock(raa_data);
+ strcpy(data->line, p);
+ }
+ if(strcmp(data->line, "extractseqs END.") == 0) {
+ delete data;
+ return NULL;
+ }
+ p = strchr(data->line, ' ');
+ if(p != NULL)*p = 0;
+ name = data->line + 1;
+ p = read_sock(raa_data);
+ string seqdata = "";
+ while( p != NULL && strcmp(p, "extractseqs END.") != 0 && *p != 27 /* esc */ && *p != '>') {
+ seqdata += p;
+ p = read_sock(raa_data);
+ }
+ if(p == NULL) strcpy(data->line, "extractseqs END.");
+ else {
+ if( *p == 27 /* esc */ ) p = read_sock(raa_data);
+ strcpy(data->line, p);
+ }
+ seq = new BasicSequence(name, seqdata, &AlphabetTools::DNA_ALPHABET);
+ return seq;
+}
+
+
+void RAA::interruptGetAnyFeature(void *v)
+{
+ struct extract_data *data = (struct extract_data *)v;
+ char *p;
+
+ if(data == NULL) return;
+ sock_fputs(raa_data, (char *)"\033" /* esc */);
+ sock_flush(raa_data);
+ p = data->line;
+ while( strcmp(p, "extractseqs END.") != 0) {
+ p = read_sock(raa_data);
+ }
+ delete data;
+ /* just to consume ESC that may have arrived after extractseqs END. */
+ sock_fputs(raa_data, (char *)"null_command\n");
+ read_sock(raa_data);
+}
+
diff --git a/src/Bpp/Raa/RAA.h b/src/Bpp/Raa/RAA.h
new file mode 100644
index 0000000..f260e7a
--- /dev/null
+++ b/src/Bpp/Raa/RAA.h
@@ -0,0 +1,489 @@
+/*
+ * RAA.H
+ */
+#ifndef _RAA_H_
+#define _RAA_H_
+
+/**
+ * @mainpage
+ *
+ * Network access to sequence databases (embl, genbank, swissprot, and others).
+ *
+ * These classes provides network access to several nucleotide and protein sequence databases
+ * structured for multi-criteria retrieval under the ACNUC system as described in
+ * <a href=http://dx.doi.org/10.1016/j.biochi.2007.07.003>Remote access to ACNUC nucleotide
+ * and protein sequence databases at PBIL</a>.
+ *
+ * The list of available databases is <a href=http://pbil.univ-lyon1.fr/databases/acnuc/banques_raa.php>here</a>.
+ * EMBL and GenBank are daily updated; SwissProt (it is in fact UniProt and includes SwissProt and trEMBL)
+ * is updated at each partial release; EMBLwgs is updated at each full release (that is, quarterly).
+ *
+ *
+ */
+
+
+extern "C" {
+#include "RAA_acnuc.h"
+ }
+
+#include <string>
+#include <Bpp/Seq/Sequence.h>
+#include <Bpp/Seq/Alphabet.all>
+
+#include "RaaList.h"
+#include "RaaSpeciesTree.h"
+#include "RaaSeqAttributes.h"
+
+namespace bpp
+{
+
+
+/**
+ * @brief Identifies an annotation line in a database.
+ */
+class RaaAddress {
+ friend class RAA;
+ int div;
+ raa_long faddr;
+public:
+ /**
+ * @brief Gives the rank of the database file containing this annotation line.
+ */
+ int getDiv() {return div; };
+ /**
+ * @brief Gives, as a 64-bit int value, the offset of this annotation line within its database file.
+ */
+ raa_long getAddr() {return faddr; };
+};
+
+
+/**
+ * @brief Network access to sequence databases (embl, genbank, swissprot, and others).
+ *
+ * The list of available databases is <a href=http://pbil.univ-lyon1.fr/databases/acnuc/banques_raa.php>here</a>.
+ *
+ * Access can be done to single sequences from their name or accession number
+ * or to lists of sequences matching a query combining several retrieval criteria.
+ * Any fragment of any sequence defined by coordinates or by feature table entries
+ * can be retrieved. Access to sequence annotations is possible. Concurrent access
+ * to several databases is possible.
+ *
+ * Access is possible to database entries and also to subsequences, i.e., one or more fragments
+ * of one or more parent sequences defined by a feature table entry.
+ * Subsequences are named by adding an extension (e.g., .PE1) to the name of their parent sequence.
+ */
+class RAA {
+ friend class RaaList;
+public:
+
+ /**
+ * @name Opening/closing database connections.
+ *
+ * @{
+ */
+
+ /**
+ * @brief Direct constructor: opens a network connection to a database.
+ *
+ * @param dbname The database name (e.g., "embl", "genbank", "swissprot").
+ * @param port The IP port number of the server (the default value is a safe choice; make sure that no
+ * firewall blocks outbound connections on this port).
+ * @param server The IP name of the server (the default value is a safe choice).
+ * @throw int An error code as follows:\n
+ * 1: incorrect server name\n
+ * 2: cannot create connection with server\n
+ * 3: unknown database name\n
+ * 4: database is currently not available for remote connection\n
+ * 7: not enough memory
+ */
+ RAA(const std::string &dbname, int port = 5558, const std::string &server = "pbil.univ-lyon1.fr") throw(int);
+
+ /**
+ * @brief Direct constructor: opens a network connection to a database server, without specifying a database.
+ *
+ * Typical usage is to ask with knownDatabases() for the list of served databases, and then to open the chosen
+ * database with openDatabase().
+ *
+ * @param port The IP port number of the server (the default value is a safe choice; make sure that no
+ * firewall blocks outbound connections on this port).
+ * @param server The IP name of the server (the default value is a safe choice).
+ * @throw int An error code as follows:\n
+ * 1: incorrect server name\n
+ * 2: cannot create connection with server\n
+ * 7: not enough memory
+ */
+ RAA(int port=5558, const std::string &server = "pbil.univ-lyon1.fr") throw(int);
+
+ /**
+ * @brief Destructor: closes both the database access, if any, and the network connection.
+ */
+ ~RAA();
+
+ /**
+ * @brief Opens a database from its name.
+ *
+ * @param dbname The database name (e.g., "embl", "genbank", "swissprot").
+ * @param getpasswordf NULL, or, for a password-protected database, pointer to a password-providing function
+ * that returns the password as a writable static char string.
+ * @param p NULL, or pointer to data transmitted as argument of getpasswordf.
+ * @return 0 if OK, or an error code as follows:\n
+ * 3: unknown database name\n
+ * 4: database is currently not available for remote connection\n
+ * 5: a database was previously opened on this RAA object and not closed\n
+ * 6: incorrect password for password-protected database\n
+ * 7: not enough memory
+ */
+ int openDatabase(const std::string &dbname, char *(*getpasswordf)(void *) = NULL, void *p = NULL);
+
+ /**
+ * @brief Closes a database connection.
+
+ * Allows to later open another database with openDatabase() using the same RAA object.
+ */
+ void closeDatabase();
+
+ /**
+ * @brief Computes the list of names and descriptions of databases served by the server.
+
+ * Typically used after creation of an RAA object without database and before openDatabase() call.
+ *
+ * @return The number of served databases.
+ * @param name Vector of database names. Any of these names can be used
+ * in openDatabase() calls.
+ * @param description Vector of database descriptions. A description can
+ * begin with "(offline)" to mean the database is currently not available.
+ */
+ int knownDatabases(std::vector<std::string> &name, std::vector<std::string> &description);
+
+ /** @} */
+
+ /**
+ * @name Access to sequence data and annotations.
+ *
+ * @{
+ */
+
+ /**
+ * @brief Returns several attributes of a sequence from its name or accession number.
+ *
+ * @param name_or_accno A sequence name or accession number. Case is not significant.
+ * @return Several attributes (length, species, etc..., see: RaaSeqAttributes) of a sequence.
+ */
+ RaaSeqAttributes *getAttributes(const std::string &name_or_accno);
+
+ /**
+ * @brief Returns several attributes of a sequence from its database rank.
+ *
+ * @param seqrank The database rank of a sequence.
+ * @return Several attributes (length, species, etc..., see: RaaSeqAttributes) of a sequence,
+ * or NULL if seqrank is not a valid database sequence rank.
+ */
+ RaaSeqAttributes *getAttributes(int seqrank);
+
+ /**
+ * @brief Returns a database sequence identified by name or accession number.
+ *
+ * Because nucleotide database sequences can be several megabases in length, the maxlength argument
+ * avoids unexpected huge sequence downloads.
+ *
+ * @param name_or_accno A sequence name or accession number. Case is not significant.
+ * @param maxlength The maximum sequence length beyond which the function returns NULL.
+ * @return The database sequence including a one-line comment, or NULL if name_or_accno
+ * does not match any sequence or if the sequence length exceeds maxlength.
+ */
+ Sequence *getSeq(const std::string &name_or_accno, int maxlength=100000);
+
+ /**
+ * @brief Returns a sequence identified by its database rank.
+ *
+ * Because nucleotide database sequences can be several megabases in length, the maxlength argument
+ * avoids unexpected huge sequence downloads.
+ *
+ * @param seqrank The database rank of a sequence.
+ * @param maxlength The maximum sequence length beyond which the function returns NULL.
+ * @return The database sequence including a one-line comment, or NULL if seqrank
+ * does not match any sequence or if the sequence length exceeds maxlength.
+ */
+ Sequence *getSeq(int seqrank, int maxlength=100000);
+
+ /**
+ * @brief Returns any part of a sequence identified by its database rank.
+ *
+ * @param seqrank The database rank of a sequence.
+ * @param first The first desired position within the sequence (1 is the smallest valid value).
+ * @param length The desired number of residues (can be larger than what exists in the sequence).
+ * @param sequence Filled upon return with requested sequence data.
+ * @return The length of returned sequence data, or 0 if impossible.
+ */
+ int getSeqFrag(int seqrank, int first, int length, std::string &sequence);
+
+ /**
+ * @brief Returns any part of a sequence identified by its name or accession number.
+ *
+ * @param name_or_accno The name or accession number of a sequence. Case is not significant.
+ * @param first The first desired position within the sequence (1 is the smallest valid value).
+ * @param length The desired number of residues (can be larger than what exists in the sequence).
+ * @param sequence Filled upon return with requested sequence data.
+ * @return The length of returned sequence data, or 0 if impossible.
+ */
+ int getSeqFrag(const std::string &name_or_accno, int first, int length, std::string &sequence);
+
+ /**
+ * @brief Returns the first annotation line of the sequence of given database rank.
+ *
+ * @param seqrank Database rank of a sequence.
+ * @return The first annotation line of this sequence (without terminal \\n).
+ */
+ std::string getFirstAnnotLine(int seqrank);
+
+ /**
+ * @brief Returns the next annotation line after that previously read, or NULL if the end of the
+ * database file was reached.
+ *
+ * @return The next annotation line after that previously read (without terminal \\n).
+ */
+ std::string getNextAnnotLine();
+
+ /**
+ * @brief Returns information identifying the position of the last read annotation line.
+ *
+ * @return Information identifying the position of the last read annotation line.
+ */
+ RaaAddress getCurrentAnnotAddress();
+
+ /**
+ * @brief Returns the annotation line at the given address.
+ *
+ * @param address Information identifying the position of an annotation line
+ * typically obtained from a previous call to getCurrentAnnotAddress().
+ * @return The annotation line at that position (in static memory, without terminal \\n).
+ */
+ std::string getAnnotLineAtAddress(RaaAddress address);
+
+ /**
+ * @brief Returns the full protein translation of a protein-coding nucleotide database (sub)sequence.
+ *
+ * @param seqrank The database rank of a protein-coding sequence. It can be either a subsequence
+ * corresponding to a CDS feature table entry, or a sequence if all of it belongs to the CDS.
+ * @return The complete protein translation of this CDS, using the genetic code suggested
+ * by the sequence annotations and with a one-line comment, or NULL if seqrank does not match a CDS
+ * or if not enough memory.
+ * @throw BadCharException In rare cases, the CDS may contain an internal stop codon that raises an
+ * exception when translated to protein.
+ */
+ Sequence *translateCDS(int seqrank) throw(BadCharException);//TODO add comment to Sequence
+
+ /**
+ * @brief Returns the full protein translation of a protein-coding nucleotide database (sub)sequence.
+ *
+ * @param name The name of a protein-coding sequence. It can be either a subsequence
+ * corresponding to a CDS feature table entry, or a sequence if all of it belongs to the CDS.
+ * @return The complete protein translation of this CDS, using the genetic code suggested
+ * by the sequence annotations and with a one-line comment, or NULL if name does not match a CDS or
+ * if not enough memory.
+ * @throw BadCharException In rare cases, the CDS may contain an internal stop codon that raises an
+ * exception when translated to protein.
+ */
+ Sequence *translateCDS(const std::string &name) throw(BadCharException);
+
+ /**
+ * @brief Returns the amino acid translation of the first codon of a protein-coding (sub)sequence.
+ *
+ * @param seqrank The database rank of a protein-coding sequence. It can be either a subsequence
+ * corresponding to a CDS feature table entry, or a sequence if all of it belongs to the CDS.
+ * @return The amino acid corresponding to the start codon of this sequence, using the
+ * adequate initiation-codon-specific genetic code.
+ */
+ char translateInitCodon(int seqrank);
+
+ /** @} */
+
+ /**
+ * @name Creation of lists of sequences, species or keywords.
+ *
+ * @{
+ */
+
+ /**
+ * @brief Returns the list of database elements (often sequences) matching a query.
+ *
+ * Query examples:\n k=ribosomal protein L14 \n sp=felis catus and t=cds
+ * @param query A retrieval query following the syntax described
+ * <a href=http://pbil.univ-lyon1.fr/databases/acnuc/cfonctions.html#QUERYLANGUAGE>here</a>.
+ * @param listname A name to be given to the resulting list. Case is not significant. If a list with same
+ * name already exists, it is replaced by the new list.
+ * @return The resulting list of matching database elements.
+ * @throw string If error, the string is a message describing the error cause.
+ */
+ RaaList *processQuery(const std::string &query, const std::string &listname) throw(std::string);
+
+ /**
+ * @brief Creates an empty list with specified name.
+ *
+ * @param listname A name to be given to the resulting list. Case is not significant.
+ * @param kind Nature of the resulting list. One of RaaList::LIST_SEQUENCES, RaaList::LIST_KEYWORDS,
+ * RaaList::LIST_SPECIES.
+ * @return The resulting list, unless an exception was raised.
+ * @throw int 3: a list with same name already existed; it is left unchanged.\n
+ * 4: the server cannot create more lists.
+ */
+ RaaList *createEmptyList(const std::string &listname, const std::string &kind=RaaList::LIST_SEQUENCES) throw(int);
+
+ /**
+ * @brief Deletes a list and calls its destructor.
+ *
+ * @param list An RaaList object.
+ */
+ void deleteList(RaaList *list);
+
+
+ /** @} */
+
+
+ /**
+ * @name Access to feature table-defined sequences (nucleotide databases only).
+ *
+ * @{
+ */
+
+ /**
+ * @brief Computes the list of subsequences of a given sequence corresponding to a given feature key with
+ * optional annotation string matching.
+ *
+ * This function allows to retrieve all features of the given sequence corresponding to a given feature key
+ * and whose annotation optionally contains a given string. \n
+ * Example:\n
+ * getDirectFeature("AE005174", "tRNA", "mytrnas", "anticodon: TTG")\n
+ * retrieves all tRNA features present in the feature table of sequence AE005174 that contain the string
+ * "anticodon: TTG" in their annotations, and puts that in a sequence list called "mytrnas". This function is
+ * meaningful with nucleotide sequence databases only (not with protein databases).
+ *
+ * @param seqname The name of a database sequence. Case is not significant.
+ * @param featurekey A feature key (e.g., CDS, tRNA, ncRNA) that must be directly accessible, that is, one of those
+ * returned by listDirectFeatureKeys(). Case is not significant.
+ * @param listname The name to give to the resulting sequence list.
+ * @param matching An optional string required to be present in the feature's annotations. Case is not significant.
+ * @return The list of subsequences of <i>seqname</i> that correspond to the specified feature key and, optionally, whose
+ * annotation contains the matching string, or NULL if no matching sequence exists.
+ */
+ RaaList *getDirectFeature(const std::string &seqname, const std::string &featurekey, const std::string &listname,
+ const std::string &matching = "");
+
+ /**
+ * @brief Gives all feature keys of the database that can be directly accessed.
+ *
+ * These feature keys (e.g., CDS, rRNA, tRNA) can be used with function getDirectFeature(). This function is
+ * meaningful with nucleotide sequence databases only (not with protein databases).
+ *
+ * @return A string vector listing all feature keys of the database that can be directly accessed.
+ */
+ std::vector<std::string> listDirectFeatureKeys();
+
+ /**
+ * @brief Gives all feature keys of the database.
+ *
+ * These feature keys (e.g., CDS, conflict, misc_feature) can be used with function prepareGetAnyFeature(). This function is
+ * meaningful with nucleotide sequence databases only (not with protein databases).
+ *
+ * @return A string vector listing all feature keys of the database.
+ */
+ std::vector<std::string> listAllFeatureKeys();
+
+
+ /**
+ * @brief Starts extraction of all features of a specified key present in the feature table of a database sequence.
+ *
+ * A database sequence can contain many instances of a given feature key in its feature table. Thus, feature extraction
+ * is done by first preparing the desired feature extraction, and by then successively extracting features
+ * by getNextFeature() calls until no more exist in the feature table or until a call to interruptGetAnyFeature() is done.
+ * Any successful prepareGetAnyFeature() call must be followed by getNextFeature() calls until
+ * it returns NULL or by a call to interruptGetAnyFeature(); any call to other RAA member functions in between is prohibited.
+ *
+ * @param seqrank The database rank of a sequence.
+ * @param featurekey Any feature key (direct or not) defined in
+ * <a href=http://www.ebi.ac.uk/embl/WebFeat/>EMBL/GenBank/DDBJ feature tables</a>. These are also returned by listAllFeatureKeys().
+ * @return An opaque pointer to be transmitted to functions getNextFeature() or interruptGetAnyFeature().
+ * @throw string A message indicating the cause of the error.
+ */
+ void *prepareGetAnyFeature(int seqrank, const std::string &featurekey) throw(std::string);
+
+ /**
+ * @brief Successively returns features specified in a previous prepareGetAnyFeature() call.
+ *
+ * This function must be called repetitively until it returns NULL or until function interruptGetAnyFeature() is called.
+ * Features are processed in their order of appearance in the feature table.
+ * @param opaque A pointer returned by a previous prepareGetAnyFeature() call.
+ * @return A sequence corresponding to one of the features specified in the prepareGetAnyFeature() call, or NULL
+ * if no more such feature exists.
+ */
+ Sequence *getNextFeature(void *opaque);
+
+ /**
+ * @brief Terminates a features extraction session initiated by a prepareGetAnyFeature() call before getNextFeature() call
+ * returned NULL.
+ *
+ * @param opaque A pointer returned by a previous prepareGetAnyFeature() call.
+ */
+ void interruptGetAnyFeature(void *opaque);
+
+ /** @} */
+
+
+
+ /**
+ * @name Browsing database species and keywords.
+ *
+ * @{
+ */
+
+ /**
+ * @brief Loads the database's full species tree classification.
+ *
+ * This call takes a few seconds to run on large databases because much data get downloaded from the server.
+ *
+ * @param showprogress If true, progress information gets sent to stdout.
+ * @return An object allowing work with the full species tree (see RaaSpeciesTree), or NULL if error.
+ */
+ RaaSpeciesTree *loadSpeciesTree(bool showprogress=true);
+
+ /**
+ * @brief Frees the memory occupied by the species tree classification.
+ *
+ * @param tree An object previously returned by a loadSpeciesTree() call. It is deleted upon return.
+ */
+ void freeSpeciesTree(RaaSpeciesTree *tree);
+
+
+ /**
+ * @brief Initializes pattern-matching in database keywords. Matching keywords are then returned by successive nextMatchingKeyword() calls.
+ *
+ * @param pattern A pattern-matching string using @ as wildcard (example: RNA\@polymerase\@).
+ * Case is not significant.
+ * @return The maximum length of any database keyword.
+ */
+ int keywordPattern(const std::string &pattern);
+
+ /**
+ * @brief Finds next matching keyword in database.
+ *
+ * @param matching Set to the next matching keyword upon return.
+ * @return The database rank of the next matching keyword, or 0 if no more matching keyword.
+ */
+ int nextMatchingKeyword(std::string &matching);
+
+ /** @} */
+
+
+protected:
+ raa_db_access *raa_data;
+private:
+ RaaAddress current_address;
+ int current_kw_match;
+ std::string *kw_pattern;
+ Sequence *getSeq_both(const std::string &name_or_accno, int rank, int maxlength);
+};
+
+} //end of namespace bpp.
+
+#endif // _RAA_H_
+
diff --git a/src/Bpp/Raa/RAA_acnuc.c b/src/Bpp/Raa/RAA_acnuc.c
new file mode 100644
index 0000000..8599773
--- /dev/null
+++ b/src/Bpp/Raa/RAA_acnuc.c
@@ -0,0 +1,3092 @@
+#include "RAA_acnuc.h"
+#include "parser.h"
+
+#include <limits.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <time.h>
+#if defined(unix) || defined(__APPLE__)
+#include <netdb.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <termios.h>
+#elif defined(WIN32)
+#include <Ws2tcpip.h>
+#include <Wspiapi.h>
+#endif
+
+
+#define SERVER_UPDATE_MESSAGE "acnuc stop for update\n"
+/* seules fctions utilisables hors de ce fichier pour ecrire sur socket */
+int sock_fputs(raa_db_access *f, char *l);
+int sock_flush(raa_db_access *f);
+
+/* some prototypes */
+void raa_acnucclose(raa_db_access *raa_current_db);
+void list_open_dbs_remove(raa_db_access *raa_current_db);
+
+/* needed functions */
+extern char init_codon_to_aa(char *codon, int gc);
+char codaa(char *codon, int code);
+void *prepare_sock_gz_r(FILE *sockr);
+char *z_read_sock(void *v);
+int close_sock_gz_r(void *v);
+char *unprotect_quotes(char *name);
+
+
+/* global variables */
+void (*raa_error_mess_proc)(raa_db_access *, char *) = NULL;
+
+#define MAX_RDSHRT 50 /* max short list length read in one time */
+
+
+
+static raa_db_access *init_raa_db_access(void);
+static struct chain_void *raa_list_open_dbs = NULL;
+
+#if defined(WIN32)
+
+static int socket_getc(raa_db_access *raa_current_db, SOCKET f)
+{
+int q;
+
+if(raa_current_db->sock_input_pos < raa_current_db->sock_input_end) {
+ return *(raa_current_db->sock_input_pos++);
+ }
+q = recv(f, raa_current_db->sock_input, SOCKBUFS, 0);
+if(q == 0 || q == SOCKET_ERROR) return EOF;
+raa_current_db->sock_input_end = raa_current_db->sock_input + q;
+raa_current_db->sock_input_pos = raa_current_db->sock_input;
+return *(raa_current_db->sock_input_pos++);
+}
+
+
+static char *sock_fgets(raa_db_access *raa_current_db, char *line, int len)
+{
+int c;
+char *p;
+
+p = line;
+while(len > 1) {
+ c = socket_getc(raa_current_db, (SOCKET)(raa_current_db->raa_sockfdr) );
+ if(c == EOF) {
+ if(p == line) return NULL;
+ break;
+ }
+ *(p++) = c;
+ if(c == '\n') break;
+ len--;
+ }
+*p = 0;
+return line;
+}
+
+
+static int mswin_sock_flush(raa_db_access *raa_current_db)
+{
+int w;
+char *p;
+
+p = raa_current_db->sock_output;
+while(raa_current_db->sock_output_lbuf > 0) {
+ w = send((SOCKET)raa_current_db->raa_sockfdw, p, raa_current_db->sock_output_lbuf, 0);
+ raa_current_db->sock_output_lbuf -= w;
+ p += w;
+ }
+return 0;
+}
+
+
+int sock_flush(raa_db_access *raa_current_db)
+{
+if(raa_current_db == NULL) return 0;
+return mswin_sock_flush(raa_current_db);
+}
+
+
+int sock_fputs(raa_db_access *raa_current_db, char *s)
+{
+int l, r;
+
+if(raa_current_db == NULL) return 0;
+l = strlen(s);
+while(raa_current_db->sock_output_lbuf + l > SOCKBUFS) {
+ r = SOCKBUFS - raa_current_db->sock_output_lbuf;
+ memcpy(raa_current_db->sock_output + raa_current_db->sock_output_lbuf, s, r);
+ raa_current_db->sock_output_lbuf += r;
+ l -= r;
+ s += r;
+ mswin_sock_flush(raa_current_db);
+ }
+if(l > 0) {
+ memcpy(raa_current_db->sock_output + raa_current_db->sock_output_lbuf, s, l);
+ raa_current_db->sock_output_lbuf += l;
+ }
+return 0;
+}
+
+
+
+#else
+
+int sock_fputs(raa_db_access *raa_current_db, char *s)
+{
+if(raa_current_db == NULL) return EOF;
+return fputs(s, raa_current_db->raa_sockfdw);
+}
+
+int sock_flush(raa_db_access *raa_current_db)
+{
+if(raa_current_db == NULL) return EOF;
+return fflush(raa_current_db->raa_sockfdw);
+}
+
+#endif /* WIN32 */
+
+
+int sock_printf(raa_db_access *raa_current_db, const char *fmt, ...)
+{
+va_list ap;
+int retval;
+static char buffer[1000];
+
+va_start(ap, fmt);
+vsprintf(buffer, fmt, ap);
+retval = sock_fputs(raa_current_db, buffer);
+va_end(ap);
+return retval;
+}
+
+
+
+/******************************************************************/
+/* lit une ligne au plus de la socket et transfere le resultat dans une chaine char * */
+
+static char *read_sock_tell(raa_db_access *raa_current_db, int *wascompleteline) {
+#define RSOCKBUFS 5000
+ int lnbuf, isfull;
+ char *p ;
+ static char buffer[RSOCKBUFS];
+ static int was_here = FALSE;
+
+ if(raa_current_db == NULL || was_here) return NULL;
+ sock_flush(raa_current_db); /* tres important */
+ isfull = FALSE;
+#if defined(WIN32)
+ p = sock_fgets(raa_current_db, buffer, RSOCKBUFS);
+#else
+ p = fgets(buffer, RSOCKBUFS, raa_current_db->raa_sockfdr);
+#endif
+ if(p == NULL || strcmp(p, SERVER_UPDATE_MESSAGE) == 0) {
+ if(!was_here) {
+ was_here = TRUE;
+ *buffer = 0;
+ if(raa_current_db != NULL && raa_current_db->dbname != NULL) {
+ sprintf(buffer, "%s: ", raa_current_db->dbname);
+ }
+ strcat(buffer, ( p == NULL ?
+ "Error: connection to acnuc server is down. Please try again."
+ :
+ "Error: acnuc server is down for database update. Please try again later." )
+ );
+ if(raa_error_mess_proc == NULL) {
+ fprintf(stderr, "%s: %s\n", raa_current_db->dbname, buffer);
+ /*raa_acnucclose(raa_current_db);
+ exit(ERREUR);*/
+ return NULL;
+ }
+ else (*raa_error_mess_proc)(raa_current_db, buffer);/*this function sd call raa_acnucclose*/
+ was_here = FALSE;
+ }
+ return NULL;
+ }
+
+ was_here = FALSE;
+ lnbuf = strlen(buffer);
+ p = buffer + lnbuf - 1;
+ if(*p == '\n') isfull = TRUE;
+ while(p >= buffer && (*p == '\n' || *p == '\r') ) *(p--) = 0;
+ if(wascompleteline != NULL) *wascompleteline = isfull;
+ return buffer;
+}
+
+
+char *read_sock(raa_db_access *raa_current_db) /* lit une ligne entiere, rend ligne dans memoire privee */
+{
+int wasfull, l2, l = 0;
+char *p;
+static char *reponse = NULL;
+static int lr = 0;
+
+do {
+ p = read_sock_tell(raa_current_db, &wasfull);
+ if(p == NULL) return NULL;
+ l2 = strlen(p);
+ if(l + l2 + 1 > lr) {
+ lr = l + l2 + 1;
+ reponse = (char *)realloc(reponse, lr);
+ }
+ memcpy(reponse + l, p, l2);
+ l += l2;
+ }
+while(! wasfull);
+reponse[l] = 0;
+return reponse;
+}
+
+
+char *read_sock_timeout(raa_db_access *raa_current_db, int timeout_ms)
+{
+fd_set readfds;
+struct timeval tout;
+int err;
+
+#if defined(WIN32)
+SOCKET fd;
+if(raa_current_db == NULL) return NULL;
+fd = (SOCKET)(raa_current_db->raa_sockfdr);
+#else
+int fd;
+if(raa_current_db == NULL) return NULL;
+fd = fileno(raa_current_db->raa_sockfdr);
+#endif
+FD_ZERO(&readfds);
+FD_SET(fd, &readfds);
+tout.tv_sec = timeout_ms / 1000; tout.tv_usec = 1000*(timeout_ms % 1000);
+err = select(fd + 1, &readfds, NULL, NULL, &tout);
+if(err > 0 && FD_ISSET(fd, &readfds) ) {
+ return read_sock(raa_current_db);
+ }
+return NULL;
+}
+
+enum {errservname=1, /* bad server name */
+cantopensocket, /* 2 error opening socket */
+unknowndb, /* 3 not in list of known dbs */
+unavailabledb, /* 4 db is currently unavailable */
+dbisopen, /* 5 a db is already open and was not closed */
+badpsswd, /* 6 bad password for protected db */
+nomemory, /* 7 not enough memory */
+badracnuc, /* 8 enviroment variables racnuc or acnuc undefined or inadequate */
+nosocket /* 9 no socket was opened yet */
+};
+
+int raa_acnucopen (char *clientid, raa_db_access **psock)
+/* opens the acnuc db using the environment variable racnuc, or, if undefined, acnuc,
+that should be defined to an url of the form
+raa://pbil.univ-lyon1.fr:5558/embl
+clientid: NULL or a string identifying the client
+*/
+{
+char *serveurName, *db_name, *p;
+int port, err;
+
+if( (p = getenv("racnuc")) == NULL) p = getenv("acnuc");
+if(p == NULL) return badracnuc;
+err = raa_decode_address(p, &serveurName, &port, &db_name);
+if(err) return badracnuc;
+err = raa_acnucopen_alt (serveurName, port, db_name, clientid, psock);
+return err;
+}
+
+
+int raa_acnucopen_alt (char *serveurName, int port, char *db_name, char *clientid, raa_db_access **p)
+/*
+clientid: NULL or a string identifying the client
+*/
+{
+int err;
+
+ err = raa_open_socket(serveurName, port, clientid, p);
+ if(err != 0) return err;
+ err = raa_opendb(*p, db_name);
+ if(err != 0) {
+ list_open_dbs_remove(*p);
+ }
+ return err;
+ }
+
+
+int raa_open_socket(char *serveurName, int port, char *clientid, raa_db_access **psock)
+/*
+clientid: NULL or a string identifying the client
+*/
+{
+ raa_db_access *raa_current_db;
+ struct addrinfo *ai;
+ char *reponse, portstring[10];
+ int err;
+#ifdef WIN32
+WSADATA mywsadata;
+SOCKET raa_snum;
+#else
+int raa_snum;
+#endif
+
+raa_current_db = init_raa_db_access();
+if(raa_current_db == NULL) return nomemory; /* not enough memory */
+ /* cr�ation de la socket */
+#ifdef WIN32
+ err = WSAStartup(MAKEWORD(2,2), &mywsadata); /* indispensable avant utilisation socket */
+ if (err == 0) raa_snum = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, (GROUP)0, 0);
+ if (err != 0 || raa_snum == INVALID_SOCKET) {
+ list_open_dbs_remove(raa_current_db);
+ return cantopensocket;
+ }
+#else
+ raa_snum = socket(AF_INET, SOCK_STREAM, 0);
+ if (raa_snum == -1) {
+ list_open_dbs_remove(raa_current_db);
+ return cantopensocket;
+ }
+#endif
+/* cr�ation de deux flux type FILE * */
+#if defined(WIN32)
+raa_current_db->raa_sockfdr = (FILE *)raa_snum;
+raa_current_db->raa_sockfdw = (FILE *)raa_snum;
+#else
+raa_current_db->raa_sockfdr = fdopen(raa_snum,"r");
+raa_current_db->raa_sockfdw = fdopen(raa_snum,"a");
+#endif
+
+ sprintf(portstring, "%d", port);
+ err = getaddrinfo(serveurName, portstring, NULL, &ai);
+ if (err) {
+ list_open_dbs_remove(raa_current_db);
+ return errservname;
+ }
+ err = connect(raa_snum, ai->ai_addr, ai->ai_addrlen);
+ freeaddrinfo(ai);
+
+ if (err != 0) {
+ list_open_dbs_remove(raa_current_db);
+ return cantopensocket;
+ }
+ // read first reply from the server
+ reponse = read_sock_timeout(raa_current_db, 1000*60 /* 1 min */);
+ if(reponse == NULL || strcmp(reponse, "OK acnuc socket started") != 0) {
+ list_open_dbs_remove(raa_current_db);
+ return cantopensocket;
+ }
+ if(clientid != NULL) {
+ sock_printf(raa_current_db, "clientid&id=\"%s\"\n", clientid);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) {
+ list_open_dbs_remove(raa_current_db);
+ return cantopensocket;
+ }
+ }
+*psock = raa_current_db;
+ return 0;
+}
+
+
+extern void raa_MD5String (char *in_string, char out_digest[33]);
+
+int raa_opendb_pw(raa_db_access *raa_current_db, char *db_name, void *ptr, char *(*getpasswordf)(void *) )
+/*
+getpasswordf: pointer to function that gets called if a password is needed
+ptr: pointer to data passed to the getpasswordf function
+return values :
+ 3 not in list of known dbs
+ 4 db is unavailable
+ 5 a db is already open
+ 6 failed password-based authorization
+
+*/
+{
+Reponse *rep;
+char *reponse, *code, *p, *challenge;
+int codret, totspecs, totkeys;
+
+if(raa_current_db == NULL) return nosocket;
+ sock_printf(raa_current_db, "acnucopen&db=%s\n", db_name);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return nosocket;
+ rep=initreponse();
+ parse(reponse,rep);
+ code=val(rep,"code");
+ codret=atoi(code);
+ free(code);
+ if(codret == 6) {
+ static char reply[33], tmp[300];
+ char *password = NULL;
+ clear_reponse(rep);
+ if(getpasswordf != NULL) password = getpasswordf(ptr);
+ if(password == NULL) return badpsswd;
+ challenge = reponse + 17;
+ /* reply = MD5 of challenge:db_name:MD5(password) */
+ raa_MD5String(password, reply);
+ memset(password, 0, strlen(password));
+ sprintf(tmp, "%s:%s:%s", challenge, db_name, reply);
+ raa_MD5String(tmp, reply);
+ memset(tmp, 0, strlen(tmp));
+ sock_printf(raa_current_db, "reply=%s\n", reply);
+ reponse = read_sock(raa_current_db);
+ rep=initreponse();
+ parse(reponse,rep);
+ code=val(rep,"code");
+ codret=atoi(code);
+ free(code);
+ }
+if (codret != 0) {
+ clear_reponse(rep);
+ return codret;
+ }
+
+p = val(rep,"type");
+raa_current_db->dbname = strdup(db_name);
+raa_current_db->genbank = raa_current_db->embl = raa_current_db->swissprot =
+ raa_current_db->nbrf = FALSE;
+if(p != NULL) {
+ if(strcmp(p, "GENBANK") == 0) raa_current_db->genbank = TRUE;
+ else if(strcmp(p, "EMBL") == 0) raa_current_db->embl = TRUE;
+ else if(strcmp(p, "SWISSPROT") == 0) raa_current_db->swissprot = TRUE;
+ else if(strcmp(p, "NBRF") == 0) raa_current_db->nbrf = TRUE;
+ free(p);
+ }
+p = val(rep,"totseqs");
+raa_current_db->nseq = atoi(p);
+free(p);
+p = val(rep,"totspecs");
+totspecs = atoi(p);
+free(p);
+p = val(rep,"totkeys");
+totkeys = atoi(p);
+free(p);
+raa_current_db->maxa=(totspecs > totkeys ? totspecs : totkeys);
+raa_current_db->longa=(raa_current_db->maxa-1)/(8 * sizeof(int))+1;
+
+/* default values useful if talking to old server */
+ raa_current_db->WIDTH_SMJ = 20;
+ raa_current_db->L_MNEMO = 16;
+ raa_current_db->WIDTH_BIB = 40;
+ raa_current_db->WIDTH_AUT = 20;
+ raa_current_db->WIDTH_SP = 40;
+ raa_current_db->WIDTH_KW = 40;
+ raa_current_db->lrtxt = 60;
+ raa_current_db->SUBINLNG=63;
+ raa_current_db->ACC_LENGTH=13; /* conservative value */
+p = val(rep,"L_MNEMO");
+if(p != NULL) { raa_current_db->L_MNEMO = atoi(p); free(p); }
+p = val(rep,"WIDTH_SP");
+if(p != NULL) { raa_current_db->WIDTH_SP = atoi(p); free(p); }
+p = val(rep,"WIDTH_KW");
+if(p != NULL) { raa_current_db->WIDTH_KW = atoi(p); free(p); }
+p = val(rep,"WIDTH_AUT");
+if(p != NULL) { raa_current_db->WIDTH_AUT = atoi(p); free(p); }
+p = val(rep,"WIDTH_BIB");
+if(p != NULL) { raa_current_db->WIDTH_BIB = atoi(p); free(p); }
+p = val(rep,"WIDTH_SMJ");
+if(p != NULL) { raa_current_db->WIDTH_SMJ = atoi(p); free(p); }
+p = val(rep,"ACC_LENGTH");
+if(p != NULL) { raa_current_db->ACC_LENGTH = atoi(p); free(p); }
+p = val(rep,"lrtxt");
+if(p != NULL) { raa_current_db->lrtxt = atoi(p); free(p); }
+p = val(rep,"SUBINLNG");
+if(p != NULL) {
+ raa_current_db->SUBINLNG = atoi(p);
+ free(p);
+ raa_current_db->rlng_buffer = (struct rlng *)realloc(raa_current_db->rlng_buffer,
+ (raa_current_db->SUBINLNG + 1) * sizeof(int));
+ }
+
+clear_reponse(rep);
+return 0;
+}
+
+
+int raa_opendb(raa_db_access *raa_current_db, char *db_name)
+{
+return raa_opendb_pw(raa_current_db, db_name, NULL, NULL);
+}
+
+
+int raa_decode_address(char *url, char **p_ip_name, int *socket, char **p_remote_db)
+/* decode syntax such as raa://pbil.univ-lyon1.fr:5557/embl
+return !=0 if error
+*/
+{
+char *p, *q;
+static char ip_name[200];
+static char remote_db[100];
+
+p = url;
+if(p == NULL) return 1;
+if( (q = strstr(url, "://") ) != NULL ) p = q + 3;
+q = strchr(p, ':');
+if(q == NULL) return 1;
+memcpy(ip_name, p, q - p); ip_name[q - p] = 0;
+if(p_ip_name != NULL) *p_ip_name = ip_name;
+if(socket != NULL) *socket = atoi(q+1);
+if(p_remote_db == NULL) return 0;
+q = strchr(p, '/');
+if(q != NULL) {
+ q++;
+ while(*q == ' ') q++;
+ if(*q == 0) *p_remote_db = NULL;
+ else {
+ strcpy(remote_db, q);
+ *p_remote_db = remote_db;
+ }
+ }
+else *p_remote_db = NULL;
+return 0;
+}
+
+
+#define maxSUBINLNG 512
+static raa_db_access *init_raa_db_access(void)
+{
+raa_db_access *data;
+struct chain_void *elt;
+
+data = (raa_db_access *)calloc(1, sizeof(raa_db_access));
+elt = (struct chain_void *)malloc(sizeof(struct chain_void));
+if(data == NULL || elt == NULL) return NULL;
+data->rlng_buffer = (struct rlng *)malloc((maxSUBINLNG+1)*sizeof(int));
+if(data->rlng_buffer == NULL) return NULL;
+/* ajouter un elt a liste ds db ouvertes */
+elt->data = data;
+elt->next = raa_list_open_dbs;
+raa_list_open_dbs = elt;
+
+/* initialiser les champs non nuls */
+data->gfrag_data.l_nseq_buf = INT_MAX;
+data->nextelt_data.current_rank = -1;
+data->nextelt_data.previous = -2;
+data->readshrt_data.shrt_begin = S_BUF_SHRT - 1;
+#ifdef WIN32
+data->sock_input_pos = data->sock_input; data->sock_input_end = data->sock_input;
+#endif
+return data;
+}
+
+
+static int fill_gfrag_buf(raa_db_access *raa_current_db, int nsub, int first)
+{
+char *p, *line;
+int lu, l, length, wasfull;
+
+sock_printf(raa_current_db,"gfrag&number=%d&start=%d&length=%d\n", nsub, first, RAA_GFRAG_BSIZE);
+/* retour: length=xx&...the seq...\n */
+line = read_sock_tell(raa_current_db, &wasfull);
+if(line == NULL) return 0;
+if(strncmp(line, "length=", 7) != 0 || (p = strchr(line, '&')) == NULL ) {
+ return 0;
+ }
+length = atoi(line + 7);
+lu = strlen(++p);
+memcpy(raa_current_db->gfrag_data.buffer, p, lu);
+while(! wasfull) {
+ line = read_sock_tell(raa_current_db, &wasfull);
+ if(line == NULL) break;
+ l = strlen(line);
+ if(lu+l <= RAA_GFRAG_BSIZE) memcpy(raa_current_db->gfrag_data.buffer + lu, line, l);
+ lu += l;
+ }
+raa_current_db->gfrag_data.buffer[lu] = 0;
+return lu;
+}
+
+
+
+int raa_gfrag(raa_db_access *raa_current_db, int nsub, int first, int lfrag, char *dseq)
+{
+int lu, piece;
+char *debut;
+
+if(raa_current_db == NULL) return 0;
+if(raa_current_db->gfrag_data.lbuf == 0 || nsub != raa_current_db->gfrag_data.nseq_buf ||
+ first >= raa_current_db->gfrag_data.first_buf + raa_current_db->gfrag_data.lbuf ||
+ first < raa_current_db->gfrag_data.first_buf) {
+ if( nsub == raa_current_db->gfrag_data.nseq_buf && first > raa_current_db->gfrag_data.l_nseq_buf)
+ lu = 0;
+ else
+ lu = fill_gfrag_buf(raa_current_db, nsub, first);
+
+ if(lu == 0) return 0;
+ raa_current_db->gfrag_data.lbuf = lu;
+ if(raa_current_db->gfrag_data.lbuf < RAA_GFRAG_BSIZE)
+ raa_current_db->gfrag_data.l_nseq_buf = first + raa_current_db->gfrag_data.lbuf - 1;
+ else raa_current_db->gfrag_data.l_nseq_buf = INT_MAX;
+ raa_current_db->gfrag_data.first_buf = first;
+ raa_current_db->gfrag_data.nseq_buf = nsub;
+ }
+debut = raa_current_db->gfrag_data.buffer + (first - raa_current_db->gfrag_data.first_buf);
+lu = raa_current_db->gfrag_data.lbuf + raa_current_db->gfrag_data.first_buf-1 - first+1;
+if( lu > lfrag) lu = lfrag;
+memcpy(dseq, debut, lu);
+while(lfrag > lu) {
+ piece = raa_gfrag(raa_current_db, nsub, first + lu, lfrag - lu, dseq + lu);
+ if(piece == 0) break;
+ lu += piece;
+ }
+dseq[lu] = 0;
+return lu;
+}
+
+
+void list_open_dbs_remove(raa_db_access *raa_current_db)
+/* enlever de liste des db ouvertes */
+{
+struct chain_void *elt, *elt2;
+int i;
+
+if(raa_current_db == NULL) return; /* should not happen */
+if(raa_current_db->dbname != NULL) free(raa_current_db->dbname);
+if(raa_current_db->rlng_buffer != NULL) free(raa_current_db->rlng_buffer);
+if(raa_current_db->readsub_data.name != NULL) free(raa_current_db->readsub_data.name);
+for(i = 0; i < raa_current_db->annot_data.annotcount; i++)
+ free(raa_current_db->annot_data.annotline[i]);
+for(i = 0; i < BLOCK_ELTS_IN_LIST; i++) if(raa_current_db->nextelt_data.tabname[i] != NULL)
+ free(raa_current_db->nextelt_data.tabname[i]);
+if(raa_current_db->readsmj_data.lastrec > 0) {
+ free(raa_current_db->readsmj_data.plongs);
+ for(i=2; i <= raa_current_db->readsmj_data.lastrec; i++) {
+ if(raa_current_db->readsmj_data.names[i] != NULL) free(raa_current_db->readsmj_data.names[i]);
+ if(raa_current_db->readsmj_data.libels[i] != NULL) free(raa_current_db->readsmj_data.libels[i]);
+ }
+ free(raa_current_db->readsmj_data.names); free(raa_current_db->readsmj_data.libels);
+ raa_current_db->readsmj_data.lastrec = 0;
+ }
+
+if(raa_list_open_dbs == NULL) return; /* should not happen */
+if(raa_list_open_dbs->data == raa_current_db) {
+ elt = raa_list_open_dbs;
+ raa_list_open_dbs = raa_list_open_dbs->next;
+ free(elt);
+ }
+else {
+ elt = raa_list_open_dbs;
+ while(elt->next != NULL) {
+ if(elt->next->data == raa_current_db) {
+ elt2 = elt->next;
+ elt->next = elt2->next;
+ free(elt2);
+ break;
+ }
+ elt = elt->next;
+ }
+ }
+free(raa_current_db);
+}
+
+
+static void raa_free_sp_tree(raa_node *pere)
+{
+raa_node *next, *tmp_n;
+struct raa_pair *liste, *tmp_p;
+
+liste = pere->list_desc;
+while(liste != NULL) {
+ tmp_p = liste->next;
+ raa_free_sp_tree(liste->value);
+ free(liste);
+ liste = tmp_p;
+ }
+next = pere->syno;
+while(next != NULL && next != pere) {
+ tmp_n = next->syno;
+ free(next->name);
+ free(next);
+ next = tmp_n;
+ }
+free(pere->name);
+if(pere->libel != NULL) free(pere->libel);
+if(pere->libel_upcase != NULL) free(pere->libel_upcase);
+free(pere);
+}
+
+
+void raa_acnucclose(raa_db_access *raa_current_db) {
+char *reponse;
+int i;
+
+if(raa_current_db == NULL) return;
+
+sock_fputs(raa_current_db, "acnucclose\n");
+
+reponse=read_sock(raa_current_db);
+if(reponse != NULL) {
+ sock_fputs(raa_current_db, "quit\n");
+ sock_flush(raa_current_db);
+ }
+#ifdef WIN32
+ closesocket( (SOCKET) (raa_current_db->raa_sockfdw) );
+#else
+ fclose(raa_current_db->raa_sockfdr);
+ fclose(raa_current_db->raa_sockfdw);
+#endif
+
+if(raa_current_db->tot_key_annots > 0) {
+ for(i = 0; i < raa_current_db->tot_key_annots; i++) {
+ free(raa_current_db->key_annots[i]);
+ free(raa_current_db->key_annots_min[i]);
+ }
+ free(raa_current_db->key_annots);
+ free(raa_current_db->key_annots_min);
+ free(raa_current_db->want_key_annots);
+ raa_current_db->tot_key_annots = 0;
+ }
+if(raa_current_db->tid_to_rank != NULL) free(raa_current_db->tid_to_rank);
+if(raa_current_db->sp_tree != NULL) {
+ raa_free_sp_tree(raa_current_db->sp_tree[2]);
+ free(raa_current_db->sp_tree);
+ }
+
+list_open_dbs_remove(raa_current_db);
+}
+
+
+int raa_prep_acnuc_query(raa_db_access *raa_current_db) {
+/* returns -1 if error or number of free bit lists
+*/
+ char *reponse, *p, *q, *annotlines;
+ int codret, i;
+ Reponse *rep;
+
+if(raa_current_db == NULL) return -1;
+ rep = initreponse();
+
+ sock_fputs(raa_current_db, "countfreelists\n");
+ reponse=read_sock(raa_current_db);
+if(reponse == NULL) return -1;
+ parse(reponse,rep);
+ reponse=val(rep,"code");
+ if(reponse == NULL) return -1;
+ codret=atoi(reponse);
+ free(reponse);
+ if(codret != 0) return -1;
+ reponse=val(rep,"free");
+ if(reponse != NULL) {
+ codret = atoi(reponse);
+ free(reponse);
+ }
+annotlines = val(rep, "annotlines");
+raa_current_db->tot_key_annots = 0;
+if(annotlines != NULL) {
+ p = annotlines - 1;
+ do {
+ p++;
+ raa_current_db->tot_key_annots++;
+ }
+ while((p = strchr(p, '|')) != NULL);
+ raa_current_db->want_key_annots = (unsigned char *)malloc(raa_current_db->tot_key_annots *
+ sizeof(unsigned char));
+ raa_current_db->key_annots = (char **)malloc(raa_current_db->tot_key_annots * sizeof(char *));
+ raa_current_db->key_annots_min = (char **)malloc(raa_current_db->tot_key_annots * sizeof(char *));
+ p = annotlines;
+ for(i = 0; i < raa_current_db->tot_key_annots; i++) {
+ q = strchr(p, '|');
+ if(q == NULL) q = p + strlen(p);
+ raa_current_db->key_annots[i] = malloc(q - p + 1);
+ raa_current_db->key_annots_min[i] = malloc(q - p + 1);
+ memcpy(raa_current_db->key_annots_min[i], p, q - p);
+ raa_current_db->key_annots_min[i][q - p] = 0;
+ strcpy(raa_current_db->key_annots[i], raa_current_db->key_annots_min[i]);
+ majuscules(raa_current_db->key_annots[i]);
+ compact(raa_current_db->key_annots[i]);
+ p = q + 1;
+ }
+ free(annotlines);
+ }
+else codret = -1;
+ clear_reponse(rep);
+ return codret;
+}
+
+
+static char *raa_requete_remote_file(raa_db_access *raa_current_db, char *oldrequete, int **plist, char **);
+
+int raa_proc_query(raa_db_access *raa_current_db, char *requete, char **message,
+ char *nomliste, int *numlist, int *count, int *locus, int *type) {
+ char *reponse, *code, *numlistchr, *countchr, *locuschr, *typechr, *badfname;
+ int codret, *tmp_blists;
+ Reponse *rep;
+
+if(raa_current_db == NULL) return -1;
+ requete = raa_requete_remote_file(raa_current_db, requete, &tmp_blists, &badfname);
+ if(requete == NULL) {
+ if(message != NULL) {
+ static char fmt[] = "problem accessing file: %s";
+ *message = (char *)malloc(strlen(fmt) + strlen(badfname) + 1);
+ sprintf(*message, fmt, badfname);
+ }
+ return 1;
+ }
+ sock_printf(raa_current_db,"proc_query&query=\"%s\"&name=\"%s\"\n",
+ protect_quotes(requete), nomliste);
+ free(requete);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) {
+ if(message != NULL) *message = strdup("connection with server is down");
+ return -1;
+ }
+ rep=initreponse();
+ parse(reponse,rep);
+ code=val(rep,"code");
+ codret=atoi(code);
+ if(codret == 0) {
+ numlistchr=val(rep,"lrank");
+ *numlist=atoi(numlistchr);
+ countchr=val(rep,"count");
+ if(count != NULL) *count=atoi(countchr);
+ typechr=val(rep,"type");
+ locuschr=val(rep,"locus");
+ if(type != NULL) {
+ if (strcmp(typechr,"SQ")==0) *type='S';
+ else if (strcmp(typechr,"KW")==0) *type='K';
+ else if (strcmp(typechr,"SP")==0) *type='E';
+ }
+ if(locus != NULL) *locus = strcmp(locuschr,"T") == 0;
+ free(countchr);
+ free(locuschr);
+ free(typechr);
+ free(numlistchr);
+ }
+ else if(message != NULL) {
+ *message = val(rep, "message");
+ }
+ free(code);
+ clear_reponse(rep);
+ if(tmp_blists != NULL) {
+ while(*tmp_blists != 0) raa_releaselist(raa_current_db, *(tmp_blists++) );
+ }
+ return codret;
+}
+
+
+int raa_nexteltinlist(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength)
+{
+return raa_nexteltinlist_annots(raa_current_db, first, lrank, pname, plength, NULL, NULL);
+}
+
+
+int raa_nexteltinlist_annots(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength,
+ raa_long *paddr, int *pdiv)
+{
+int num, next, count;
+char *p;
+Reponse *rep;
+
+if(raa_current_db == NULL) return 0;
+if(lrank == raa_current_db->nextelt_data.current_rank &&
+ raa_current_db->nextelt_data.previous < raa_current_db->nextelt_data.total - 1 &&
+ (raa_current_db->nextelt_data.previous == -1 ||
+ first == raa_current_db->nextelt_data.tabnum[raa_current_db->nextelt_data.previous] ) ) {
+ raa_current_db->nextelt_data.previous++;
+ next = raa_current_db->nextelt_data.tabnum[raa_current_db->nextelt_data.previous];
+ if(next != 0) {
+ if(pname != NULL) *pname = raa_current_db->nextelt_data.tabname[raa_current_db->nextelt_data.previous];
+ if(plength != NULL) *plength = raa_current_db->nextelt_data.tablength[raa_current_db->nextelt_data.previous];
+ if(paddr != NULL) *paddr = raa_current_db->nextelt_data.taboffset[raa_current_db->nextelt_data.previous];
+ if(pdiv != NULL) *pdiv = raa_current_db->nextelt_data.tabdiv[raa_current_db->nextelt_data.previous];
+ }
+ return next;
+ }
+
+count = BLOCK_ELTS_IN_LIST;
+for(num = 0; num < count; num++) {
+ if(raa_current_db->nextelt_data.tabname[num] != NULL) free(raa_current_db->nextelt_data.tabname[num]);
+ }
+memset(raa_current_db->nextelt_data.tabname, 0, count * sizeof(char *));
+sock_printf(raa_current_db,"nexteltinlist&lrank=%d&first=%d&count=%d\n",lrank,first, count);
+num = 0; raa_current_db->nextelt_data.current_rank = lrank;
+raa_current_db->nextelt_data.total = 0;
+do {
+ p = read_sock(raa_current_db);
+ if(p == NULL) return 0;
+ rep = initreponse();
+ parse(p, rep);
+ p = val(rep,"next");
+ if(p == NULL) {
+ clear_reponse(rep);
+ return 0;
+ }
+ next = atoi(p);
+ free(p);
+ raa_current_db->nextelt_data.total++;
+ raa_current_db->nextelt_data.tabnum[num] = next;
+ if(next != 0) {
+ raa_current_db->nextelt_data.tabname[num] = val(rep, "name");
+ if( (p= val(rep, "length")) != NULL) {
+ raa_current_db->nextelt_data.tablength[num] = atoi(p);
+ free(p);
+ }
+ if((p= val(rep, "offset")) != NULL) {
+ raa_current_db->nextelt_data.taboffset[num] = scan_raa_long(p);
+ free(p);
+ }
+ if((p= val(rep, "div")) != NULL) {
+ raa_current_db->nextelt_data.tabdiv[num] = atoi(p);
+ free(p);
+ }
+ }
+ clear_reponse(rep);
+ num++;
+ }
+while(next != 0 && --count > 0);
+raa_current_db->nextelt_data.previous = -1;
+return raa_nexteltinlist_annots(raa_current_db, first, lrank, pname, plength, paddr, pdiv);
+}
+
+
+raa_long scan_raa_long(char *txt)
+{
+raa_long val;
+
+sscanf(txt, RAA_LONG_FORMAT, &val);
+return val;
+}
+
+
+char *print_raa_long(raa_long val)
+{
+static char buffer[50];
+sprintf(buffer, RAA_LONG_FORMAT, val);
+return buffer;
+}
+
+
+
+
+static char *load_annots_buf(raa_db_access *raa_current_db, raa_long faddr, int div, int was_nextannots)
+/* appeler juste apr�s avoir envoye sur socket
+read_annots&... ou next_annots&... :
+retour attendu sur socket : nl=xx[&offset=xx]&...nl lines each with \n */
+{
+int i, nl;
+char *firstline, *p, *q;
+
+ if(raa_current_db == NULL) return NULL;
+ for(i=0; i < raa_current_db->annot_data.annotcount; i++)
+ free(raa_current_db->annot_data.annotline[i]);
+ raa_current_db->annot_data.annotcount = 0;
+ raa_current_db->annot_data.annotaddrlast = faddr;
+ firstline = read_sock(raa_current_db);
+ if(firstline == NULL) return NULL;
+ if(strncmp(firstline, "nl=", 3) != 0 || (p = strchr(firstline, '&')) == NULL ) return NULL;
+ nl = atoi(firstline + 3);
+ if(nl == 0) return NULL;
+ p++;
+ if(was_nextannots && strncmp(p, "offset=", 7) == 0) {
+ p = strchr(p, '&');
+ if(p == NULL) return NULL;
+ p++;
+ }
+ i = strlen(p);
+ raa_current_db->annot_data.annotline[0] = (char *)malloc(i+1);
+ strcpy(raa_current_db->annot_data.annotline[0], p);
+ raa_current_db->annot_data.annotaddrlast += strlen(raa_current_db->annot_data.annotline[0]) + 1;
+ for(i = 1; i < nl; i++) {
+ q = read_sock(raa_current_db);
+ if(q == NULL) return NULL;
+ raa_current_db->annot_data.annotline[i] = strdup( q );
+ raa_current_db->annot_data.annotaddrlast += strlen(raa_current_db->annot_data.annotline[i]) + 1;
+ }
+ raa_current_db->annot_data.annotcurrent = 1; raa_current_db->annot_data.annotcount = nl;
+ raa_current_db->annot_data.annotaddr = faddr; raa_current_db->annot_data.annotdiv = div;
+ raa_current_db->annot_data.annotaddrfirst = faddr;
+ strcpy(raa_current_db->annot_data.annotsbuffer, raa_current_db->annot_data.annotline[0]);
+ return raa_current_db->annot_data.annotsbuffer;
+}
+
+
+char *raa_read_annots(raa_db_access *raa_current_db, raa_long faddr, int div)
+{
+ int i;
+ raa_long debut;
+ char *p;
+
+if(raa_current_db == NULL) return NULL;
+ if(raa_current_db->annot_data.annotcount > 0 &&
+ div == raa_current_db->annot_data.annotdiv &&
+ faddr >= raa_current_db->annot_data.annotaddrfirst &&
+ faddr < raa_current_db->annot_data.annotaddrlast ) {
+ debut = raa_current_db->annot_data.annotaddrfirst;
+ for(i = 1; i <= raa_current_db->annot_data.annotcount; i++) {
+ if(debut == faddr) {
+ raa_current_db->annot_data.annotcurrent = i;
+ raa_current_db->annot_data.annotaddr = debut;
+ strcpy(raa_current_db->annot_data.annotsbuffer, raa_current_db->annot_data.annotline[raa_current_db->annot_data.annotcurrent - 1]);
+ return raa_current_db->annot_data.annotsbuffer;
+ }
+ debut += strlen(raa_current_db->annot_data.annotline[i - 1]) + 1;
+ }
+ }
+ sock_printf(raa_current_db,"read_annots&offset=%s&div=%d&nl=%d\n",
+ print_raa_long(faddr), div, ANNOTCOUNT);
+ p = load_annots_buf(raa_current_db, faddr, div, FALSE);
+ return p;
+}
+
+
+char *raa_next_annots(raa_db_access *raa_current_db, raa_long *paddr)
+{
+ raa_long faddr;
+ char *p;
+
+if(raa_current_db == NULL) return NULL;
+ if(raa_current_db->annot_data.annotcurrent < raa_current_db->annot_data.annotcount) {
+ raa_current_db->annot_data.annotaddr +=
+ strlen(raa_current_db->annot_data.annotline[raa_current_db->annot_data.annotcurrent - 1]) + 1;
+ if(paddr != NULL) *paddr = raa_current_db->annot_data.annotaddr;
+ raa_current_db->annot_data.annotcurrent++;
+ strcpy(raa_current_db->annot_data.annotsbuffer,
+ raa_current_db->annot_data.annotline[raa_current_db->annot_data.annotcurrent - 1]);
+ return raa_current_db->annot_data.annotsbuffer;
+ }
+ faddr = raa_current_db->annot_data.annotaddrlast;
+ if(paddr != NULL) *paddr = faddr;
+ sock_printf(raa_current_db, "next_annots&nl=%d\n", ANNOTCOUNT);
+ p = load_annots_buf(raa_current_db, faddr, raa_current_db->annot_data.annotdiv, TRUE);
+ return p;
+}
+
+
+int raa_iknum(raa_db_access *raa_current_db, char *name, raa_file cas)
+{
+char *reponse, *p;
+int val;
+
+if(raa_current_db == NULL) return 0;
+ sock_printf(raa_current_db,"iknum&name=\"%s\"&type=%s\n", protect_quotes(name),
+ (cas == raa_key ? "KW" : "SP") );
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ p = strchr(reponse, '=');
+ if(p == NULL) return 0;
+ p++;
+ sscanf(p, "%u", &val);
+ return val;
+}
+
+
+int raa_isenum(raa_db_access *raa_current_db, char *name)
+{
+char *reponse, *p;
+int val;
+
+if(raa_current_db == NULL) return 0;
+ sock_printf(raa_current_db,"isenum&name=\"%s\"\n", protect_quotes(name) );
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ p = strchr(reponse, '=');
+ if(p == NULL) return 0;
+ p++;
+ sscanf(p, "%u", &val);
+ return val;
+}
+
+
+int raa_bcount(raa_db_access *raa_current_db, int lrank)
+{
+ Reponse *rep;
+ char *reponse, *code, *countstr;
+ int count = 0;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db,"bcount&lrank=%d\n",lrank);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ code = val(rep,"code");
+ if(*code == '0') {
+ countstr = val(rep,"count");
+ count = atoi(countstr);
+ free(countstr);
+ }
+ free(code);
+ clear_reponse(rep);
+ return count;
+}
+
+void raa_bit1(raa_db_access *raa_current_db, int lrank, int num)
+{
+char *reponse;
+
+if(raa_current_db == NULL) return;
+ sock_printf(raa_current_db,"bit1&lrank=%d&num=%d\n", lrank, num);
+ reponse=read_sock(raa_current_db);
+}
+
+
+void raa_bit0(raa_db_access *raa_current_db, int lrank, int num)
+{
+char *reponse;
+
+if(raa_current_db == NULL) return;
+ sock_printf(raa_current_db,"bit0&lrank=%d&num=%d\n", lrank, num);
+ reponse=read_sock(raa_current_db);
+}
+
+
+int raa_btest(raa_db_access *raa_current_db, int lrank, int num)
+{
+char *reponse;
+
+if(raa_current_db == NULL) return 0;
+ sock_printf(raa_current_db,"btest&lrank=%d&num=%d\n", lrank, num);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ return strcmp(reponse, "code=0&on") == 0;
+}
+
+void raa_copylist(raa_db_access *raa_current_db, int from, int to)
+{
+char *reponse;
+
+if(raa_current_db == NULL) return;
+ sock_printf(raa_current_db,"copylist&lfrom=%d<o=%d\n", from, to);
+ reponse=read_sock(raa_current_db);
+}
+
+
+void raa_zerolist(raa_db_access *raa_current_db, int rank)
+{
+char *reponse;
+
+if(raa_current_db == NULL) return;
+ sock_printf(raa_current_db,"zerolist&lrank=%d\n", rank);
+ reponse=read_sock(raa_current_db);
+}
+
+
+void raa_setliststate(raa_db_access *raa_current_db, int lrank, int locus, int type)
+{
+char *reponse, str_type[3];
+
+if(raa_current_db == NULL) return;
+if(type == 'S') strcpy(str_type, "SQ");
+else if(type == 'K') strcpy(str_type, "KW");
+else strcpy(str_type, "SP");
+
+ sock_printf(raa_current_db,"setliststate&lrank=%d&locus=%c&type=%s\n", lrank, (locus ? 'T' : 'F'),
+ str_type );
+ reponse=read_sock(raa_current_db);
+}
+
+
+char *raa_getliststate(raa_db_access *raa_current_db, int lrank, int *locus, int *type, int *count)
+/* list name is returned in static memory */
+{
+ Reponse *rep;
+ char *reponse, *code, *countstr, *locusstr, *typestr, *retp = NULL;
+ static char *namestr = NULL;
+
+if(raa_current_db == NULL) return NULL;
+ rep=initreponse();
+ sock_printf(raa_current_db,"getliststate&lrank=%d\n",lrank);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ parse(reponse, rep);
+ code = val(rep,"code");
+ if(code != NULL && *code == '0') {
+ typestr = val(rep,"type");
+ if(type != NULL) {
+ if(strcmp(typestr, "SQ") == 0) *type = 'S';
+ else if(strcmp(typestr, "KW") == 0) *type = 'K';
+ else *type = 'E';
+ }
+ if(namestr != NULL) free(namestr); /* allocation precedante */
+ namestr = val(rep, "name");
+ countstr = val(rep, "count");
+ if(count != NULL) *count = atoi(countstr);
+ locusstr = val(rep, "locus");
+ if(locus != NULL) *locus = (*locusstr == 'T');
+ free(countstr);
+ free(locusstr);
+ free(typestr);
+ retp = namestr;
+ }
+ if(code != NULL) free(code);
+ clear_reponse(rep);
+ return retp;
+}
+
+
+char *raa_residuecount(raa_db_access *raa_current_db, int lrank)
+{
+Reponse *rep;
+char *reponse, *code;
+static char total[30];
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db,"residuecount&lrank=%d\n",lrank);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ code = val(rep,"code");
+ strcpy(total, "0");
+ if(code != NULL && *code == '0') {
+ free(code);
+ code = val(rep,"count");
+ if(code != NULL) {
+ strcpy(total, code);
+ free(code);
+ }
+ }
+clear_reponse(rep);
+return total;
+}
+
+
+int raa_getemptylist(raa_db_access *raa_current_db, char *name)
+{
+ Reponse *rep;
+ char *reponse, *code, *rankstr;
+ int rank = 0;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db, "getemptylist&name=\"%s\"\n", protect_quotes(name));
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ code = val(rep,"code");
+ if(code != NULL && (*code == '0' || *code == '3') ) {
+ rankstr = val(rep, "lrank");
+ rank = atoi(rankstr);
+ free(rankstr);
+ }
+ if(code != NULL) free(code);
+ clear_reponse(rep);
+ return rank;
+}
+
+
+int raa_setlistname(raa_db_access *raa_current_db, int lrank, char *name)
+{
+ Reponse *rep;
+char *reponse, *code;
+int retval;
+
+if(raa_current_db == NULL) return -1;
+ rep=initreponse();
+ sock_printf(raa_current_db, "setlistname&lrank=%d&name=\"%s\"\n", lrank, name);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return -1;
+ parse(reponse, rep);
+ code = val(rep,"code");
+ if(*code == '0') retval = 0;
+ else if(*code == '3') retval = 1;
+ else retval = -1;
+ free(code);
+ clear_reponse(rep);
+return retval;
+}
+
+
+int raa_getlistrank(raa_db_access *raa_current_db, char *name)
+{
+ Reponse *rep;
+char *reponse, *rankstr;
+int rank;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db, "getlistrank&name=\"%s\"\n", name);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ rankstr = val(rep,"lrank");
+ if(rankstr == NULL) return 0;
+ rank = atoi(rankstr);
+ free(rankstr);
+ clear_reponse(rep);
+ return rank;
+}
+
+
+
+int raa_releaselist(raa_db_access *raa_current_db, int lrank)
+{
+ Reponse *rep;
+char *reponse, *rankstr;
+int rank;
+
+if(raa_current_db == NULL) return 1;
+ rep=initreponse();
+ sock_printf(raa_current_db, "releaselist&lrank=%d\n", lrank);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 1;
+ parse(reponse, rep);
+ rankstr = val(rep,"code");
+ if(rankstr == NULL) return 1;
+ rank = atoi(rankstr);
+ free(rankstr);
+ clear_reponse(rep);
+ return rank;
+}
+
+
+
+int raa_countfilles(raa_db_access *raa_current_db, int lrank)
+{
+ Reponse *rep;
+char *reponse, *rankstr;
+int rank;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db, "countsubseqs&lrank=%d\n", lrank);
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ rankstr = val(rep,"count");
+ if(rankstr == NULL) return 0;
+ rank = atoi(rankstr);
+ free(rankstr);
+ clear_reponse(rep);
+ return rank;
+}
+
+
+int raa_alllistranks(raa_db_access *raa_current_db, int **pranks)
+{
+ Reponse *rep;
+char *reponse, *rankstr, *p;
+int count, *ranks, i;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_fputs(raa_current_db, "alllistranks\n");
+ reponse=read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ rankstr = val(rep,"count");
+ p = strchr(reponse, '&');
+ if(rankstr == NULL || p == NULL) return 0;
+ count = atoi(rankstr);
+ ranks = (int *)malloc(count * sizeof(int));
+ if(ranks == NULL ) return 0;
+ p++;
+ for(i=0; i< count; i++) {
+ sscanf(p, "%d", &ranks[i]);
+ p = strchr(p, ',');
+ if(p == NULL) break;
+ p++;
+ }
+ *pranks = ranks;
+ free(rankstr);
+ clear_reponse(rep);
+ return count;
+}
+
+
+
+int raa_fcode(raa_db_access *raa_current_db, raa_file cas, char *name)
+{
+char *reponse, *p, type[5];
+int value;
+
+if(raa_current_db == NULL) return 0;
+if(cas == raa_aut) strcpy(type, "AUT");
+else if(cas == raa_bib) strcpy(type, "BIB");
+else if(cas == raa_acc) strcpy(type, "ACC");
+else if(cas == raa_smj) strcpy(type, "SMJ");
+else if(cas == raa_sub) strcpy(type, "SUB");
+else return 0;
+ sock_printf(raa_current_db,"fcode&name=\"%s\"&type=%s\n", protect_quotes(name), type );
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ p = strchr(reponse, '=');
+ if(p == NULL) return 0;
+ p++;
+ sscanf(p, "%u", &value);
+ return value;
+}
+
+
+
+int raa_read_first_rec(raa_db_access *raa_current_db, raa_file cas)
+{
+int value;
+char type[5], *p, *reponse;
+
+if(raa_current_db == NULL) return 1;
+if(raa_current_db->first_recs[cas] != 0) return raa_current_db->first_recs[cas];
+
+if(cas == raa_aut) strcpy(type, "AUT");
+else if(cas == raa_bib) strcpy(type, "BIB");
+else if(cas == raa_acc) strcpy(type, "ACC");
+else if(cas == raa_smj) strcpy(type, "SMJ");
+else if(cas == raa_sub) strcpy(type, "SUB");
+
+
+else if(cas == raa_loc) strcpy(type, "LOC");
+else if(cas == raa_key) strcpy(type, "KEY");
+else if(cas == raa_spec) strcpy(type, "SPEC");
+else if(cas == raa_shrt) strcpy(type, "SHRT");
+else if(cas == raa_lng) strcpy(type, "LNG");
+else if(cas == raa_ext) strcpy(type, "EXT");
+else if(cas == raa_txt) strcpy(type, "TXT");
+else return 0;
+sock_printf(raa_current_db,"readfirstrec&type=%s\n", type );
+reponse = read_sock(raa_current_db);
+if(reponse == NULL) return 1;
+p = strstr(reponse, "count=");
+if(p == NULL) return 0;
+sscanf(p + 6, "%u", &value);
+raa_current_db->first_recs[cas] = value;
+return value;
+}
+
+
+char *raa_readsub_pannots(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus,
+ int *pframe, int *pgencode, raa_long *paddr, int *pdiv)
+/* do both seq_to_annots and readsub and buffer result for one seq */
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code, l;
+
+if(raa_current_db == NULL) return NULL;
+ if(num < 2 || num > raa_current_db->nseq) return NULL;
+ if(num != raa_current_db->readsub_data.previous) {
+ sock_printf(raa_current_db,"seq_to_annots&number=%d\nreadsub&num=%u\n", num, num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ /* process reply to seq_to_annots */
+ rep=initreponse();
+ parse(reponse, rep);
+ p = val(rep,"code");
+ code = atoi(p);
+ free(p);
+ if(code == 0) {
+ p = val(rep,"offset");
+ raa_current_db->readsub_data.addr = scan_raa_long(p);
+ free(p);
+ p = val(rep,"div");
+ raa_current_db->readsub_data.div = atoi(p);
+ free(p);
+ }
+ clear_reponse(rep);
+ /* process reply to readsub */
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ rep=initreponse();
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return NULL;
+ code = atoi(p);
+ free(p);
+ if(code != 0) {
+ clear_reponse(rep);
+ return NULL;
+ }
+ p = val(rep, "name");
+ l = strlen(p) + 1;
+ if(l > raa_current_db->readsub_data.lname) {
+ raa_current_db->readsub_data.lname = l;
+ raa_current_db->readsub_data.name = (char *)realloc(raa_current_db->readsub_data.name,
+ raa_current_db->readsub_data.lname);
+ }
+ strcpy(raa_current_db->readsub_data.name, p);
+ free(p);
+ p = val(rep, "length");
+ raa_current_db->readsub_data.length = atoi(p);
+ free(p);
+ p = val(rep, "type");
+ raa_current_db->readsub_data.type = atoi_u(p);
+ free(p);
+ p = val(rep, "is_sub");
+ raa_current_db->readsub_data.locus = atoi_u(p);
+ free(p);
+ p = val(rep, "toext");
+ raa_current_db->readsub_data.toext = atoi_u(p);
+ if(raa_current_db->readsub_data.locus > 0)
+ raa_current_db->readsub_data.toext = - raa_current_db->readsub_data.toext;
+ free(p);
+ p = val(rep, "plkey");
+ raa_current_db->readsub_data.lkey = atoi_u(p);
+ free(p);
+ p = val(rep, "frame");
+ raa_current_db->readsub_data.frame = atoi_u(p);
+ free(p);
+ p = val(rep, "genet");
+ raa_current_db->readsub_data.gencode = atoi_u(p);
+ free(p);
+ raa_current_db->readsub_data.previous = num;
+ clear_reponse(rep);
+ }
+ if(plength != NULL) *plength = raa_current_db->readsub_data.length;
+ if(ptype != NULL) *ptype = raa_current_db->readsub_data.type;
+ if(plocus != NULL) *plocus = raa_current_db->readsub_data.locus;
+ if(pext != NULL) *pext = raa_current_db->readsub_data.toext;
+ if(plkey != NULL) *plkey = raa_current_db->readsub_data.lkey;
+ if(pframe != NULL) *pframe = raa_current_db->readsub_data.frame;
+ if(pgencode != NULL) *pgencode = raa_current_db->readsub_data.gencode;
+ if(paddr != NULL) *paddr = raa_current_db->readsub_data.addr;
+ if(pdiv != NULL) *pdiv = raa_current_db->readsub_data.div;
+ return raa_current_db->readsub_data.name;
+}
+
+
+int raa_seq_to_annots(raa_db_access *raa_current_db, int numseq, raa_long *faddr, int *div)
+{
+char *p;
+
+p = raa_readsub_pannots(raa_current_db, numseq,NULL,NULL,NULL,NULL,NULL,NULL,NULL,faddr,div);
+return p == NULL;
+}
+
+
+char *raa_readsub(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus,
+ int *pframe, int *pgencode)
+{
+return raa_readsub_pannots(raa_current_db, num,plength,ptype,pext,plkey,plocus,pframe,pgencode,NULL,NULL);
+}
+
+
+char *raa_readloc(raa_db_access *raa_current_db, int num, int *sub, int *pnuc, int *spec, int *host, int *plref,
+ int *molec, int *placc, int *org)
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code;
+ static char date[50];
+
+if(raa_current_db == NULL) return NULL;
+ rep=initreponse();
+ sock_printf(raa_current_db,"readloc&num=%u\n", num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return NULL;
+ code = atoi(p);
+ free(p);
+ if(code == 0) {
+ if(sub != NULL) {
+ p = val(rep, "sub");
+ *sub = atoi_u(p);
+ free(p);
+ }
+ if(pnuc != NULL) {
+ p = val(rep, "pnuc");
+ *pnuc = atoi_u(p);
+ free(p);
+ }
+ if(spec != NULL) {
+ p = val(rep, "spec");
+ *spec = atoi_u(p);
+ free(p);
+ }
+ if(host != NULL) {
+ p = val(rep, "host");
+ *host = atoi_u(p);
+ free(p);
+ }
+ if(plref != NULL) {
+ p = val(rep, "plref");
+ *plref = atoi_u(p);
+ free(p);
+ }
+ if(molec != NULL) {
+ p = val(rep, "molec");
+ *molec = atoi_u(p);
+ free(p);
+ }
+ if(placc != NULL) {
+ p = val(rep, "placc");
+ *placc = atoi_u(p);
+ free(p);
+ }
+ if(org != NULL) {
+ p = val(rep, "org");
+ *org = atoi_u(p);
+ free(p);
+ }
+ p = val(rep, "date");
+ strcpy(date, p);
+ free(p);
+ p = date;
+ }
+ else p = NULL;
+ clear_reponse(rep);
+ return p;
+}
+
+
+char *raa_readspec(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *pdesc, int *psyno, int *plhost)
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code;
+
+if(raa_current_db == NULL) return NULL;
+ if(num == raa_current_db->readspec_data.previous && raa_current_db->readspec_data.previous != 0) {
+ if(plibel != NULL) {
+ if(*(raa_current_db->readspec_data.libel) != 0) *plibel = raa_current_db->readspec_data.libel;
+ else *plibel = NULL;
+ }
+ if(plsub != NULL) *plsub = raa_current_db->readspec_data.lsub;
+ if(pdesc != NULL) *pdesc = raa_current_db->readspec_data.desc;
+ if(psyno != NULL) *psyno = raa_current_db->readspec_data.syno;
+ if(plhost != NULL) *plhost = raa_current_db->readspec_data.host;
+ return raa_current_db->readspec_data.name;
+ }
+
+ rep=initreponse();
+ sock_printf(raa_current_db, "readspec&num=%u\n", num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return NULL;
+ code = atoi(p);
+ free(p);
+ if(code != 0) {
+ clear_reponse(rep);
+ return NULL;
+ }
+
+ raa_current_db->readspec_data.previous = num;
+ p = val(rep, "plsub");
+ raa_current_db->readspec_data.lsub = atoi_u(p);
+ free(p);
+ p = val(rep, "desc");
+ raa_current_db->readspec_data.desc = atoi_u(p);
+ free(p);
+ p = val(rep, "syno");
+ raa_current_db->readspec_data.syno = atoi_u(p);
+ free(p);
+ p = val(rep, "host");
+ raa_current_db->readspec_data.host = atoi_u(p);
+ free(p);
+ p = val(rep, "libel");
+ if(p != NULL) {
+ strcpy(raa_current_db->readspec_data.libel, p);
+ free(p);
+ }
+ else *(raa_current_db->readspec_data.libel) = 0;
+ p = val(rep, "name");
+ strcpy(raa_current_db->readspec_data.name, p );
+ free(p);
+ clear_reponse(rep);
+ return raa_readspec(raa_current_db, num, plibel, plsub, pdesc, psyno, plhost);
+}
+
+
+char *raa_readkey(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *pdesc, int *psyno)
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code;
+
+if(raa_current_db == NULL) return NULL;
+ if(num == raa_current_db->readkey_data.previous && raa_current_db->readkey_data.previous != 0) {
+ if(plibel != NULL) {
+ if(*(raa_current_db->readkey_data.libel) != 0) *plibel = raa_current_db->readkey_data.libel;
+ else *plibel = NULL;
+ }
+ if(plsub != NULL) *plsub = raa_current_db->readkey_data.lsub;
+ if(pdesc != NULL) *pdesc = raa_current_db->readkey_data.desc;
+ if(psyno != NULL) *psyno = raa_current_db->readkey_data.syno;
+ return raa_current_db->readkey_data.name;
+ }
+
+ rep=initreponse();
+ sock_printf(raa_current_db, "readkey&num=%u\n", num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return NULL;
+ code = atoi(p);
+ free(p);
+ if(code != 0) {
+ clear_reponse(rep);
+ return NULL;
+ }
+
+ raa_current_db->readkey_data.previous = num;
+ p = val(rep, "plsub");
+ raa_current_db->readkey_data.lsub = atoi_u(p);
+ free(p);
+ p = val(rep, "desc");
+ raa_current_db->readkey_data.desc = atoi_u(p);
+ free(p);
+ p = val(rep, "syno");
+ raa_current_db->readkey_data.syno = atoi_u(p);
+ free(p);
+ p = val(rep, "libel");
+ if(p != NULL) {
+ strcpy(raa_current_db->readkey_data.libel, p);
+ free(p);
+ }
+ else *(raa_current_db->readkey_data.libel) = 0;
+ p = val(rep, "name");
+ strcpy(raa_current_db->readkey_data.name, p);
+ free(p);
+ clear_reponse(rep);
+ return raa_readkey(raa_current_db, num, plibel, plsub, pdesc, psyno);
+}
+
+
+static int load_smj(raa_db_access *raa_current_db, char ***names, unsigned **plongs, char ***libels)
+{
+ Reponse *rep;
+ char *reponse, *p;
+ int nl, i, code, totsmj, recnum;
+
+if(raa_current_db == NULL) return 0;
+totsmj = raa_read_first_rec(raa_current_db, raa_smj);
+ rep=initreponse();
+ sock_printf(raa_current_db,"readsmj&num=2&nl=%d\n", totsmj - 1);
+/* ==>readsmj&num=..&nl=..
+code=0&nl=..
+recnum=..&name=".."&plong=..{&libel=".."} nl times
+*/
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return 0;
+ code = atoi(p);
+ free(p);
+ if(code != 0) return 0;
+ p = val(rep,"nl");
+ if(p == NULL) return 0;
+ nl = atoi(p);
+ free(p);
+ clear_reponse(rep);
+ if(nl == 0) return 0;
+ *names = (char **)calloc(totsmj + 1 , sizeof(char *));
+ *plongs = (unsigned *)calloc(totsmj + 1 , sizeof(unsigned));
+ *libels = (char **)calloc(totsmj + 1 , sizeof(char *));
+ for(i = 0; i < nl; i++) {
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ rep=initreponse();
+ parse(reponse, rep);
+ p = val(rep, "recnum");
+ recnum = atoi(p);
+ free(p);
+ p = val(rep, "plong");
+ (*plongs)[recnum] = atoi_u(p);
+ free(p);
+ p = val(rep, "name");
+ (*names)[recnum] = p;
+ p = val(rep, "libel");
+ (*libels)[recnum] = p;
+ clear_reponse(rep);
+ }
+return totsmj;
+}
+
+
+char *raa_readsmj(raa_db_access *raa_current_db, int num, char **plibel, int *plong)
+{
+if(raa_current_db == NULL) return NULL;
+if(raa_current_db->readsmj_data.lastrec == 0) {
+ raa_current_db->readsmj_data.lastrec = load_smj(raa_current_db,
+ &raa_current_db->readsmj_data.names, &raa_current_db->readsmj_data.plongs,
+ &raa_current_db->readsmj_data.libels);
+ }
+if(num <= 1 || num > raa_current_db->readsmj_data.lastrec) return NULL;
+if(plong != NULL) *plong = raa_current_db->readsmj_data.plongs[num];
+if(plibel != NULL) *plibel = raa_current_db->readsmj_data.libels[num];
+return raa_current_db->readsmj_data.names[num];
+}
+
+
+char *raa_readacc(raa_db_access *raa_current_db, int num, int *plsub)
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code;
+ static char name[100];
+
+if(raa_current_db == NULL) return NULL;
+ rep=initreponse();
+ sock_printf(raa_current_db,"readacc&num=%u\n", num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return NULL;
+ code = atoi(p);
+ free(p);
+ if(code == 0) {
+ if(plsub != NULL) {
+ p = val(rep, "plsub");
+ *plsub = atoi_u(p);
+ free(p);
+ }
+ p = val(rep, "name");
+ strcpy(name, p);
+ free(p);
+ p = name;
+ }
+ else p = NULL;
+ clear_reponse(rep);
+ return p;
+}
+
+
+int raa_readext(raa_db_access *raa_current_db, int num, int *mere, int *deb, int *fin)
+{
+ Reponse *rep;
+ char *p, *reponse;
+ int code, next;
+
+if(raa_current_db == NULL) return 0;
+ rep=initreponse();
+ sock_printf(raa_current_db,"readext&num=%u\n", num);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ parse(reponse, rep);
+ p = val(rep,"code");
+ if(p == NULL) return 0;
+ code = atoi(p);
+ free(p);
+ if(code == 0) {
+ if(mere != NULL) {
+ p = val(rep, "mere");
+ *mere = atoi_u(p);
+ free(p);
+ }
+ if(deb != NULL) {
+ p = val(rep, "debut");
+ *deb = atoi_u(p);
+ free(p);
+ }
+ if(fin != NULL) {
+ p = val(rep, "fin");
+ *fin = atoi_u(p);
+ free(p);
+ }
+ p = val(rep, "next");
+ next = atoi_u(p);
+ free(p);
+ }
+ else next = 0;
+ clear_reponse(rep);
+ return next;
+}
+
+
+int raa_readlng(raa_db_access *raa_current_db, int num)
+/* fills the rlng_buffer structure */
+{
+ char *p, *reponse;
+ int count, i;
+
+if(raa_current_db == NULL) return 0;
+ memset(raa_current_db->rlng_buffer, 0, (raa_current_db->SUBINLNG+1)*sizeof(int));
+ sock_printf(raa_current_db,"readlng&num=%u\n", num);
+/* retour code=0&n=xx&x1,x2,...{&next=xx} */
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ if(strncmp(reponse, "code=0&n=", 9) != 0 || (count = atoi(reponse+9)) == 0) {
+ return 0;
+ }
+ p = strchr(reponse+9, '&');
+ for(i=0; i < count && i < raa_current_db->SUBINLNG; i++) {
+ raa_current_db->rlng_buffer->sub[i] = atoi_u(p+1);
+ p = strchr(p+1, ',');
+ if(p == NULL) break;
+ }
+ p = strstr(reponse, "next=");
+ if(p!= NULL) raa_current_db->rlng_buffer->next = atoi_u(p+5);
+ else raa_current_db->rlng_buffer->next=0;
+ return raa_current_db->rlng_buffer->next;
+}
+
+
+
+static void load_shrt_buffer(raa_db_access *raa_current_db, unsigned point)
+{
+char *reponse, *p, *q;
+int n, i;
+unsigned val, next, previous;
+
+if(raa_current_db == NULL) return;
+sock_printf(raa_current_db, "readshrt&num=%u&max=%d\n", point, MAX_RDSHRT);
+/* reponse is: code=0&n=xx&val,next,.... n times ...\n */
+reponse = read_sock(raa_current_db);
+
+if(reponse == NULL || strncmp(reponse, "code=0&n=", 9) != 0) {
+ return;
+ }
+n = atoi(reponse + 9);
+if (n == 0) return;
+p = strchr(reponse+9, '&');
+if(p == NULL) return;
+q = p + 1;
+previous = point;
+for(i = 0; i < n; i++) {
+ p = strtok(q, ",");
+ q = NULL;
+ sscanf(p, "%u", &val);
+ p = strtok(NULL, ",");
+ sscanf(p, "%u", &next);
+ raa_current_db->readshrt_data.shrt_begin = (raa_current_db->readshrt_data.shrt_begin + 1) % S_BUF_SHRT;
+ raa_current_db->readshrt_data.shrt_buffer[raa_current_db->readshrt_data.shrt_begin][0] = previous;
+ raa_current_db->readshrt_data.shrt_buffer[raa_current_db->readshrt_data.shrt_begin][1] = val;
+ raa_current_db->readshrt_data.shrt_buffer[raa_current_db->readshrt_data.shrt_begin][2] = next;
+ previous = next;
+ }
+if(raa_current_db->readshrt_data.shrt_begin > raa_current_db->readshrt_data.shrt_max - 1) {
+ raa_current_db->readshrt_data.shrt_max = raa_current_db->readshrt_data.shrt_begin + 1;
+ }
+return;
+}
+
+
+unsigned raa_readshrt(raa_db_access *raa_current_db, unsigned point, int *pval)
+{
+int i;
+
+if(raa_current_db == NULL) return 0;
+if(raa_current_db->readshrt_data.total == 0)
+ raa_current_db->readshrt_data.total = (unsigned)raa_read_first_rec(raa_current_db, raa_shrt);
+if(point < 2 || point > raa_current_db->readshrt_data.total) return 0;
+
+for(i = 0; i < raa_current_db->readshrt_data.shrt_max; i++) {
+ if(raa_current_db->readshrt_data.shrt_buffer[i][0] == point) {
+ if(pval != NULL) *pval = raa_current_db->readshrt_data.shrt_buffer[i][1];
+ return raa_current_db->readshrt_data.shrt_buffer[i][2];
+ }
+ }
+load_shrt_buffer(raa_current_db, point);
+return raa_readshrt(raa_current_db, point, pval);
+}
+
+
+
+char *raa_ghelp(raa_db_access *raa_current_db, char *fname, char *topic)
+/* returns all help topic in one string in private memory
+*/
+{
+char *reponse, *p, *fintext, *tmp;
+int nl, l, i;
+static char *text = NULL;
+static int ltext = 0;
+
+if(raa_current_db == NULL) return NULL;
+ sock_printf(raa_current_db,"ghelp&file=%s&item=%s\n", fname, topic);
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ nl = 0;
+ if(strncmp(reponse, "nl=", 3) == 0) nl = atoi(reponse+3);
+ p = strchr(reponse, '&');
+ if(nl <= 0 || p == NULL) return NULL;
+ fintext = text; p++;
+ for(i = 0; i < nl; i++) {
+ l = strlen(p) + 1; /* +1 pour ajouter \n */
+ if( (fintext - text) + l > ltext) {
+ ltext += 1000;
+ tmp = (char *)realloc(text, ltext + 1);
+ if(tmp == NULL) {
+ if(text != NULL) free(text);
+ text = NULL; ltext = 0;
+ return NULL;
+ }
+ fintext = tmp + (fintext - text);
+ text = tmp;
+ }
+ memcpy(fintext, p, l -1);
+ fintext += l;
+ *(fintext - 1) = '\n';
+ if(i + 1 < nl) reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return NULL;
+ p = reponse;
+ }
+ *fintext = 0;
+ return text;
+}
+
+
+struct raa_matchkey {
+ int *ranks;
+ char **names;
+ int count;
+ int current;
+ int no_more;
+ };
+
+static void raa_free_matchkeys(raa_db_access *raa_current_db)
+{
+int i;
+struct raa_matchkey *data = (struct raa_matchkey *)(raa_current_db->matchkey_data);
+
+if(data == NULL) return;
+if(data->count > 0) {
+ for(i = 0; i < data->count; i++) free(data->names[i]);
+ free(data->names);
+ free(data->ranks);
+ }
+free(data);
+raa_current_db->matchkey_data = NULL;
+}
+
+
+static void next_block_matchkeys(raa_db_access *raa_current_db, int num, char *pattern)
+{
+const int blocksize = 2001;
+char *reponse, *p;
+int count, i;
+struct raa_matchkey *data;
+
+if(raa_current_db == NULL) return;
+raa_free_matchkeys(raa_current_db);
+sock_printf(raa_current_db, "nextmatchkey&num=%d", num );
+if(num == 2) sock_printf(raa_current_db, "&pattern=\"%s\"", protect_quotes(pattern) );
+sock_printf(raa_current_db, "&count=%d\n", blocksize);
+reponse = read_sock(raa_current_db);
+if(reponse == NULL || strncmp(reponse, "code=0&count=", 13) != 0) return;
+sscanf(reponse + 13, "%d", &count);
+data = (struct raa_matchkey *)calloc(1, sizeof(struct raa_matchkey));
+raa_current_db->matchkey_data = data;
+if(data == NULL || count == 0) return;
+data->ranks = (int *)malloc(count * sizeof(int));
+data->names = (char **)malloc(count * sizeof(char *));
+data->current = 0;
+data->no_more = (count < blocksize);
+data->count = count;
+if(data->ranks == NULL || data->names == NULL) data->count = 0;
+for(i = 0; i < data->count; i++) {
+ reponse = read_sock(raa_current_db);
+ sscanf(reponse + 4, "%d", &(data->ranks[i]) );
+ p = strchr(reponse, '&');
+ p = strchr(p, '=') + 1;
+ data->names[i] = strdup(unprotect_quotes(p));
+ if(data->names[i] == NULL) {
+ data->count = i;
+ break;
+ }
+ }
+for(i = data->count; i < count; i++) {
+ read_sock(raa_current_db);
+ }
+return;
+}
+
+
+int raa_nextmatchkey(raa_db_access *raa_current_db, int num, char *pattern, char **matching)
+/* *matching returned in static memory */
+{
+struct raa_matchkey *data;
+int no_more, count;
+
+if(raa_current_db == NULL) return 0;
+if(num == 2) {
+ next_block_matchkeys(raa_current_db, 2, pattern);
+ }
+data = (struct raa_matchkey *)(raa_current_db->matchkey_data);
+if(data == NULL) return 0;
+if(data->current < data->count) {
+ if(matching != NULL) *matching = data->names[data->current];
+ return data->ranks[(data->current)++];
+ }
+count = data->count;
+if(count > 0) {
+ no_more = data->no_more;
+ }
+raa_free_matchkeys(raa_current_db);
+if(count == 0 || no_more) return 0;
+next_block_matchkeys(raa_current_db, num, NULL);
+return raa_nextmatchkey(raa_current_db, num, NULL, matching);
+}
+
+
+int atoi_u(const char *p)
+{
+unsigned value;
+
+sscanf(p, "%u", &value);
+return (int)value;
+}
+
+
+char *protect_quotes(char *name)
+/* remplacer tous les " par \"
+name : une chaine inchangee
+retourne un pointeur vers la chaine rendue privee pour cette fonction
+*/
+{
+char *p, *q;
+int l, count;
+static char *bis = NULL;
+static int lbis = 0;
+
+count = 0; p = name - 1;
+while( (p=strchr(p+1, '"')) != NULL) count++;
+if(count == 0) return name;
+
+l = strlen(name);
+if(l + count > lbis) {
+ lbis = l + count;
+ bis = (char *)realloc(bis, lbis + 1);
+ }
+p = name; q = bis;
+while(TRUE) {
+ if(*p == '"') *(q++) = '\\';
+ *q = *p;
+ if(*p == 0) break;
+ q++; p++;
+ }
+return bis;
+}
+
+
+static char *prepare_remote_file(raa_db_access *raa_current_db, char *oldrequete, char *debut, char *type, int *plrank,
+ char **badfname)
+{
+char *p, *q, *reponse, *fin;
+static char line[200];
+int nl, l, code;
+FILE *in;
+Reponse *rep;
+
+*plrank = 0; *badfname = line;
+p = strchr(debut, '=') + 1;
+while(isspace(*p)) p++;
+if(*p == '"') { /* if filename is bracketed by " */
+ *(p++) = ' ';
+ fin = strchr(p, '"');
+ if(fin == NULL) return NULL;
+ *fin = ' ';
+ }
+else {
+ fin = p;
+ do ++fin; while( *fin != 0 && *fin != ')' && !isspace(*fin) );
+ }
+l = fin - p;
+if(l >= sizeof(line)) l = sizeof(line) - 1;
+memcpy(line, p, l); line[l] = 0;
+if(fin - p >= sizeof(line)) return NULL;
+in = fopen(line, "r");
+if(in == NULL) return NULL;
+nl = 0;
+while( fgets(line, sizeof(line), in) != NULL) nl++;
+rewind(in);
+sock_printf(raa_current_db, "crelistfromclientdata&type=%s&nl=%d\n", type, nl);
+if(nl > 0) {
+ while( fgets(line, sizeof(line), in) != NULL) {
+ l = strlen(line);
+ if(line[l - 1] != '\n') strcpy(line + l, "\n");
+ sock_fputs(raa_current_db, line);
+ }
+ }
+fclose(in);
+
+reponse = read_sock(raa_current_db);
+if(reponse == NULL) {
+ strcpy(line, "connection with server is down");
+ return NULL;
+ }
+rep = initreponse();
+parse(reponse, rep);
+q = val(rep,"code");
+code = atoi(q);
+free(q);
+if(code != 0) {
+ if(code == 3) strcpy(line, "too many lists, delete a few");
+ else sprintf(line, "code=%d", code);
+ return NULL;
+ }
+q = val(rep,"name");
+l = strlen(q);
+reponse = (char *)malloc( (debut - oldrequete) + 1 + l + 1 + strlen(fin) + 1);
+p = reponse;
+memcpy(p, oldrequete, debut - oldrequete);
+p += debut - oldrequete;
+*(p++) = ' ';
+memcpy(p, q, l);
+p += l;
+*(p++) = ' ';
+free(q);
+strcpy(p, fin);
+free(oldrequete);
+q = val(rep,"lrank");
+if(q != NULL) {
+ *plrank = atoi(q);
+ free(q);
+ }
+
+clear_reponse(rep);
+return reponse;
+}
+
+
+static int *add_tmp_blist(int lrank, int *list)
+{
+static int total = 0, current, *prelist = NULL; /* need not be specific to each opened db */
+
+if(list == NULL) { /* initialisation */
+ if(prelist != NULL) free(prelist);
+ total = 10; current = 0;
+ list = (int *)malloc(total*sizeof(int));
+ prelist = list;
+ return list;
+ }
+if(current >= total) {
+ int *tmp;
+ tmp = (int *)realloc(list, (total + 10)*sizeof(int));
+ if(tmp == NULL) return list;
+ total += 10;
+ list = tmp;
+ }
+list[current++] = lrank;
+prelist = list;
+return list;
+}
+
+
+char *maj_strstr(char *in, char *target)
+{
+static char *buffer = NULL;
+static int lbuf = 0;
+int l;
+char *p;
+
+l = strlen(in);
+if(l > lbuf) {
+ lbuf = l;
+ buffer = (char *)realloc(buffer, lbuf + 1);
+ }
+strcpy(buffer, in);
+majuscules(buffer);
+p = strstr(buffer, target);
+if(p != NULL) p = in + (p - buffer);
+return p;
+}
+
+
+static char *raa_requete_remote_file(raa_db_access *raa_current_db, char *oldrequete, int **plist, char **pbadfname)
+/*
+rend NULL ou une requete dont les F= FA= FS= FK= ont ete changes en list-name
+et qui a ete creee par malloc
+*/
+{
+char *oldori, *p;
+int lrank, *list;
+
+oldori = strdup(oldrequete);
+if(maj_strstr(oldori, "F=") == NULL && maj_strstr(oldori, "FA=") == NULL &&
+ maj_strstr(oldori, "FK=") == NULL && maj_strstr(oldori, "FS=") == NULL) {
+ *plist = NULL;
+ return oldori;
+ }
+list = add_tmp_blist(0, NULL); /* initialisation a vide */
+while(oldori != NULL && (p = maj_strstr(oldori, "F=")) != NULL) {
+ oldori = prepare_remote_file(raa_current_db, oldori, p, "SQ", &lrank, pbadfname);
+ if(lrank != 0) list = add_tmp_blist(lrank, list);
+ }
+while(oldori != NULL && (p = maj_strstr(oldori, "FA=")) != NULL) {
+ oldori = prepare_remote_file(raa_current_db, oldori, p, "AC", &lrank, pbadfname);
+ if(lrank != 0) list = add_tmp_blist(lrank, list);
+ }
+while(oldori != NULL && (p = maj_strstr(oldori, "FS=")) != NULL) {
+ oldori = prepare_remote_file(raa_current_db, oldori, p, "SP", &lrank, pbadfname);
+ if(lrank != 0) list = add_tmp_blist(lrank, list);
+ }
+while(oldori != NULL && (p = maj_strstr(oldori, "FK=")) != NULL) {
+ oldori = prepare_remote_file(raa_current_db, oldori, p, "KW", &lrank, pbadfname);
+ if(lrank != 0) list = add_tmp_blist(lrank, list);
+ }
+list = add_tmp_blist(0, list); /* marquage fin de liste par zero */
+if(oldori == NULL && list != NULL) {
+ while(*list != 0) raa_releaselist(raa_current_db, *(list++) );
+ list = NULL;
+ }
+*plist = list;
+return oldori;
+}
+
+
+int raa_savelist(raa_db_access *raa_current_db, int lrank, FILE *out, int use_acc, char *prefix)
+{
+char *reponse;
+int err;
+
+if(raa_current_db == NULL) return 1;
+sock_printf(raa_current_db, "savelist&lrank=%d&type=%c\n", lrank, (use_acc ? 'A' : 'N') );
+reponse = read_sock(raa_current_db);
+if(reponse == NULL) return 1;
+err = strcmp(reponse, "code=0");
+if(err != 0) {
+ return 1;
+ }
+while(TRUE) {
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 1;
+ if(strcmp(reponse, "savelist END.") == 0) break;
+ if(prefix != NULL) fputs(prefix, out);
+ fprintf(out, "%s\n", reponse);
+ }
+return 0;
+}
+
+
+int raa_modifylist(raa_db_access *raa_current_db, int lrank, char *type, char *operation, int *pnewlist, int (*check_interrupt)(void),
+ int *p_processed )
+{
+Reponse *rep;
+char *p, *reponse;
+int code;
+
+if(raa_current_db == NULL) return 3;
+sock_printf(raa_current_db, "modifylist&lrank=%d&type=%s&operation=\"%s\"\n", lrank,
+ type, operation );
+sock_flush(raa_current_db); /* tres important */
+if(check_interrupt == NULL) {
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 3;
+ }
+else {
+ while(TRUE) {
+ reponse = read_sock_timeout(raa_current_db, 500 /* msec */);
+ if(raa_current_db == NULL) return 3;
+ if(reponse != NULL) break;
+ if( check_interrupt() ) {
+ sock_fputs(raa_current_db, "\033" /* esc */ );
+ sock_flush(raa_current_db);
+ }
+ }
+ }
+
+rep = initreponse();
+parse(reponse, rep);
+p = val(rep,"code");
+code = atoi(p);
+free(p);
+if(code != 0) return code;
+p = val(rep,"lrank");
+*pnewlist = atoi(p);
+free(p);
+p = val(rep,"processed");
+if(p != NULL && p_processed != NULL) *p_processed = atoi(p);
+if(p != NULL) free(p);
+clear_reponse(rep);
+return 0;
+}
+
+
+int raa_knowndbs(raa_db_access *raa_current_db, char ***pnames, char ***pdescriptions)
+{
+int nl;
+char **names = NULL, **descriptions = NULL;
+char *reponse, *p, *q, *r;
+int l, i;
+
+if(raa_current_db == NULL) return 0;
+sock_printf(raa_current_db, "knowndbs\n" );
+reponse = read_sock(raa_current_db);
+if(reponse == NULL || strncmp(reponse, "nl=", 3) != 0) {
+ return 0;
+ }
+nl = atoi(reponse + 3);
+if(nl == 0) return 0;
+names = (char **) malloc(nl * sizeof(char *));
+descriptions = (char **) malloc(nl * sizeof(char *));
+for(i = 0; i < nl; i++) {
+ reponse = read_sock(raa_current_db);
+ if(reponse == NULL) return 0;
+ p = strchr(reponse, '|');
+ if(p != NULL) {
+ *(p++) = 0;
+ q = strchr(p, '|');
+ if(q != NULL) *(q++) = 0;
+ }
+ l = strlen(reponse);
+ names[i] = (char *)malloc(l+1);
+ strcpy(names[i], reponse);
+ compact(names[i]);
+ if(p != NULL && q != NULL) {
+ while( (r=strchr(p, '\t')) != NULL) *r = ' ';
+ majuscules(p); compact(p);
+ l = strlen(q);
+ descriptions[i] = (char *)malloc(l+20);
+ descriptions[i][0] = 0;
+ if(strcmp(p, "OFF") == 0) strcpy(descriptions[i], "(offline) ");
+ strcat(descriptions[i], q);
+ }
+ else descriptions[i] = NULL;
+ }
+*pnames = names; *pdescriptions = descriptions;
+return nl;
+}
+
+
+char *raa_short_descr(raa_db_access *raa_current_db, int seqnum, char *text, int maxlen, raa_long pinf, int div, char *name)
+/*
+to get a description of a sequence or of a subsequence
+seqnum the sequence number
+text the string to be loaded with description
+maxlen the max # of chars allowed in text (\0 is put but not counted in maxlen)
+return value a pointer to text
+*/
+{
+int l, deb;
+char *p;
+
+text[maxlen]=0;
+strcpy(text, name);
+l=strlen(text);
+if(strchr(name, '.') != NULL) { /* subsequence */
+ if( (p = raa_read_annots(raa_current_db, pinf, div)) == NULL) return text;
+ p[20]=0;
+ strcat(text,p+4);
+ l=strlen(text);
+ while(text[l-1]==' ') l--;
+ text[l]=0;
+ if( ( p = strchr(p + 21, '/') ) != NULL) {
+ strncat(text, p, maxlen - l);
+ l = strlen(text);
+ if(l > 75) return text;
+ }
+ do {
+ p = raa_next_annots(raa_current_db, NULL);
+ if( strcmptrail(p,20,NULL,0) &&
+ strncmp(p,"FT ",10) ) return text;
+ }
+ while(p[21]!='/');
+ do {
+ strncat(text,p+20,maxlen-l);
+ l=strlen(text);
+ if(l>75) return text;
+ p = raa_next_annots(raa_current_db, NULL);
+ }
+ while ( !strcmptrail(p,20,NULL,0) ||
+ !strncmp(p,"FT ",10) );
+ }
+else { /* parent sequence */
+ if( (p = raa_read_annots(raa_current_db, pinf, div)) == NULL) return text;
+ p = raa_next_annots(raa_current_db, NULL);
+ if(raa_current_db->nbrf) {
+ deb=17;
+ }
+ else {
+ deb=13;
+ if(raa_current_db->embl || raa_current_db->swissprot) {
+ while (strncmp(p,"DE",2)) {
+ p = raa_next_annots(raa_current_db, NULL);
+ }
+ deb=6;
+ }
+ }
+ do {
+ strncat(text,p+deb-2,maxlen-l);
+ l=strlen(text);
+ if(l>=77) return text;
+ p = raa_next_annots(raa_current_db, NULL);
+ }
+ while( !strncmp(p," ",2) || !strncmp(p,"DE",2) );
+ }
+return text;
+}
+
+
+struct chain_void *raa_get_list_open_dbs(void)
+{
+return raa_list_open_dbs;
+}
+
+
+#define END_COORDINATE_TEST(line) strncmp(line, "extractseqs END.", 16)
+
+static int *next_1_coordinate_set(raa_db_access *raa_current_db)
+{
+char *p, *line, *q;
+int start, last, seqnum, elt, i, count;
+int *table = NULL;
+
+line = read_sock(raa_current_db);
+if(END_COORDINATE_TEST(line) == 0) return NULL;
+count = 0; p = line;
+while(TRUE) {
+ p = strchr(p+1, '|');
+ if( p == NULL) break;
+ count++;
+ }
+table = (int *)malloc( (3 * count + 1) * sizeof(int));
+if(table == NULL) {
+ do line = read_sock(raa_current_db);
+ while(END_COORDINATE_TEST(line) != 0) ;
+ return NULL;
+ }
+table[0] = count;
+elt = 1;
+for(i = 0; i < count; i++) {
+ p = strchr(line, '|');
+ if(p == NULL) break;
+ q = strchr(line, '=');
+ if(q == NULL || q > p) break;
+ sscanf(q+1, "%d", &seqnum);
+ q = strchr(q+1, '=');
+ if(q == NULL || q > p) break;
+ sscanf(q+1, "%d", &start);
+ q = strchr(q+1, '=');
+ if(q == NULL || q > p) break;
+ sscanf(q+1, "%d", &last);
+ table[elt++] = seqnum;
+ table[elt++] = start;
+ table[elt++] = last;
+ line = p + 1;
+ }
+return table;
+}
+
+
+struct coord_series_struct {
+ int count;
+ int **table;
+ int next;
+ } ;
+
+void *raa_prep_coordinates(raa_db_access *raa_current_db, int lrank, int seqnum,
+ char *operation, /* "simple","fragment","feature","region" */
+ char *feature_name, char *bounds, char *min_bounds)
+/*
+only one of lrank and seqnum is != 0 to work on a sequence list or on an individual sequence
+feature_name: used for operations feature and region, NULL otherwise
+bounds: used for operations fragment and region, NULL otherwise
+ syntax by examples "45,155" "-100,100" "-10,e+100" "E-10,e+100"
+min_bounds: NULL for operations other than fragment and region
+ can be NULL for fragment and region and means min_bounds same as bounds
+ if not NULL, same syntax as bounds
+pcount: upon return, set to number of coordinate series
+
+return value: NULL if error, or pointer to opaque data
+*/
+{
+char message[200];
+char *line;
+int *v, maxi, **table, rank;
+struct coord_series_struct *retval;
+
+sprintf(message, "extractseqs&%s=%d&format=coordinates&operation=%s",
+ seqnum == 0 ? "lrank" : "seqnum",
+ seqnum == 0 ? lrank : seqnum,
+ operation);
+sock_fputs(raa_current_db, message);
+if(strcmp(operation, "feature") == 0 || strcmp(operation, "region") == 0) {
+ sprintf(message, "&feature=%s", feature_name);
+ sock_fputs(raa_current_db, message);
+ }
+if(strcmp(operation, "fragment") == 0 || strcmp(operation, "region") == 0) {
+ sprintf(message, "&bounds=%s", bounds);
+ sock_fputs(raa_current_db, message);
+ }
+if(min_bounds != NULL) {
+ sprintf(message, "&minbounds=%s", min_bounds);
+ sock_fputs(raa_current_db, message);
+ }
+sock_fputs(raa_current_db, "\n"); sock_flush(raa_current_db);
+line = read_sock(raa_current_db);
+if(strcmp(line, "code=0") != 0) {
+ return NULL;
+ }
+
+maxi = 100; rank = 0;
+table = (int **)malloc(maxi*sizeof(int *));
+if(table == NULL) {
+ do line = read_sock(raa_current_db);
+ while(END_COORDINATE_TEST(line) != 0) ;
+ return NULL;
+ }
+while( (v = next_1_coordinate_set(raa_current_db)) != NULL) {
+ if(rank >= maxi) {
+ int **vv;
+ vv = (int **)realloc(table, 2*maxi*sizeof(int *));
+ if(vv == NULL) {
+ do line = read_sock(raa_current_db);
+ while(END_COORDINATE_TEST(line) != 0) ;
+ break;
+ }
+ maxi = 2*maxi;
+ table = vv;
+ }
+ table[rank++] = v;
+ }
+table = realloc(table, rank*sizeof(int *));
+retval = (struct coord_series_struct *)malloc(sizeof(struct coord_series_struct));
+if(retval == NULL) return NULL;
+retval->count = rank;
+retval->table = table;
+retval->next = 0;
+return retval;
+}
+
+
+int *raa_1_coordinate_set(void *v)
+/*
+to be called repetitively as
+table = raa_1_coordinate_set(v);
+until returns NULL
+with the opaque pointer returned by the raa_prep_coordinates call
+
+returns int array table in private memory containing 1 + 3*table[0] elements
+count = table[0] ;
+j = 0;
+for(i=0; i < count; i++) {
+ table[j+1] is the acnuc number of the sequence
+ table[j+2] is the start position in this sequence
+ table[j+3] is the end position in this sequence
+ j += 3;
+ }
+start position > end position <==> fragment is on the complementary strand of the acnuc seq
+returns NULL when all coordinate series have been processed
+*/
+{
+int *retval, i;
+struct coord_series_struct *s = (struct coord_series_struct *)v;
+
+if(s->next >= s->count) {
+ for(i=0; i < s->count; i++) free(s->table[i]);
+ free(s->table);
+ free(s);
+ return NULL;
+ }
+retval = s->table[(s->next)++];
+return retval;
+}
+
+
+char *raa_translate_cds(raa_db_access *raa_current_db, int seqnum)
+/* traduction d'un cds avec codon initiateur traite et * internes ==> X
+rendue dans memoire allouee ici qu'il ne faut pas modifier
+retour NULL si pb lecture de la seq
+*/
+{
+static char *buffer = NULL;
+static int lbuffer = 0;
+int debut_codon, longueur, pos, code, phase;
+char codon[4], *p;
+
+raa_readsub(raa_current_db, seqnum,&longueur,NULL,NULL,NULL,NULL,&phase,&code);
+debut_codon = phase + 1;
+longueur = (longueur - debut_codon + 1)/3;
+if(longueur > lbuffer) {
+ if(buffer != NULL) free(buffer);
+ buffer = (char *)malloc(longueur + 1);
+ lbuffer = longueur;
+ }
+if(buffer == NULL) {lbuffer = 0; return NULL; }
+buffer[0] = raa_translate_init_codon(raa_current_db, seqnum);
+debut_codon += 3;
+for(pos = 1; pos < longueur; pos++) {
+ if( raa_gfrag(raa_current_db, seqnum, debut_codon, 3, codon) == 0) return NULL;
+ buffer[pos] = codaa(codon,code);
+ debut_codon += 3;
+ }
+buffer[longueur] = 0;
+while( (p = strchr(buffer, '*') ) != NULL && p - buffer < longueur - 1 )
+ *p = 'X';
+return buffer;
+}
+
+
+char raa_translate_init_codon(raa_db_access *raa_current_db, int numseq)
+{
+char codon[4];
+int point, special_init = TRUE, val, gc, phase;
+static int num_5_partial = 0;
+
+if(num_5_partial == 0) num_5_partial = raa_iknum(raa_current_db, "5'-PARTIAL", raa_key);
+raa_readsub(raa_current_db, numseq, NULL, NULL,NULL, &point, NULL, &phase, &gc);
+if(phase != 0) special_init = FALSE;
+else { /* la seq est-elle 5'-PARTIAL ? */
+ while(point != 0) {
+ point = raa_readshrt(raa_current_db, point, &val);
+ if(val == num_5_partial) {
+ special_init = FALSE;
+ break;
+ }
+ }
+ }
+raa_gfrag(raa_current_db, numseq, phase + 1, 3, codon);
+if(special_init) /* traduction speciale du codon initiateur */
+ return init_codon_to_aa(codon, gc);
+else return codaa(codon, gc);
+}
+
+
+static void ajout_synonyme(raa_node *secondaire, raa_node *principal)
+{
+raa_node *next;
+
+if(principal->syno == NULL) {
+ principal->syno = secondaire;
+ secondaire->syno = principal;
+ }
+else {
+ next = principal->syno;
+ principal->syno = secondaire;
+ secondaire->syno = next;
+ }
+}
+
+static void redresse_branches(raa_node *pere)
+/* Recursively reverse the order of descendants because it has been reversed
+ */
+{
+ struct raa_pair *point, *next1, *next2, *last;
+ point = pere->list_desc;
+ if (!point) return;
+ next1 = point->next;
+ if (next1) point->next = NULL;
+ while (TRUE) {
+ last = point;
+ redresse_branches(point->value);
+ if (!next1) break;
+ next2 = next1->next;
+ next1->next = point;
+ point = next1;
+ next1 = next2;
+ }
+ pere->list_desc = last;
+}
+
+
+static void ajout_branche(raa_node *pere, raa_node *fils)
+/* adds a pere->fils branch. The last added branch is the first child of pere.
+ */
+{
+struct raa_pair *point, *nouveau;
+
+nouveau = (struct raa_pair *)calloc(1,sizeof(struct raa_pair));
+nouveau->value = fils;
+if( (point = pere->list_desc) == NULL) {
+ pere->list_desc = nouveau;
+ }
+else {
+ nouveau->next = pere->list_desc;
+ pere->list_desc = nouveau;
+ }
+}
+
+
+static void raa_decode_desc_arbre(char *reponse, raa_node **tab_noeud)
+/* reponse contient
+rank&pere&count&"...name..."&"...libel..."
+synonyme est identifie par pere < 0 et -pere = son principal
+*/
+{
+int num, pere, count, l;
+char *p, *q, *name, *libel;
+
+num = atoi(reponse);
+p = strchr(reponse, '&');
+pere = atoi(p + 1);
+p = strchr(p+1, '&');
+count = atoi(p + 1);
+/* ne pas brancher un noeud deja branche ailleurs auparavant */
+if(tab_noeud[num] != NULL ) return;
+tab_noeud[num] = (raa_node *)calloc(1, sizeof(raa_node));
+tab_noeud[num]->rank = num;
+if(pere < 0) { /* un synonyme */
+ ajout_synonyme(tab_noeud[num], tab_noeud[-pere]);
+ }
+else {
+ tab_noeud[num]->count = count;
+ tab_noeud[num]->parent = tab_noeud[pere];
+ if(num != 2) ajout_branche(tab_noeud[pere], tab_noeud[num]);
+ }
+
+p = strchr(p+1, '&') + 1;
+q = p;
+do {
+ q++;
+ if(*q == 0) break;
+ }
+while(*q != '"' || *(q-1) == '\\');
+l = q-p+1;
+name = (char *)malloc(l+1);
+strncpy(name, p, l); name[l] = 0;
+unprotect_quotes(name);
+tab_noeud[num]->name = name;
+q++;
+if(*q == '&') {
+ p = q+1;
+ q = p;
+ do {
+ q++;
+ if(*q == 0) break;
+ }
+ while(*q != '"' || *(q-1) == '\\');
+ l = q-p+1;
+ libel = (char *)malloc(l+1);
+ strncpy(libel, p, l); libel[l] = 0;
+ unprotect_quotes(libel);
+ tab_noeud[num]->libel = libel;
+ p = (char *)malloc(l+1);
+ strcpy(p, libel);
+ majuscules(p);
+ tab_noeud[num]->libel_upcase = p;
+ if(strncmp(p, "ID:", 3) == 0 || (p = strstr(p, "|ID:")) != NULL) {
+ p += 2; if(*p != ':') p++;
+ sscanf(p + 1, "%d", &(tab_noeud[num]->tid) );
+ }
+ }
+}
+
+
+static void raa_calc_taxo_count(raa_node *racine)
+{
+struct raa_pair *paire;
+int count = 0;
+
+paire = racine->list_desc;
+while(paire != NULL) {
+ raa_calc_taxo_count(paire->value);
+ count += paire->value->count;
+ paire = paire->next;
+ }
+racine->count += count;
+}
+
+
+int raa_loadtaxonomy(raa_db_access *raa_current_db, char *rootname,
+ int (*progress_function)(int, void *), void *progress_arg,
+ int (*need_interrupt_f)(void *), void *interrupt_arg)
+/* charge la taxo complete dans raa_current_db->sp_tree et rend 0 ssi OK */
+{
+int totspec, i, maxtid;
+raa_node **tab_noeud;
+struct raa_pair *pair, *pair2;
+char *reponse;
+int count, pourcent, prev_pourcent = 0;
+void *opaque;
+int interrupted;
+
+if(raa_current_db == NULL) return 1;
+if(raa_current_db->sp_tree != NULL) return 0;
+interrupted = FALSE;
+sock_fputs(raa_current_db, "zlibloadtaxonomy\n");
+sock_flush(raa_current_db);
+/* reply:
+<start of compressed data using zlib >
+code=0&total=xx
+rank&pere&count&"...name..."&"...libel..."
+loadtaxonomy END.
+<end of compressed data, back to normal data >
+*/
+opaque = prepare_sock_gz_r( raa_current_db->raa_sockfdr );
+reponse = z_read_sock(opaque);
+if(reponse == NULL || strncmp(reponse, "code=0&total=", 13) != 0) {
+ return 1;
+ }
+totspec = atoi(reponse + 13);
+tab_noeud = (raa_node **)calloc(totspec + 1, sizeof(raa_node *));
+count = 0;
+while(TRUE) {
+ reponse = z_read_sock(opaque);
+ if(strcmp(reponse, "loadtaxonomy END.") == 0) {
+ if(interrupted && (tab_noeud != NULL) ) {
+ for(i = 2; i <= totspec; i++) {
+ if(tab_noeud[i] == NULL) continue;
+ if(tab_noeud[i]->name != NULL) free(tab_noeud[i]->name);
+ if(tab_noeud[i]->libel != NULL) free(tab_noeud[i]->libel);
+ if(tab_noeud[i]->libel_upcase != NULL) free(tab_noeud[i]->libel_upcase);
+ pair = tab_noeud[i]->list_desc;
+ while(pair != NULL) {
+ pair2 = pair->next;
+ free(pair);
+ pair = pair2;
+ }
+ free(tab_noeud[i]);
+ }
+ free(tab_noeud);
+ tab_noeud = NULL;
+ /* just to consume ESC that may have arrived after loadtaxonomy END. */
+ sock_fputs(raa_current_db, "null_command\n");
+ read_sock(raa_current_db);
+ }
+ break;
+ }
+ if(tab_noeud != NULL) raa_decode_desc_arbre(reponse, tab_noeud);
+ pourcent = ((++count) * 100) / totspec;
+ if(pourcent > prev_pourcent) {
+ prev_pourcent = pourcent;
+ if( progress_function != NULL && progress_function(pourcent, progress_arg) ) {
+ if( need_interrupt_f != NULL && (! interrupted) && need_interrupt_f(interrupt_arg) ) {
+ sock_fputs(raa_current_db, "\033" /* esc */);
+ sock_flush(raa_current_db);
+ interrupted = TRUE;
+ }
+ }
+ }
+ }
+close_sock_gz_r(opaque);
+if(tab_noeud != NULL) {
+ redresse_branches(tab_noeud[2]);
+ raa_calc_taxo_count(tab_noeud[2]);
+ free(tab_noeud[2]->name);
+ tab_noeud[2]->name = strdup(rootname);
+ maxtid = 0;
+ for(i = 2; i <= totspec; i++) if(tab_noeud[i] != NULL && tab_noeud[i]->tid > maxtid) maxtid = tab_noeud[i]->tid;
+ raa_current_db->tid_to_rank = (int *)calloc(maxtid + 1, sizeof(int));
+ if(raa_current_db->tid_to_rank != NULL) {
+ raa_current_db->max_tid = maxtid;
+ for(i = 2; i <= totspec; i++) {
+ if(tab_noeud[i] != NULL && tab_noeud[i]->tid != 0) raa_current_db->tid_to_rank[tab_noeud[i]->tid] =
+ tab_noeud[i]->rank;
+ }
+ }
+ raa_current_db->sp_tree = tab_noeud;
+ }
+return (tab_noeud == NULL ? 1 : 0);
+}
+
+
+char *raa_get_taxon_info(raa_db_access *raa_current_db, char *name, int rank, int tid, int *p_rank,
+ int *p_tid, int *p_parent, struct raa_pair **p_desc_list)
+/*
+from a taxon identified by its name or, if name is NULL, by its rank or, if rank is 0, by its taxon ID (tid)
+computes :
+- if p_rank != NULL, the taxon rank in *p_rank
+- if p_tid != NULL, the taxon ID in *p_tid
+- if p_parent != NULL, the taxon's parent rank in *p_parent (2 indicates that taxon is at top level)
+- if p_desc_list != NULL, the start of the linked chain of taxon's descending taxa in *p_desc_list
+returns the taxon name, or NULL if any error
+*/
+{
+int totspec;
+
+if(raa_current_db == NULL) return NULL;
+if(raa_current_db->sp_tree == NULL) raa_loadtaxonomy(raa_current_db, "root", NULL, NULL, NULL, NULL);
+if(raa_current_db->sp_tree == NULL) return NULL;
+totspec = raa_read_first_rec(raa_current_db, raa_spec);
+if(name != NULL) {
+ name = strdup(name);
+ if(name == NULL) return NULL;
+ trim_key(name); majuscules(name);
+ for(rank = 3; rank <= totspec; rank++) {
+ if(raa_current_db->sp_tree[rank] != NULL && strcmp(name, raa_current_db->sp_tree[rank]->name) == 0) break;
+ }
+ free(name);
+ }
+if(name == NULL && rank == 0 && tid >= 1 && tid <= raa_current_db->max_tid) rank = raa_current_db->tid_to_rank[tid];
+if(rank > totspec || rank < 2 || raa_current_db->sp_tree[rank] == NULL) return NULL;
+if(rank != 2) {
+ while(raa_current_db->sp_tree[rank]->parent == NULL) {
+ rank = raa_current_db->sp_tree[rank]->syno->rank;
+ }
+ }
+if(p_rank != NULL) *p_rank = rank;
+if(p_tid != NULL) *p_tid = raa_current_db->sp_tree[rank]->tid;
+if(p_parent != NULL) *p_parent = ( raa_current_db->sp_tree[rank]->parent != NULL ?
+ raa_current_db->sp_tree[rank]->parent->rank : 0);
+if(p_desc_list != NULL) *p_desc_list = raa_current_db->sp_tree[rank]->list_desc;
+return raa_current_db->sp_tree[rank]->name;
+}
+
+
+char *raa_getattributes_both(raa_db_access *raa_current_db, const char *id, int rank,
+ int *prank, int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq)
+/*
+for a sequence identified by name or acc. no. (id != NULL) or by rank
+returns rank, name, accession, length, frame, acnuc genetic code ID,
+one-line description, species, and full sequence.
+return value: NULL if not found or name (in private memory)
+pacc, pdesc, pspecies and pseq point to private memory upon return
+prank, plength, pframe, pgc, pacc, pdesc, pspecies, pseq can be NULL is no such information is needed
+*/
+{
+Reponse *rep;
+char *p, *reponse;
+int err;
+static char mnemo[WIDTH_MAX], species[WIDTH_MAX], access[WIDTH_MAX], descript[WIDTH_MAX];
+
+if(raa_current_db == NULL) return NULL;
+if(id != NULL) sock_printf(raa_current_db, "getattributes&id=%s&seq=%c\n", id, pseq == NULL ? 'F' : 'T');
+else sock_printf(raa_current_db, "getattributes&rank=%d&seq=%c\n", rank, pseq == NULL ? 'F' : 'T');
+reponse = read_sock(raa_current_db);
+if(reponse == NULL) {
+ return NULL;
+ }
+rep=initreponse();
+parse(reponse,rep);
+p=val(rep,"code");
+err = atoi(p);
+free(p);
+if(err == 0) {
+ if(prank != NULL) {
+ p=val(rep,"rank");
+ *prank = atoi(p);
+ free(p);
+ }
+ if(plength != NULL) {
+ p=val(rep,"length");
+ *plength = atoi(p);
+ free(p);
+ }
+ if(pframe != NULL) {
+ p=val(rep,"fr");
+ if(p != NULL) {
+ *pframe = atoi(p);
+ free(p);
+ }
+ else *pframe = 0;
+ }
+ if(pgc != NULL) {
+ p=val(rep,"gc");
+ if(p != NULL) {
+ *pgc = atoi(p);
+ free(p);
+ }
+ else *pgc = 0;
+ }
+ p = val(rep, "name");
+ strcpy(mnemo, p);
+ free(p);
+ if(pacc != NULL) {
+ p = val(rep, "acc");
+ strcpy(access, p);
+ free(p);
+ *pacc = access;
+ }
+ if(pspecies != NULL) {
+ p = val(rep, "spec");
+ strcpy(species, p);
+ free(p);
+ *pspecies = species;
+ p = species;
+ while(*(++p) != 0) *p = tolower(*p);
+ }
+ if(pdesc != NULL) {
+ p = val(rep, "descr");
+ strcpy(descript, p);
+ free(p);
+ *pdesc = descript;
+ }
+ if(pseq != NULL) {
+ *pseq = read_sock(raa_current_db);
+ if(*pseq != NULL) {
+ *pseq += 4; /* seq=xxxx */
+ }
+ }
+ err = 0;
+ }
+clear_reponse(rep);
+return (err ? NULL : mnemo);
+}
+
+
+char *raa_getattributes(raa_db_access *raa_current_db, const char *id,
+ int *prank, int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq)
+{
+ return raa_getattributes_both(raa_current_db, id, 0, prank, plength, pframe, pgc, pacc, pdesc, pspecies, pseq);
+}
+
+
+char *raa_seqrank_attributes(raa_db_access *raa_current_db, int rank,
+ int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq)
+{
+ return raa_getattributes_both(raa_current_db, NULL, rank, NULL, plength, pframe, pgc, pacc, pdesc, pspecies, pseq);
+}
+
+
+
diff --git a/src/Bpp/Raa/RAA_acnuc.h b/src/Bpp/Raa/RAA_acnuc.h
new file mode 100644
index 0000000..30efaa6
--- /dev/null
+++ b/src/Bpp/Raa/RAA_acnuc.h
@@ -0,0 +1,233 @@
+#ifndef RAA_ACNUC_H
+#define RAA_ACNUC_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#if defined(WIN32)
+#define SOCKBUFS 8192
+#include <winsock2.h>
+#endif
+#ifdef __alpha
+typedef long raa_long;
+#define RAA_LONG_FORMAT "%lu"
+#else
+typedef long long raa_long;
+#define RAA_LONG_FORMAT "%llu"
+#endif
+
+#ifndef TRUE
+#define FALSE 0
+#define TRUE (!FALSE)
+#endif
+#ifndef ERREUR
+#define ERREUR 1
+#endif
+
+struct rlng { /* LONGL series of linked records containing lists of SUBSEQ ranks */
+ int next; /* to LONGL for next element of the long list, or 0 when list is finished */
+ int sub[1]; /* array (length given by global SUBINLNG) of ranks of SUBSEQ records or of 0s */
+ };
+
+#define RAA_GFRAG_BSIZE 10000
+struct gfrag_aux {
+ char buffer[RAA_GFRAG_BSIZE + 1];
+ int lbuf, nseq_buf, first_buf, l_nseq_buf;
+ };
+
+struct readsub_aux {
+ char *name;
+ int lname, previous, length, type, toext, lkey, locus, frame, gencode, div;
+ raa_long addr;
+ };
+
+#define ANNOTCOUNT 40
+struct annot_aux {
+ char *annotline[ANNOTCOUNT + 1];
+ int annotcurrent, annotcount, annotdiv;
+ raa_long annotaddr, annotaddrfirst, annotaddrlast;
+ char annotsbuffer[ 300 ];
+ };
+
+struct readsp_kw_aux {
+ char name[150], libel[200];
+ int lsub, desc, syno, host, previous;
+ };
+
+#define BLOCK_ELTS_IN_LIST 500
+struct nextelt_aux {
+ int current_rank, previous, total;
+ int tabnum[BLOCK_ELTS_IN_LIST];
+ char *tabname[BLOCK_ELTS_IN_LIST];
+ int tablength[BLOCK_ELTS_IN_LIST];
+ raa_long taboffset[BLOCK_ELTS_IN_LIST];
+ int tabdiv[BLOCK_ELTS_IN_LIST];
+ };
+
+#define S_BUF_SHRT 5000 /* number of memorized SHORTL records */
+struct readshrt_aux {
+ unsigned shrt_buffer[S_BUF_SHRT][3]; /* [0]=SHORTL_rank [1]=val [2]=next */
+ int shrt_max, shrt_begin, total;
+ };
+
+struct readsmj_aux {
+ int lastrec;
+ char **names, **libels;
+ unsigned *plongs;
+ };
+
+typedef struct raa_node {
+ char *name;
+ char *libel;
+ char *libel_upcase;
+ int rank;
+ int tid;
+ int count;
+ struct raa_node *parent;
+ struct raa_pair *list_desc;
+ struct raa_node *syno;
+ } raa_node;
+struct raa_pair {
+ raa_node *value;
+ struct raa_pair *next;
+ };
+
+typedef struct _raa_db_access {
+ char *dbname;
+ FILE *raa_sockfdr, *raa_sockfdw;
+ int genbank, embl, swissprot, nbrf;
+ int nseq, longa, maxa;
+ int L_MNEMO, WIDTH_SP, WIDTH_KW, WIDTH_SMJ, WIDTH_AUT, WIDTH_BIB, ACC_LENGTH, SUBINLNG, lrtxt;
+ raa_node **sp_tree; /* NULL or the full taxonomy tree */
+ int max_tid; /* largest correct taxon ID value */
+ int *tid_to_rank; /* NULL or tid-to-rank table */
+ struct rlng *rlng_buffer;
+ struct gfrag_aux gfrag_data;
+ struct readsub_aux readsub_data;
+ int first_recs[20];
+ struct annot_aux annot_data;
+ struct readsp_kw_aux readspec_data, readkey_data;
+ struct nextelt_aux nextelt_data;
+ struct readshrt_aux readshrt_data;
+ struct readsmj_aux readsmj_data;
+ void *matchkey_data;
+ /* mostly for raa_query/raa_query_win usage */
+ int tot_key_annots;
+ char **key_annots, **key_annots_min;
+ unsigned char *want_key_annots;
+#ifdef WIN32
+ char sock_input[SOCKBUFS]; /* WIN32 socket input buffer */
+ char *sock_input_pos, *sock_input_end;
+ char sock_output[SOCKBUFS]; /* WIN32 socket output buffer */
+ DWORD sock_output_lbuf;
+#endif
+ } raa_db_access;
+
+#define WIDTH_MAX 150
+
+typedef enum { raa_sub = 0, raa_loc, raa_key, raa_spec, raa_shrt, raa_lng, raa_ext, raa_smj,
+ raa_aut, raa_bib, raa_txt, raa_acc } raa_file;
+typedef void (*raa_char_void_function)(raa_db_access *, char *);
+struct chain_void {
+ void *data;
+ struct chain_void *next;
+ };
+
+/* global variables */
+extern raa_char_void_function raa_error_mess_proc;/*this function sd call raa_acnucclose*/
+
+
+extern int raa_acnucopen (char *clientid, raa_db_access **psock) ;
+extern int raa_decode_address(char *url, char **p_ip_name, int *socket, char **p_remote_db);
+extern int raa_acnucopen_alt (char *serveurName, int port, char *db_name, char *clientid, raa_db_access **psock);
+extern int raa_open_socket(char *serveurName, int port, char *clientid, raa_db_access **psock);
+extern int raa_opendb(raa_db_access *raa_current_db, char *db_name);
+int raa_opendb_pw(raa_db_access *raa_current_db, char *db_name, void *ptr, char *(*getpasswordf)(void *) );
+extern int raa_gfrag(raa_db_access *raa_current_db, int nsub, int first, int lfrag, char *dseq) ;
+extern void raa_acnucclose(raa_db_access *raa_current_db) ;
+extern int raa_prep_acnuc_query(raa_db_access *raa_current_db) ;
+extern int raa_proc_query(raa_db_access *raa_current_db, char *query, char **message, char *nomliste, int *numlist,
+ int *count, int *locus, int *type) ;
+int raa_nexteltinlist(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength) ;
+int raa_nexteltinlist_annots(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength,
+ raa_long *paddr, int *pdiv);
+raa_long scan_raa_long(char *txt);
+int raa_seq_to_annots(raa_db_access *raa_current_db, int numseq, raa_long *faddr, int *div);
+char *print_raa_long(raa_long val);
+char *raa_read_annots(raa_db_access *raa_current_db, raa_long faddr, int div);
+char *raa_next_annots(raa_db_access *raa_current_db, raa_long *faddr);
+char *raa_translate_cds(raa_db_access *raa_current_db, int seqnum);
+char raa_translate_init_codon(raa_db_access *raa_current_db, int numseq);
+int raa_iknum(raa_db_access *raa_current_db, char *name, raa_file cas);
+int raa_isenum(raa_db_access *raa_current_db, char *name);
+int raa_bcount(raa_db_access *raa_current_db, int lrank);
+void raa_bit1(raa_db_access *raa_current_db, int lrank, int num);
+void raa_bit0(raa_db_access *raa_current_db, int lrank, int num);
+int raa_btest(raa_db_access *raa_current_db, int lrank, int num);
+void raa_copylist(raa_db_access *raa_current_db, int from, int to);
+void raa_zerolist(raa_db_access *raa_current_db, int rank);
+void raa_setliststate(raa_db_access *raa_current_db, int lrank, int locus, int type);
+char *raa_getliststate(raa_db_access *raa_current_db, int lrank, int *locus, int *type, int *count);
+char *raa_residuecount(raa_db_access *raa_current_db, int lrank);
+int raa_getemptylist(raa_db_access *raa_current_db, char *name);
+int raa_setlistname(raa_db_access *raa_current_db, int lrank, char *name);
+int raa_getlistrank(raa_db_access *raa_current_db, char *name);
+int raa_releaselist(raa_db_access *raa_current_db, int lrank);
+int raa_countfilles(raa_db_access *raa_current_db, int lrank);
+int raa_alllistranks(raa_db_access *raa_current_db, int **pranks);
+int raa_fcode(raa_db_access *raa_current_db, raa_file cas, char *name);
+int raa_read_first_rec(raa_db_access *raa_current_db, raa_file cas);
+char *raa_readsub(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus,
+ int *pframe, int *pgencode);
+char *raa_readsub_pannots(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus,
+ int *pframe, int *pgencode, raa_long *paddr, int *pdiv);
+char *raa_readloc(raa_db_access *raa_current_db, int num, int *sub, int *pnuc, int *spec, int *host, int *plref,
+ int *molec, int *placc, int *org);
+char *raa_readspec(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *desc, int *syno, int *plhost);
+char *raa_readkey(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *desc, int *syno);
+char *raa_readsmj(raa_db_access *raa_current_db, int num, char **plibel, int *plong);
+char *raa_readacc(raa_db_access *raa_current_db, int num, int *plsub);
+int raa_readext(raa_db_access *raa_current_db, int num, int *mere, int *deb, int *fin);
+int raa_readlng(raa_db_access *raa_current_db, int num);
+unsigned raa_readshrt(raa_db_access *raa_current_db, unsigned point, int *val);
+char *raa_ghelp(raa_db_access *raa_current_db, char *fname, char *topic);
+int raa_nextmatchkey(raa_db_access *raa_current_db, int num, char *pattern, char **matching);
+int raa_savelist(raa_db_access *raa_current_db, int lrank, FILE *out, int use_acc, char *prefix);
+int raa_modifylist(raa_db_access *raa_current_db, int lrank, char *type /* "length" or "date" */, char *operation /* ">2000" */,
+ int *pnewlrank, int (*check_interrupt)(void) , int *p_processed);
+int raa_knowndbs(raa_db_access *raa_current_db, char ***pnames, char ***pdescriptions);
+char *raa_short_descr(raa_db_access *raa_current_db, int seqnum, char *text, int maxlen, raa_long pinf, int div, char *name);
+struct chain_void *raa_get_list_open_dbs(void);
+void *raa_prep_extract(raa_db_access *raa_current_db, char *format, FILE *outstream, char *choix,
+ char *feature_name, char *bornes, char *min_bornes, char **message, int lrank);
+int raa_extract_1_seq(void *opaque);
+int raa_extract_interrupt(raa_db_access *raa_current_db, void *opaque);
+void *raa_prep_coordinates(raa_db_access *raa_current_db, int lrank, int seqnum,
+ char *operation, /* "simple","fragment","feature","region" */
+ char *feature_name, char *bounds, char *min_bounds);
+int *raa_1_coordinate_set(void *);
+int raa_loadtaxonomy(raa_db_access *raa_current_db, char *rootname,
+ int (*progress_function)(int, void *), void *progress_arg,
+ int (*need_interrupt_f)(void *), void *interrupt_arg);
+char *raa_get_taxon_info(raa_db_access *raa_current_db, char *name, int rank, int tid, int *p_rank,
+ int *p_tid, int *p_parent, struct raa_pair **p_desc_list);
+char *raa_getattributes(raa_db_access *raa_current_db, const char *id,
+ int *prank, int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq);
+char *raa_seqrank_attributes(raa_db_access *raa_current_db, int rank,
+ int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq);
+
+int sock_fputs(raa_db_access *raa_current_db, char *line);
+int sock_flush(raa_db_access *raa_current_db);
+char *read_sock(raa_db_access *raa_current_db);
+
+
+int trim_key(char *name); /* remove trailing spaces */
+void majuscules(char *name);
+int atoi_u(const char *p);
+char *protect_quotes(char *name); /* replace " by \" returns in static memory */
+void compact(char *chaine);
+int strcmptrail(char *s1, int l1, char *s2, int l2);
+
+
+#endif /* RAA_ACNUC_H */
diff --git a/src/Bpp/Raa/RaaList.cpp b/src/Bpp/Raa/RaaList.cpp
new file mode 100644
index 0000000..4b4658f
--- /dev/null
+++ b/src/Bpp/Raa/RaaList.cpp
@@ -0,0 +1,119 @@
+
+#include "RAA.h"
+
+using namespace std;
+using namespace bpp;
+
+RaaList::RaaList()
+{
+ myraa = NULL;
+ from = 1;
+}
+
+
+int RaaList::getCount(void)
+{
+ return raa_bcount(myraa->raa_data, rank);
+}
+
+const string RaaList::LIST_SEQUENCES = "sequence list";
+const string RaaList::LIST_KEYWORDS = "keyword list";
+const string RaaList::LIST_SPECIES = "species list";
+
+
+int RaaList::firstElement()
+{
+ from = 1;
+ return nextElement();
+}
+
+
+int RaaList::nextElement()
+{
+ char *sname;
+ int seqrank = raa_nexteltinlist(myraa->raa_data, from, rank, &sname, &elementlength);
+ if(seqrank) {
+ elementname = sname;
+ from = seqrank;
+ }
+ return seqrank;
+}
+
+
+void RaaList::setFrom(int element_rank)
+{
+ from = element_rank;
+}
+
+
+string RaaList::residueCount()
+{
+ char *count = raa_residuecount(myraa->raa_data, rank);
+ string retval(count);
+ return retval;
+}
+
+
+void RaaList::addElement(int elt_rank)
+{
+ raa_bit1(myraa->raa_data, rank, elt_rank);
+}
+
+
+bool RaaList::parentsOnly(void)
+{
+ if(*type == RaaList::LIST_SEQUENCES) return true;
+ int isloc;
+ raa_getliststate(myraa->raa_data, rank, &isloc, NULL, NULL);
+ return (bool)isloc;
+}
+
+
+void RaaList::removeElement(int elt_rank)
+{
+ raa_bit0(myraa->raa_data, rank, elt_rank);
+}
+
+
+void RaaList::zeroList(void)
+{
+ raa_zerolist(myraa->raa_data, rank);
+}
+
+
+bool RaaList::isInList(int elt_rank)
+{
+ return (bool)raa_btest(myraa->raa_data, rank, elt_rank);
+}
+
+
+RaaList *RaaList::modifyByLength(const string &criterion, const string &listname)
+{
+ int err, newlistrank;
+ if(getType() != RaaList::LIST_SEQUENCES) return NULL;
+ err = raa_modifylist(myraa->raa_data, rank, (char *)"length", (char *)criterion.c_str(), &newlistrank, NULL, NULL);
+ if(err) return NULL;
+ raa_setlistname(myraa->raa_data, newlistrank, (char *)listname.c_str());
+ RaaList *list = new RaaList();
+ list->rank = newlistrank;
+ list->myraa = myraa;
+ list->name = listname;
+ list->type = &RaaList::LIST_SEQUENCES;
+ return list;
+}
+
+
+RaaList *RaaList::modifyByDate(const string &criterion, const string &listname)
+{
+ int err, newlistrank;
+ if(getType() != RaaList::LIST_SEQUENCES) return NULL;
+ err = raa_modifylist(myraa->raa_data, rank, (char *)"date", (char *)criterion.c_str(), &newlistrank, NULL, NULL);
+ if(err) return NULL;
+ raa_setlistname(myraa->raa_data, newlistrank, (char *)listname.c_str());
+ RaaList *list = new RaaList();
+ list->rank = newlistrank;
+ list->myraa = myraa;
+ list->name = listname;
+ list->type = &RaaList::LIST_SEQUENCES;
+ return list;
+}
diff --git a/src/Bpp/Raa/RaaList.h b/src/Bpp/Raa/RaaList.h
new file mode 100644
index 0000000..950a7ba
--- /dev/null
+++ b/src/Bpp/Raa/RaaList.h
@@ -0,0 +1,152 @@
+#ifndef _RAALIST_H_
+#define _RAALIST_H_
+#include <string>
+
+namespace bpp {
+
+class RAA;
+
+/**
+ * @brief List of sequences, keywords, or species returned by a database query.
+ *
+ * Instances of this class are created by database queries. Each instance contains
+ * one or several elements that are often sequences, but can also be species or keywords.
+ * Iteration through all elements of the list is possible.
+ */
+class RaaList {
+ friend class RAA;
+ RAA *myraa;
+ int rank;
+ std::string name;
+ const std::string *type;
+ int from;
+ std::string elementname;
+ int elementlength;
+public:
+
+ /**
+ * @brief Refers to a sequence list.
+ */
+ static const std::string LIST_SEQUENCES;
+
+ /**
+ * @brief Refers to a keyword list.
+ */
+ static const std::string LIST_KEYWORDS;
+
+ /**
+ * @brief Refers to a species list.
+ */
+ static const std::string LIST_SPECIES;
+
+ /**
+ * @brief Gives the number of elements (often sequences) in the list.
+ */
+ int getCount();
+
+ /**
+ * @brief Gives the database rank of the first element of the list.
+ */
+ int firstElement();
+
+ /**
+ * @brief Gives the database rank of the list element following the last considered element.
+ */
+ int nextElement();
+
+ /**
+ * @brief Sets an element of the list from which nextElement() will start.
+ *
+ * @param element_rank The database rank of an element of the list, typically returned by
+ * a previous nextElement() call.
+ */
+ void setFrom(int element_rank);
+
+ /**
+ * @brief Gives the name of the last considered list element.
+ */
+ std::string elementName() {return elementname; };
+
+ /**
+ * @brief Gives the length of the last considered list element (meaningful only for sequence lists).
+ */
+ int elementLength() {return elementlength; };
+
+ /**
+ * @brief Returns the total # of residues in all sequences of list (meaningful only for sequence lists).
+ *
+ * Because this count can exceed a long integer, it is returned as a string.
+ */
+ std::string residueCount();
+
+ /**
+ * @brief Adds an element identified by its database rank to the list.
+ */
+ void addElement(int rank);
+
+ /**
+ * @brief Removes an element identified by its database rank from the list.
+ */
+ void removeElement(int rank);
+
+ /**
+ * @brief Tests whether an element identified by its database rank belongs to the list.
+ */
+ bool isInList(int rank);
+
+ /**
+ * @brief Removes all elements from the list.
+ */
+ void zeroList();
+
+ /**
+ * @brief Gives the rank of the list.
+ */
+ int getRank() {return rank; };
+
+ /**
+ * @brief true means that list contains only parent sequences (does not contain any subsequence).
+ */
+ bool parentsOnly();
+
+ /**
+ * @brief Indicates whether the list contains sequences, species or keywords.
+ *
+ * @return can be "sequence list", "species list", or "keyword list"
+ */
+ std::string getType() {return *type; };
+
+ /**
+ * @brief Gives the list name.
+ */
+ std::string getName() {return name; };
+
+ /**
+ * @brief Modifies a sequence list by a length criterion.
+ *
+ * @param criterion Length criterion such as "> 1000" or "<5000".
+ * @param listname Name to be given to created list of sequences matching the length criterion.
+ * @return A new list of sequences matching the length criterion, or NULL if error.
+ */
+ RaaList *modifyByLength(const std::string &criterion, const std::string &listname);
+
+ /**
+ * @brief Modifies a sequence list by a database insertion date criterion.
+ *
+ * The database insertion date of each sequence is that of the last DT record for the embl/swissprot format,
+ * or that of the LOCUS record for the GenBank format.
+ *
+ * @param criterion Date criterion such as "> 1/jun/98" or "<10/DEC/2004". Year can be expressed with 2 or 4 digits.
+ * Case is not significant.
+ * @param listname Name to be given to the created list of sequences matching the date criterion.
+ * @return A new list of sequences matching the date criterion, or NULL if error.
+ */
+ RaaList *modifyByDate(const std::string &criterion, const std::string &listname);
+private:
+ RaaList();
+};
+
+} //end of namespace bpp.
+
+#endif //_RAALIST_H_
+
diff --git a/src/Bpp/Raa/RaaSeqAttributes.h b/src/Bpp/Raa/RaaSeqAttributes.h
new file mode 100644
index 0000000..a81b0d0
--- /dev/null
+++ b/src/Bpp/Raa/RaaSeqAttributes.h
@@ -0,0 +1,77 @@
+#ifndef _RAASEQATTRIBUTES_H_
+#define _RAASEQATTRIBUTES_H_
+
+#include <string>
+
+namespace bpp
+{
+
+
+/**
+ * @brief Contains various attributes of a sequence (length, name, species name, genetic code, etc...).
+ *
+ */
+
+
+class RaaSeqAttributes {
+ friend class RAA;
+public:
+ /**
+ * @brief Returns the sequence name.
+ */
+ std::string getName() {return name; };
+
+ /**
+ * @brief Returns the sequence length.
+ */
+ int getLength() {return length; };
+
+ /**
+ * @brief Returns the sequence database rank.
+ */
+ int getRank() {return rank; };
+
+ /**
+ * @brief Returns the sequence's NCBI genetic code number (1 is universal). Meaningful only for CDS sequences.
+ */
+ int getGeneticCode() {return ncbi_gc; };
+
+ /**
+ * @brief Returns the sequence reading frame (0, 1, or 2). Meaningful only for CDS sequences.
+ */
+ int getReadingFrame() {return frame; };
+
+ /**
+ * @brief Returns the sequence species name.
+ */
+ std::string getSpeciesName() {return species; };
+
+ /**
+ * @brief Returns the sequence primary accession number.
+ */
+ std::string getAccessionNumber() {return accno; };
+
+ /**
+ * @brief Returns a one-line description of the sequence.
+ */
+ std::string getDescription() {return description; };
+protected:
+
+ /**
+ * @brief The database connection of this sequence.
+ */
+ RAA *raa;
+private:
+ std::string name;
+ int rank;
+ int length;
+ int ncbi_gc;
+ int frame;
+ std::string species;
+ std::string accno;
+ std::string description;
+ };
+
+} // namespace bpp
+
+#endif //_RAASEQATTRIBUTES_H_
diff --git a/src/Bpp/Raa/RaaSpeciesTree.cpp b/src/Bpp/Raa/RaaSpeciesTree.cpp
new file mode 100644
index 0000000..99d3333
--- /dev/null
+++ b/src/Bpp/Raa/RaaSpeciesTree.cpp
@@ -0,0 +1,115 @@
+
+#include "RaaSpeciesTree.h"
+#include <string>
+using namespace std;
+using namespace bpp;
+
+string RaaSpeciesTree::getName(int rank)
+{
+ if(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL) {
+ string name(sp_tree[rank]->name);
+ return name;
+ }
+ else {
+ string name("");
+ return name;
+ }
+}
+
+
+int RaaSpeciesTree::parent(int rank)
+{
+ if(!(rank > 2 && rank <= max_sp && sp_tree[rank] != NULL)) return 0;
+ while(sp_tree[rank]->parent == NULL) rank = sp_tree[rank]->syno->rank;
+ return sp_tree[rank]->parent->rank;
+}
+
+
+int RaaSpeciesTree::getTid(int rank)
+{
+ if(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL) return sp_tree[rank]->parent->tid;
+ else return 0;
+}
+
+
+int RaaSpeciesTree::findNode(int tid)
+{
+ if(tid >= 0 && tid <= max_tid) return tid_to_rank[tid];
+ else return 0;
+}
+
+
+int RaaSpeciesTree::findNode(const string &taxon, bool allowsynonym)
+{
+ if(taxon == string("ROOT")) return 2;
+ int num = raa_iknum(raa_data, (char*)taxon.c_str(), raa_spec);
+ if(num != 0 && !allowsynonym) while(sp_tree[num]->parent == NULL) num = sp_tree[num]->syno->rank;
+ return num;
+}
+
+
+int RaaSpeciesTree::count(int rank)
+{
+ if(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL) return sp_tree[rank]->count;
+ else return 0;
+}
+
+
+string RaaSpeciesTree::label(int rank)
+{
+ char *p;
+ if(rank > 2 && rank <= max_sp && sp_tree[rank] != NULL && (p = sp_tree[rank]->libel) != NULL) {
+ string retval(p);
+ return retval;
+ }
+ else {
+ string retval("");
+ return retval;
+ }
+}
+
+
+int RaaSpeciesTree::firstChild(int rank)
+{
+ if(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL) return sp_tree[rank]->list_desc->value->rank;
+ else return 0;
+}
+
+
+int RaaSpeciesTree::nextChild(int rank, int child)
+{
+ if(!(rank >= 2 && rank <= max_sp && child > 2 && child <= max_sp && sp_tree[rank] != NULL &&
+ sp_tree[child] != NULL)) return 0;
+ struct raa_pair *pair = sp_tree[rank]->list_desc;
+ while(pair != NULL && pair->value->rank != child) {
+ pair = pair->next;
+ }
+ return pair == NULL || pair->next == NULL ? 0 : pair->next->value->rank;
+}
+
+
+bool RaaSpeciesTree::isChild(int parent, int child)
+{
+ while(child != parent) {
+ child = this->parent(child);
+ if(child == 0) return false;
+ }
+ return true;
+}
+
+
+int RaaSpeciesTree::nextSynonym(int rank)
+{
+ if(!(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL)) return 0;
+ struct raa_node *mynode = sp_tree[rank]->syno;
+ if(mynode == NULL) return 0;
+ else return mynode->rank;
+}
+
+
+int RaaSpeciesTree::getMajor(int rank)
+{
+ if(!(rank >= 2 && rank <= max_sp && sp_tree[rank] != NULL)) return 0;
+ while(sp_tree[rank]->parent == NULL) rank = sp_tree[rank]->syno->rank;
+ return rank;
+}
diff --git a/src/Bpp/Raa/RaaSpeciesTree.h b/src/Bpp/Raa/RaaSpeciesTree.h
new file mode 100644
index 0000000..a85a2e8
--- /dev/null
+++ b/src/Bpp/Raa/RaaSpeciesTree.h
@@ -0,0 +1,141 @@
+#ifndef _RAASPECIESTREE_H_
+#define _RAASPECIESTREE_H_
+
+extern "C" {
+#include "RAA_acnuc.h"
+}
+
+#include <string>
+
+namespace bpp {
+
+/**
+ * @brief To work with the species tree classification of the database.
+ *
+ * The tree can be walked up or down starting from a string, a database species rank,
+ * or an NCBI taxonID (TID) value. The species tree also contains synonymous names.
+ * The root of the tree is named "ROOT" and has database rank 2.
+ */
+
+
+class RaaSpeciesTree {
+ friend class RAA;
+public:
+
+ /**
+ * @brief Returns the database rank of a taxon identified by its name.
+ *
+ * @param taxon A taxon name. Case is not significant.
+ * @param allowsynonym If true, the return value will give the synonym's rank rather than the rank of its
+ * major taxon.
+ * @return The database rank of this taxon, or 0 if no such taxon exists in tree.
+ */
+ int findNode(const std::string &taxon, bool allowsynonym = false);
+
+ /**
+ * @brief Returns the database rank of a taxon identified by a TID.
+ *
+ * @param tid A TID value.
+ * @return The database rank of this taxon, or 0 if no such taxon exists in tree.
+ */
+ int findNode(int tid);
+
+ /**
+ * @brief Returns the name of a taxon identified by its database rank.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The name of this taxon.
+ */
+ std::string getName(int rank);
+
+ /**
+ * @brief Returns the database rank of the parent of a taxon in the tree.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The database rank of the parent of this taxon in the tree, or 0 if no such taxon exists in tree.
+ */
+ int parent(int rank);
+
+ /**
+ * @brief Returns the TID of a taxon.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The TID of this taxon, or 0 if no such taxon exists in tree.
+ */
+ int getTid(int rank);
+
+ /**
+ * @brief Returns the number of sequences attached to a taxon or to taxa below it in the species tree.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The number of sequences attached to this taxon or to taxa below it, or 0 if no such taxon exists in tree.
+ */
+ int count(int rank);
+
+ /**
+ * @brief Returns the label of a taxon of given rank.
+ *
+ * Labels may contain taxon common names, genetic code information, TID values, and taxonomic
+ * level information (e.g., genus, order).
+ * @param rank The database rank of a taxon.
+ * @return The label of this taxon, or "" if no such taxon or label exists in tree.
+ */
+ std::string label(int rank);
+
+ /**
+ * @brief Returns the rank of the first child taxon of a given taxon.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The rank of its first child taxon, or 0 if no child taxon exists in tree.
+ */
+ int firstChild(int rank);
+
+ /**
+ * @brief Allows to loop around all child taxa of a given taxon.
+ *
+ * @param parent The database rank of a taxon.
+ * @param child The database rank of a child of taxon of rank parent.
+ * @return The rank of the next child taxon of parent after taxon child, or 0 if no more child taxon exists in tree.
+ */
+ int nextChild(int parent, int child);
+
+ /**
+ * @brief Tells whether there is a downward path from taxon parent to taxon child in the species tree.
+ *
+ * @param parent The database rank of a taxon.
+ * @param child The database rank of another taxon.
+ * @return true iff child is below parent (possibly with intermediate nodes) in the species tree.
+ */
+ bool isChild(int parent, int child);
+
+ /**
+ * @brief Allows to loop around all synonymous taxa of a given taxon.
+ *
+ * Synonymous taxa of a taxon are chained in a closed loop, among which only one, the major taxon,
+ * has a parent taxon.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The rank of the next synonymous taxon, or 0 if taxon rank has no synonymous taxon.
+ */
+ int nextSynonym(int rank);
+
+ /**
+ * @brief Gives the major taxon among all synonyms of a given taxon.
+ *
+ * @param rank The database rank of a taxon.
+ * @return The rank of the major taxon of taxon rank (can be itself).
+ */
+ int getMajor(int rank);
+
+private:
+ raa_db_access *raa_data;
+ raa_node **sp_tree;
+ int *tid_to_rank;
+ int max_tid;
+ int max_sp;
+};
+
+} //namespace bpp.
+
+#endif // _RAASPECIESTREE_H_
+
diff --git a/src/Bpp/Raa/md5.c b/src/Bpp/Raa/md5.c
new file mode 100644
index 0000000..f98774c
--- /dev/null
+++ b/src/Bpp/Raa/md5.c
@@ -0,0 +1,310 @@
+/*
+ * $Id: md5.c,v 1.1.1.1 2009-06-24 14:37:29 jdutheil Exp $
+ *
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * MD5Context structure, pass it to MD5_Init, call MD5_Update as
+ * needed on buffers full of bytes, and then call MD5_Final, which
+ * will fill a supplied 16-byte array with the digest.
+ *
+ * Modified 12 June 2003 Jeremy Katz <katzj at redhat.com> to handle
+ * endianness better
+ *
+ */
+// taken from DEBIAN package isomd5sum
+#include <string.h>
+#include <stdio.h>
+#ifdef WIN32
+#define IS_BIG_ENDIAN 0
+#else
+#include <sys/types.h>
+#if !(defined(_BIG_ENDIAN) || defined(BIG_ENDIAN))
+#define IS_BIG_ENDIAN 0
+#else
+#define IS_BIG_ENDIAN 1
+#endif
+#endif
+
+
+typedef unsigned int uint32;
+
+struct MD5Context {
+ uint32 buf[4];
+ uint32 bits[2];
+ unsigned char in[64];
+ int doByteReverse;
+};
+
+static void MD5_Transform(uint32 *buf, uint32 const *in);
+
+static void byteReverse(unsigned char *buf, unsigned longs);
+
+#ifndef ASM_MD5
+/*
+ * Note: this code is harmless on little-endian machines.
+ */
+static void byteReverse(unsigned char *buf, unsigned longs)
+{
+ uint32 t;
+ do {
+ t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+ ((unsigned) buf[1] << 8 | buf[0]);
+ *(uint32 *) buf = t;
+ buf += 4;
+ } while (--longs);
+}
+#endif
+
+/*
+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
+ * initialization constants.
+ */
+static void MD5_Init(struct MD5Context *ctx)
+{
+ ctx->buf[0] = 0x67452301U;
+ ctx->buf[1] = 0xefcdab89U;
+ ctx->buf[2] = 0x98badcfeU;
+ ctx->buf[3] = 0x10325476U;
+
+ ctx->bits[0] = 0;
+ ctx->bits[1] = 0;
+
+
+ if (IS_BIG_ENDIAN)
+ ctx->doByteReverse = 1;
+ else
+ ctx->doByteReverse = 0;
+}
+
+/*
+ * Update context to reflect the concatenation of another buffer full
+ * of bytes.
+ */
+static void MD5_Update(struct MD5Context *ctx, unsigned const char *buf, unsigned len)
+{
+ uint32 t;
+
+ /* Update bitcount */
+
+ t = ctx->bits[0];
+ if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
+ ctx->bits[1]++; /* Carry from low to high */
+ ctx->bits[1] += len >> 29;
+
+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
+
+ /* Handle any leading odd-sized chunks */
+
+ if (t) {
+ unsigned char *p = (unsigned char *) ctx->in + t;
+
+ t = 64 - t;
+ if (len < t) {
+ memcpy(p, buf, len);
+ return;
+ }
+ memcpy(p, buf, t);
+ if (ctx->doByteReverse) byteReverse(ctx->in, 16);
+ MD5_Transform(ctx->buf, (uint32 *) ctx->in);
+ buf += t;
+ len -= t;
+ }
+ /* Process data in 64-byte chunks */
+
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ if (ctx->doByteReverse) byteReverse(ctx->in, 16);
+ MD5_Transform(ctx->buf, (uint32 *) ctx->in);
+ buf += 64;
+ len -= 64;
+ }
+
+ /* Handle any remaining bytes of data. */
+
+ memcpy(ctx->in, buf, len);
+}
+
+/*
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
+ * 1 0* (64-bit count of bits processed, MSB-first)
+ */
+static void MD5_Final(unsigned char digest[16], struct MD5Context *ctx)
+{
+ unsigned count;
+ unsigned char *p;
+
+ /* Compute number of bytes mod 64 */
+ count = (ctx->bits[0] >> 3) & 0x3F;
+
+ /* Set the first char of padding to 0x80. This is safe since there is
+ always at least one byte free */
+ p = ctx->in + count;
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 64 bytes */
+ count = 64 - 1 - count;
+
+ /* Pad out to 56 mod 64 */
+ if (count < 8) {
+ /* Two lots of padding: Pad the first block to 64 bytes */
+ memset(p, 0, count);
+ if (ctx->doByteReverse) byteReverse(ctx->in, 16);
+ MD5_Transform(ctx->buf, (uint32 *) ctx->in);
+
+ /* Now fill the next block with 56 bytes */
+ memset(ctx->in, 0, 56);
+ } else {
+ /* Pad block to 56 bytes */
+ memset(p, 0, count - 8);
+ }
+ if (ctx->doByteReverse) byteReverse(ctx->in, 14);
+
+ /* Append length in bits and transform */
+ ((uint32 *) ctx->in)[14] = ctx->bits[0];
+ ((uint32 *) ctx->in)[15] = ctx->bits[1];
+
+ MD5_Transform(ctx->buf, (uint32 *) ctx->in);
+ if (ctx->doByteReverse) byteReverse((unsigned char *) ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+}
+
+#ifndef ASM_MD5
+
+/* The four core functions - F1 is optimized somewhat */
+
+/* #define F1(x, y, z) (x & y | ~x & z) */
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
+
+/* This is the central step in the MD5 algorithm. */
+#define MD5STEP(f, w, x, y, z, data, s) \
+ ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
+
+/*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
+ * reflect the addition of 16 longwords of new data. MD5_Update blocks
+ * the data and converts bytes into longwords for this routine.
+ */
+static void MD5_Transform(uint32 buf[4], uint32 const in[16])
+{
+ register uint32 a, b, c, d;
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478U, 7);
+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756U, 12);
+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070dbU, 17);
+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceeeU, 22);
+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0fafU, 7);
+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62aU, 12);
+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613U, 17);
+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501U, 22);
+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8U, 7);
+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7afU, 12);
+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1U, 17);
+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7beU, 22);
+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122U, 7);
+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193U, 12);
+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438eU, 17);
+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821U, 22);
+
+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562U, 5);
+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340U, 9);
+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51U, 14);
+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aaU, 20);
+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105dU, 5);
+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453U, 9);
+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681U, 14);
+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8U, 20);
+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6U, 5);
+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6U, 9);
+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87U, 14);
+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14edU, 20);
+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905U, 5);
+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8U, 9);
+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9U, 14);
+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8aU, 20);
+
+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942U, 4);
+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681U, 11);
+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122U, 16);
+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380cU, 23);
+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44U, 4);
+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9U, 11);
+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60U, 16);
+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70U, 23);
+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6U, 4);
+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127faU, 11);
+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085U, 16);
+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05U, 23);
+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039U, 4);
+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5U, 11);
+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8U, 16);
+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665U, 23);
+
+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244U, 6);
+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97U, 10);
+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7U, 15);
+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039U, 21);
+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3U, 6);
+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92U, 10);
+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47dU, 15);
+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1U, 21);
+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4fU, 6);
+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0U, 10);
+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314U, 15);
+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1U, 21);
+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82U, 6);
+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235U, 10);
+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bbU, 15);
+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391U, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
+}
+
+#endif
+
+
+/* function for very simple interface */
+void raa_MD5String (char *in_string, char out_digest[33])
+/*
+in_string: string to be MD5-digested
+out_digest: resulting digest as 32 hexadecimal digits plus final NULL
+*/
+{
+ struct MD5Context context;
+ unsigned int len = strlen (in_string);
+ char *p;
+ int i;
+ unsigned char digest[16];
+
+ MD5_Init (&context);
+ MD5_Update (&context, (unsigned const char *)in_string, len);
+ MD5_Final (digest, &context);
+
+ p = out_digest;
+ for (i = 0; i < 16; i++) {
+ sprintf (p, "%02x", digest[i]);
+ p += 2;
+ }
+
+ memset(&context, 0, sizeof(struct MD5Context));
+}
diff --git a/src/Bpp/Raa/misc_acnuc.c b/src/Bpp/Raa/misc_acnuc.c
new file mode 100644
index 0000000..0c1d802
--- /dev/null
+++ b/src/Bpp/Raa/misc_acnuc.c
@@ -0,0 +1,754 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#if defined(WIN32)
+#include <Windows.h>
+#elif defined(unix) || defined(__APPLE__)
+#define unixlike
+#include <termios.h>
+#endif
+
+
+/* included functions */
+int trim_key(char* name); /* remove trailing spaces */
+void padtosize(char* pname, char* name, int length);
+char* get_code_descr(int code);
+int calc_codon_number(char* codon);
+char codaa(char* codon, int code);
+int get_ncbi_gc_number(int gc);
+int get_acnuc_gc_number(int ncbi_gc);
+int strcmptrail(char *s1, int l1, char *s2, int l2);
+void majuscules(char *name);
+void compact(char *chaine);
+char complementer_base(char nucl);
+void complementer_seq(char* deb_ch, int l);
+char init_codon_to_aa(char* codon, int gc);
+int notrail2(char* chaine, int len);
+int prepch(char* chaine, char** posmot);
+int compch(char* cible, int lcible, char** posmot, int nbrmots);
+int chg_acnuc(char* acnucvar, char* gcgacnucvar);
+void gets_no_echo(char* password, size_t lpw);
+
+
+int trim_key(char* name) /* remove trailing spaces */
+{
+ char* p;
+ int l = strlen(name);
+ p = name + l - 1;
+ while (p >= name && *p == ' ')
+ *(p--) = 0;
+ return (p + 1) - name;
+}
+
+
+void padtosize(char* pname, char* name, int length)
+{
+ int i;
+ strncpy(pname, name, length);
+ pname[length] = 0;
+ for (i = strlen(pname); i < length; i++)
+ {
+ pname[i] = ' ';
+ }
+}
+
+
+#define TOTCODES 18 /* nbre total de codes definis, 0 inclus */
+int totcodes = TOTCODES;
+
+char aminoacids[] = "RLSTPAGVKNQHEDYCFIMW*X";
+
+struct genetic_code_libel /* definition d'un code genetique */
+{char libel[61]; /* nom du code decrivant ses variants % code standard */
+ int code[65]; /* tableau codon->acide amine */
+ int ncbi_gc; /* numero NCBI du meme code */
+ int codon_init[64]; /* tableau codon initiateur -> acide amine */
+};
+
+/*
+ les codons sont numerotes de 1 a 64 selon ordre alphabetique;
+ le numero 65 est attribue a tout codon avec base hors AcCcGgTtUu
+ les acides amines sont numerotes selon l'ordre de la variable aminoacids
+ de un a 20 + * pour stop et X pour inconnu
+ */
+
+/* initialisation de tous les codes genetiques */
+struct genetic_code_libel genetic_code[TOTCODES] =
+{
+ { /* 0: universel */
+ {"Universal genetic code"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 21, 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+/*ncbi*/ 1,
+/*init*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* CUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0} /* UUG */
+ }
+ ,
+ { /* 1: yeast mt */
+ {"CUN=T AUA=M UGA=W"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 19, 18, 19, 18,
+ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 4, 4, 4, 4,
+ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 21, 15, 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 3,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 19, 0, /* AUA, AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 2: : MITOCHONDRIAL CODE OF VERTEBRATES */
+ {"AGR=* AUA=M UGA=W"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 21, 3, 21, 3, 19, 18, 19, 18, 11, 12, 11, 12,
+ 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 21, 15,
+ 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 2,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, /* AUN */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 3: MITOCHONDRIAL CODE OF FILAMENTOUS FUNGI */
+ {"UGA=W"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18, 11, 12, 11, 12, 5, 5, 5,
+ 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 21, 15, 21,
+ 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 4,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, /* AUN */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* CUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 19, 0} /* UUR */
+ }
+ ,
+ { /* 4: MITOCHONDRIAL CODE OF INSECT AND PLATYHELMINTHES */
+ {"AUA=M UGA=W AGR=S"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 3, 3, 3, 3, 19, 18, 19, 18, 11, 12, 11, 12, 5, 5, 5,
+ 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 21, 15, 21,
+ 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 5,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, /* AUN */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0} /* UUG */
+ }
+ ,
+ { /* 5: Nuclear code of Candida cylindracea (see nature 341:164) */
+ {"CUG=S"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 3, 2,
+ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 21, 15, 21, 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+ 12,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* CUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 6: NUCLEAR CODE OF CILIATA: UAR = Gln = Q */
+ {"UAR=Q"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18, 11, 12, 11, 12, 5, 5, 5,
+ 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 11, 15, 11,
+ 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+ 6,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 7: NUCLEAR CODE OF EUPLOTES */
+ {"UGA=C"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18, 11, 12, 11, 12, 5, 5, 5,
+ 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 21, 15, 21,
+ 15, 3, 3, 3, 3, 16, 16, 20, 16, 2, 17, 2, 17, 22},
+ 10,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 8: MITOCHONDRIAL CODE OF ECHINODERMS */
+ {"UGA=W AGR=S AAA=N"},
+ {10, 10, 9, 10, 4, 4, 4, 4, 3, 3, 3, 3, 18, 18, 19, 18,
+ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 21, 15, 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 9,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 9: MITOCHONDRIAL CODE OF ASCIDIACEA */
+ {"UGA=W AGR=G AUA=M"},
+ {9, 10, 9, 10, 4, 4, 4, 4, 7, 3, 7, 3, 19, 18, 19, 18,
+ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 21, 15, 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 13,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 10: MITOCHONDRIAL CODE OF PLATYHELMINTHES */
+ {"UGA=W AGR=S UAA=Y AAA=N"},
+ {10, 10, 9, 10, 4, 4, 4, 4, 3, 3, 3, 3, 18, 18, 19, 18,
+ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 15, 15, 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 14,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 11: NUCLEAR CODE OF BLEPHARISMA */
+ {"UAG=Q"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 11, 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+ 15,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 12: NUCLEAR CODE OF BACTERIA: differs only for initiation codons */
+ {"NUG=AUN=M when initiation codon"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 21, 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+ 11,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, /* AUN */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* CUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0} /* UUG */
+ }
+ ,
+ { /* 13: Chlorophycean Mitochondrial */
+ {"UAG=Leu"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 2, 15, 3, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+/*ncbi*/ 16,
+/*init*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 14: MITOCHONDRIAL CODE OF TREMATODE */
+ {"AUA=M UGA=W AGR=S AAA=N"},
+ {10, 10, 9, 10, 4, 4, 4, 4, 3, 3, 3, 3, 19, 18, 19, 18, 11, 12, 11, 12, 5, 5, 5,
+ 5, 1, 1, 1, 1, 2, 2, 2, 2, 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 21, 15, 21,
+ 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+ 21,
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 15: TAG-Leu,TCA-stop */
+ {"UAG=L UCA=*"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 2, 15, 21, 3, 3, 3, 21, 16, 20, 16, 2, 17, 2, 17, 22},
+/*ncbi*/ 22,
+/*init*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 16: Thraustochytrium-mt */
+ {"UUA=*"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 1, 3, 1, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 21, 15, 3, 3, 3, 3, 21, 16, 20, 16, 21, 17, 2, 17, 22},
+/*ncbi*/ 23,
+/*init*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, /* AUG AUU */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* GUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ }
+ ,
+ { /* 17: MITOCHONDRIAL CODE OF Pterobranchia */
+ {"UGA=W AGA=S AGG=K"},
+/*ANN*/ {9, 10, 9, 10, 4, 4, 4, 4, 3, 3, 9, 3, 18, 18, 19, 18,
+/*CNN*/ 11, 12, 11, 12, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 2,
+/*GNN*/ 13, 14, 13, 14, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+/*TNN*/ 21, 15, 21, 15, 3, 3, 3, 3, 20, 16, 20, 16, 2, 17, 2, 17, 22},
+/*ncbi*/ 24,
+/*init*/ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* AUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, /* CUG */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0} /* UUG */
+ }
+
+
+/* 1 2
+ 1234567890123456789012
+ RLSTPAGVKNQHEDYCFIMW*X
+ */
+};
+
+
+char* get_code_descr(int code)
+/*
+ get a 60-letter (or less) description of a variant genetic code
+ return value pointer to the description, not to be altered!
+ */
+{
+ if (code >= 0 && code < totcodes)
+ return genetic_code[code].libel;
+ else
+ return "Unknown genetic code. Standard code is used.";
+}
+
+
+int calc_codon_number(char* codon)
+{
+ static char nucleotides[] = "AaCcGgTtUu";
+ static int nucnum[5] = {0, 1, 2, 3, 3};
+ int num, i, base;
+ char* p;
+
+ num = 0;
+ for (i = 1; i <= 3; i++)
+ {
+ p = strchr(nucleotides, *codon);
+ if (p == NULL)
+ {
+ num = 64;
+ break;
+ }
+ else
+ base = (p - nucleotides) / 2;
+ num = num * 4 + nucnum[base];
+ codon++;
+ }
+ return num;
+}
+
+
+char codaa(char* codon, int code)
+/*
+ amino acid translation:
+ codon a 3-base string
+ code the genetic code to be used
+ return value the amino acid as 1 character
+ */
+{
+ struct genetic_code_libel* pdata;
+ int num;
+
+ num = calc_codon_number(codon);
+ if (code < 0 || code >= totcodes)
+ code = 0; /*use regular code if unknown number */
+ pdata = &genetic_code[code]; /* ici ecriture plus compacte mal compilee sur PC*/
+ return aminoacids[ pdata->code[num] - 1 ];
+}
+
+
+int get_ncbi_gc_number(int gc)
+{ /* from acnuc to ncbi genetic code number */
+ return genetic_code[gc].ncbi_gc;
+}
+
+
+int get_acnuc_gc_number(int ncbi_gc)
+{ /* from ncbi to acnuc genetic code number (returns 0 if not found) */
+ int num;
+
+ for (num = 0; num < totcodes; num++)
+ {
+ if (genetic_code[num].ncbi_gc == ncbi_gc)
+ return num;
+ }
+ return 0;
+}
+
+
+int strcmptrail(char* s1, int l1, char* s2, int l2)
+/*
+ compare strings s1 and s2 of length l1 and l2 as done by strcmp
+ but ignores all trailing spaces
+ */
+{
+ char* fin;
+ int l, flag = 1;
+
+ if (l1 > 0)
+ {
+ if ( (fin = (char*)memchr(s1, 0, l1) ) != NULL)
+ l1 = fin - s1;
+ }
+ if (l2 > 0)
+ {
+ if ( (fin = (char*)memchr(s2, 0, l2) ) != NULL)
+ l2 = fin - s2;
+ }
+
+ if (l2 > l1)
+ {
+ flag = -1;
+ fin = s1; s1 = s2; s2 = fin;
+ l = l1; l1 = l2; l2 = l;
+ }
+ l = l2;
+ fin = s2 + l;
+ while (s2 < fin)
+ {
+ if (*s1 != *s2)
+ return (*s1 - *s2) * flag;
+ s1++; s2++;
+ }
+ fin = s1 + l1 - l2;
+ while (s1 < fin)
+ {
+ if (*s1 != ' ')
+ return flag;
+ s1++;
+ }
+ return 0;
+}
+
+
+void majuscules(char* name)
+{
+ name--;
+ while (*(++name) != 0)
+ *name = toupper(*name);
+}
+
+
+void compact(char* chaine)
+{
+ int l;
+ char* p, * q;
+
+ l = strlen(chaine); p = chaine + l;
+ while (*(--p) == ' ' && p >= chaine)
+ *p = 0;
+ while ((p = strchr(chaine, ' ')) != NULL)
+ {
+ q = p + 1;
+ while (*q == ' ')
+ q++;
+ l = q - p;
+ while (*q != 0)
+ {
+ *(q - l) = *q; q++;
+ }
+ *(q - l) = 0;
+ }
+}
+
+
+char complementer_base(char nucl)
+{
+ switch (nucl)
+ {
+ case 'a':
+ case 'A': return 't';
+
+ case 'c':
+ case 'C': return 'g';
+
+ case 'g':
+ case 'G': return 'c';
+
+ case 'u':
+ case 'U':
+ case 't':
+ case 'T': return 'a';
+
+ case 'r':
+ case 'R': return 'y';
+
+ case 'y':
+ case 'Y': return 'r';
+
+ default: return 'n';
+ }
+}
+
+
+/* ~~~~~~~~~~~~ retourne le complementaire d'une sequence ~~~~~~~~~~~
+ * recoit l'adresse du debut d'un tableau de caractere et sa longueur
+ * inverse et complemente cette sequence
+ * prend en compte si c'est un adn ou un arn
+ * -------------------------------------------------------------------- */
+void complementer_seq(char* deb_ch, int l)
+{
+ int ii = 0;
+ char compl1, compl2;
+
+ for (ii = 0; ii <= (l - 1) / 2; ii++)
+ {
+ compl1 = complementer_base(*(deb_ch + ii));
+
+ compl2 = complementer_base(*(deb_ch + l - ii - 1));
+
+ *(deb_ch + ii) = compl2;
+ *(deb_ch + l - ii - 1) = compl1;
+ }
+}
+
+
+char init_codon_to_aa(char* codon, int gc)
+{
+ int num, aa;
+ struct genetic_code_libel* pdata;
+
+ num = calc_codon_number(codon);
+ if (num >= 64)
+ return 'X';
+/* use regular code if unknown number */
+ if (gc < 0 || gc >= totcodes)
+ gc = 0;
+ pdata = &genetic_code[gc];
+ aa = pdata->codon_init[num];
+/* if not listed in expected init codons */
+ if (aa == 0)
+ aa = pdata->code[num];
+ return aminoacids[aa - 1];
+}
+
+
+int notrail2(char* chaine, int len)
+{
+ len--;
+ while (len >= 0 && chaine[len] == ' ')
+ len--;
+ return len + 1;
+}
+
+
+int prepch(char* chaine, char** posmot)
+{
+/*
+ chaine: template a rechercher qui contient des wildcard @
+ posmot: tableau de pointeurs vers char au retour rempli avec des pointeurs adequats qui pointent dans chaine qui ne doit plus etre modifiee
+ valeur rendue: nbre de pointeurs dans tableau posmot
+ */
+ char* pos;
+ int nbrmots;
+ static char wildcard = '@';
+
+ if (strchr(chaine, '@') == NULL)
+ return 0;
+ nbrmots = -1;
+ pos = chaine + strlen(chaine) - 1;
+ while (pos >= chaine && *pos == ' ')
+ pos--;
+ *(pos + 1) = 0;
+
+ pos = chaine;
+ while (*pos != 0)
+ {
+ if (*pos == wildcard)
+ {
+ posmot[++nbrmots] = NULL;
+ *pos = 0;
+ while (*(pos + 1) == wildcard)
+ pos++;
+ }
+ else
+ {
+ posmot[++nbrmots] = pos;
+ while (*(pos + 1) != wildcard && *(pos + 1) != 0)
+ pos++;
+ }
+ pos++;
+ }
+ return nbrmots + 1;
+}
+
+
+int compch(char* cible, int lcible, char** posmot, int nbrmots)
+{
+/*
+ cible: chaine a tester pour presence du template
+ lcible: long. de cible qui n'est pas forcement finie par \0
+ doit etre <= 150
+ posmot: tableau fabrique par prepch
+ nbrmots: valeur rendue par prepch
+ valeur rendue: 1 ssi template present dans cible, 0 si absent
+ */
+ int num = 0, l, total;
+ char* pos;
+ static char vcible[151];
+
+ pos = cible + lcible - 1;
+ while (pos >= cible && *pos == ' ')
+ pos--;
+ lcible = pos - cible + 1;
+ memcpy(vcible, cible, lcible);
+ vcible[lcible] = 0;
+ cible = vcible;
+ if (posmot[nbrmots - 1] == NULL)
+ total = nbrmots - 1;
+ else
+ total = nbrmots - 2;
+
+ if (posmot[0] != NULL) /* comparaison avec mot initial */
+ {
+ l = strlen(posmot[0]);
+ if (strncmp(cible, posmot[0], l) != 0)
+ return 0;
+ cible += l;
+ num++;
+ }
+ while (num < total) /* recherche des mots internes */
+ {
+ num++;
+ pos = strstr(cible, posmot[num]);
+ if (pos == NULL)
+ return 0;
+ l = strlen(posmot[num]);
+ cible = pos + l;
+ num++;
+ }
+ if (total == nbrmots - 1)
+ return 1; /* template se termine par @ */
+/* test si cible se termine par dernier mot du template */
+ l = strlen(posmot[nbrmots - 1]);
+ if (strcmp(vcible + lcible - l, posmot[nbrmots - 1]) == 0)
+ return 1;
+ return 0;
+}
+
+
+int chg_acnuc(char* acnucvar, char* gcgacnucvar)
+/*
+ Changing the values of variables acnuc and gcgacnuc :
+ acnucvar the new value of acnuc (may be a variable, may be acnuc itself)
+ gcgacnucvar the new value of gcgacnuc (may be a variable,
+ may be gcgacnuc itself)
+ returns TRUE if error, FALSE if ok
+ */
+{
+ static char newacnuc[200], newgcgacnuc[200];
+ char* point;
+
+ if (strcmp(acnucvar, "acnuc") != 0)
+ {
+ point = getenv(acnucvar);
+ if (point != NULL)
+ acnucvar = point;
+ strcpy(newacnuc, "acnuc=");
+ strcat(newacnuc, acnucvar);
+ if (putenv(newacnuc) )
+ return 1;
+ }
+
+ if (strcmp(gcgacnucvar, "gcgacnuc") != 0)
+ {
+ point = getenv(gcgacnucvar);
+ if (point != NULL)
+ gcgacnucvar = point;
+ strcpy(newgcgacnuc, "gcgacnuc=");
+ strcat(newgcgacnuc, gcgacnucvar);
+ if (putenv(newgcgacnuc) )
+ return 1;
+ }
+ return 0;
+}
+
+
+void gets_no_echo(char* password, size_t lpw)
+{
+ char* p, c;
+#ifdef unixlike
+ struct termios initialrsettings, newrsettings;
+ int err;
+#elif defined(WIN32)
+ DWORD mode, savemode, lu;
+ HANDLE hconsole;
+ int err;
+#endif
+
+#ifdef unixlike
+ err = tcgetattr( fileno(stdin), &initialrsettings );
+ if (err == 0)
+ {
+ newrsettings = initialrsettings;
+ newrsettings.c_lflag &= ~ECHO;
+ newrsettings.c_lflag &= ~ICANON;
+ tcsetattr( fileno(stdin), TCSAFLUSH, &newrsettings );
+ }
+#elif defined(WIN32)
+ hconsole = GetStdHandle(STD_INPUT_HANDLE);
+ err = GetConsoleMode(hconsole, &savemode);
+ if (err != 0)
+ {
+ mode = savemode;
+ mode &= ~ENABLE_ECHO_INPUT;
+ mode &= ~ENABLE_LINE_INPUT;
+ SetConsoleMode(hconsole, mode);
+ FlushConsoleInputBuffer(hconsole); /* necessary */
+ }
+#endif
+ p = password;
+ do
+ {
+#ifdef WIN32
+ ReadConsole(hconsole, &c, 1, &lu, NULL);
+#else
+ c = getchar();
+#endif
+ if (c == EOF || c == '\n' || c == '\r')
+ break;
+ if (c != '\b' && c != '\x7F')
+ {
+ *(p++) = c;
+ putchar('*');
+ }
+ else
+ {
+ if (p > password)
+ {
+ p--;
+ putchar('\b'); putchar(' '); putchar('\b');
+ }
+ }
+ }
+ while (p - password < lpw);
+ *p = 0;
+#ifdef unixlike
+ if (err == 0)
+ {
+ tcsetattr( fileno(stdin), TCSANOW, &initialrsettings );
+ putchar('\n');
+ }
+#elif defined(WIN32)
+ if (err != 0)
+ {
+ SetConsoleMode(hconsole, savemode);
+ putchar('\n');
+ }
+#endif
+ return;
+}
+
+
diff --git a/src/Bpp/Raa/parser.c b/src/Bpp/Raa/parser.c
new file mode 100644
index 0000000..39376be
--- /dev/null
+++ b/src/Bpp/Raa/parser.c
@@ -0,0 +1,114 @@
+#include "parser.h"
+
+char *unprotect_quotes(char *name);
+
+
+
+/** initialisation d'une r�ponse **/
+Reponse * initreponse(void) {
+ Reponse *rep;
+ rep = (Reponse *) malloc (sizeof(Reponse));
+ rep->nbarguments = 0;
+ rep->arg = NULL;
+ return rep;
+}
+
+
+void clear_reponse(Reponse * rep) {
+ int pti;
+
+ for(pti=0; pti < rep->nbarguments; pti++) {
+ free(rep->arg[pti]);
+ }
+ if(rep->arg != NULL) free(rep->arg);
+ free(rep);
+}
+
+
+void ajout_reponse(Reponse *rep, char *pile, int len) {
+ int pti;
+
+ if (rep->nbarguments==0)
+ rep->arg = (char **)malloc(1 * sizeof(char *));
+ else
+ rep->arg= (char**) realloc(rep->arg,(rep->nbarguments+1)* sizeof(char *)) ; /* ici j'ai deja alloue donc realloc (plus de ligne) */
+
+ rep->arg[rep->nbarguments]=(char *) malloc(len + 1); /* j'alloue l'espace pour l'argument */
+
+ pti=rep->nbarguments;
+ memcpy(rep->arg[pti], pile, len); /* je stocke l'argument */
+ rep->arg[pti][len] = 0;
+
+ rep->nbarguments++;
+
+ }
+
+
+
+
+/** le parseur qui rempli la structure Reponse **/
+void parse(char *chaine, Reponse *rep) {
+char *ori;
+
+ori=chaine;
+while(*chaine != 0) {
+ if (*chaine == '"' ) {
+ do { /* chercher le prochain " en ignorant les \" sauf si en fin de partie entre " " */
+ chaine++;
+ if(*chaine == 0) break;
+ }
+ while(*chaine != '"' || ( *(chaine-1) == '\\' && *(chaine+1) != '&' && *(chaine+1) != 0) );
+ if(*chaine == 0) break;
+ chaine++;
+ }
+ if(*chaine == '&') {
+ ajout_reponse(rep, ori, chaine-ori);
+ ori=chaine+1;
+ }
+ chaine++;
+ }
+ajout_reponse(rep, ori, chaine-ori);
+}
+
+
+
+/** pour rechercher la valeur d'un argument dans la structure **/
+char *val(Reponse *Mono, char *argument)
+{
+int count, num, l, larg;
+char *retval = NULL, *debut, *p;
+
+count = Mono->nbarguments;
+larg = strlen(argument);
+for(num=0; num < count; num++) {
+ debut = Mono->arg[num];
+ p = strchr(debut, '=');
+ if(p == NULL || larg != p - debut) continue;
+ p++;
+ if(strncmp(argument, debut, larg) != 0) continue;
+ l = strlen(p);
+ retval = (char *)malloc(l+1);
+ strcpy(retval, p);
+ unprotect_quotes(retval);
+ break;
+ }
+return retval;
+}
+
+
+char *unprotect_quotes(char *name)
+/* enlever les " " encadrantes et decoder les \" internes en " */
+{
+char *p;
+int l;
+
+l = strlen(name);
+if(*name == '"') {
+ memmove(name, name+1, l--); /* enlever la " initiale */
+ if( *(name+l-1) == '"') *(name + --l) = 0; /* enlever la " terminale */
+ }
+
+while ((p = strstr(name, "\\\"" /* la chaine \" */ )) != NULL) { memmove(p, p+1, name + l - p); l--; }
+return name;
+}
+
diff --git a/src/Bpp/Raa/parser.h b/src/Bpp/Raa/parser.h
new file mode 100644
index 0000000..ad738ef
--- /dev/null
+++ b/src/Bpp/Raa/parser.h
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct ThisReponse{
+
+ char **arg; /* je stocke les arguments */
+ int nbarguments; /* je stocke le nombre d'arguments */
+
+} Reponse ;
+
+extern Reponse * initreponse(void) ;
+extern void clear_reponse(Reponse * rep) ;
+void ajout_reponse(Reponse *rep, char *pile, int len) ;
+extern void parse(char *chaine, Reponse *rep) ;
+extern char *val(Reponse *Mono, char *argument) ;
diff --git a/src/Bpp/Raa/zsockr.c b/src/Bpp/Raa/zsockr.c
new file mode 100644
index 0000000..1778818
--- /dev/null
+++ b/src/Bpp/Raa/zsockr.c
@@ -0,0 +1,145 @@
+/* functions to handle zlib-compressed data read from socket
+*/
+#include <zlib.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef WIN32
+#include <winsock.h>
+#endif
+
+
+/* included functions */
+void *prepare_sock_gz_r(FILE *sockr);
+int z_getc(void *v);
+char *z_gets(void *v, char *line, size_t len);
+char *z_read_sock(void *v);
+int close_sock_gz_r(void *v);
+
+
+
+#define ZBSIZE 100000
+typedef struct {
+ z_stream stream;
+ char z_buffer[ZBSIZE]; /* compressed input buffer */
+ char text_buffer[4 * ZBSIZE]; /* decompressed buffer */
+ char *pos, *endbuf;
+#ifdef WIN32
+ SOCKET fd;
+#else
+ int fd;
+#endif
+ } sock_gz_r;
+
+
+
+void *prepare_sock_gz_r(FILE *sockr)
+{
+int err;
+sock_gz_r *big;
+
+big = (sock_gz_r *)malloc(sizeof(sock_gz_r));
+if(big == NULL) return NULL;
+big->stream.next_in = Z_NULL;
+big->stream.avail_in = 0;
+big->stream.avail_out = 0;
+big->stream.zalloc = Z_NULL;
+big->stream.zfree = Z_NULL;
+big->stream.opaque = NULL;
+big->pos = big->text_buffer;
+big->endbuf = big->pos;
+#ifdef WIN32
+big->fd = (SOCKET)sockr;
+#else
+big->fd = fileno(sockr);
+#endif
+err = inflateInit(&big->stream);
+return err == Z_OK ? (void *)big : NULL;
+}
+
+
+int z_getc(void *v)
+{
+int q;
+sock_gz_r *big = (sock_gz_r *)v;
+z_streamp zs;
+
+if(big->pos < big->endbuf) {
+ return *(big->pos++);
+ }
+zs = &(big->stream);
+zs->next_out = (Bytef *)big->text_buffer;
+zs->avail_out = sizeof(big->text_buffer);
+big->pos = (char *)zs->next_out;
+do {
+ if(zs->avail_in == 0) {
+ int lu;
+#ifdef WIN32
+ lu = recv( big->fd , big->z_buffer, ZBSIZE, 0 );
+#else
+ lu = read( big->fd , big->z_buffer, ZBSIZE );
+#endif
+ if(lu == -1) return EOF;
+ zs->next_in = (Bytef *)big->z_buffer;
+ zs->avail_in = lu;
+ }
+ q = inflate(zs, Z_NO_FLUSH);
+ if(q == Z_STREAM_END) break;
+ if(q != Z_OK) {
+ break;
+ }
+ }
+while ( (char *)zs->next_out == big->pos);
+big->endbuf = (char *)zs->next_out;
+if(big->pos < big->endbuf) return *(big->pos++);
+else
+ return EOF;
+}
+
+
+char *z_gets(void *v, char *line, size_t len)
+{
+int c;
+char *p;
+
+p = line;
+while(len > 1) {
+ c = z_getc( v );
+ if(c == EOF) {
+ if(p == line) return NULL;
+ break;
+ }
+ *(p++) = c;
+ if(c == '\n') break;
+ len--;
+ }
+*p = 0;
+return line;
+}
+
+
+char *z_read_sock(void *v)
+{
+static char line[500];
+char *p;
+int l;
+
+p = z_gets(v, line, sizeof(line));
+if(p == NULL) return NULL;
+l = strlen(line);
+if(l > 0 && line[l-1] == '\n') line[l-1] = 0;
+return line;
+}
+
+
+int close_sock_gz_r(void *v)
+{
+sock_gz_r *big = (sock_gz_r *)v;
+int val;
+
+val = inflateEnd(&(big->stream));
+free(big);
+return val;
+}
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..29d8c29
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,54 @@
+# CMake script for Bio++ Remote Acnuc Access
+# Author: Sylvain Gaillard and Julien Dutheil
+# Created: 11/09/2009
+
+# File list
+set(C_FILES
+ Bpp/Raa/md5.c
+ Bpp/Raa/parser.c
+ Bpp/Raa/zsockr.c
+ Bpp/Raa/misc_acnuc.c
+ Bpp/Raa/RAA_acnuc.c
+)
+
+set(CPP_FILES
+ Bpp/Raa/RAA.cpp
+ Bpp/Raa/RaaList.cpp
+ Bpp/Raa/RaaSpeciesTree.cpp
+)
+
+set(H_FILES
+ Bpp/Raa/parser.h
+ Bpp/Raa/RAA.h
+ Bpp/Raa/RaaSeqAttributes.h
+ Bpp/Raa/RAA_acnuc.h
+ Bpp/Raa/RaaList.h
+ Bpp/Raa/RaaSpeciesTree.h
+)
+
+# Build the static lib
+add_library(bppraa-static STATIC ${CPP_FILES} ${C_FILES})
+set_target_properties(bppraa-static
+ PROPERTIES OUTPUT_NAME bpp-raa
+ CLEAN_DIRECT_OUTPUT 1
+ )
+target_link_libraries(bppraa-static ${LIBS})
+
+# Build the shared lib
+add_library(bppraa-shared SHARED ${CPP_FILES} ${C_FILES})
+set_target_properties(bppraa-shared
+ PROPERTIES OUTPUT_NAME bpp-raa
+ CLEAN_DIRECT_OUTPUT 1
+ VERSION ${BPPRAA_VERSION}
+ SOVERSION ${BPPRAA_VERSION_MAJOR}
+ )
+target_link_libraries(bppraa-shared ${LIBS})
+
+# Install libs
+install(TARGETS bppraa-static bppraa-shared DESTINATION lib${LIB_SUFFIX})
+
+# Install headers
+install(DIRECTORY Bpp/ DESTINATION include/Bpp FILES_MATCHING PATTERN "*.h")
+
+# Generate generic include files (.all)
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_SOURCE_DIR}/genIncludes.sh ${CMAKE_PREFIX_PATH}/include/Bpp)")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libbpp-raa.git
More information about the debian-med-commit
mailing list