[med-svn] [axe-demultiplexer] 01/04: Imported Upstream version 0.3.1

Kevin Murray daube-guest at moszumanska.debian.org
Mon Dec 21 03:40:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

daube-guest pushed a commit to branch master
in repository axe-demultiplexer.

commit fd2724dafd18c937133e80375fb381abd707c044
Author: Kevin Murray <spam at kdmurray.id.au>
Date:   Mon Dec 21 14:31:21 2015 +1100

    Imported Upstream version 0.3.1
---
 docs/CMakeLists.txt       |   2 +-
 docs/gitversion.py        |   4 +-
 src/axe.c                 |  14 ++--
 src/gsl/combination.c     | 171 ++++++++++++++++++++++++++++++++++++++++++++++
 src/gsl/error.c           |  77 +++++++++++++++++++++
 src/gsl/gsl_combination.h |  76 +++++++++++++++++++++
 src/gsl/gsl_errno.h       | 153 +++++++++++++++++++++++++++++++++++++++++
 src/gsl/gsl_message.h     |  79 +++++++++++++++++++++
 src/gsl/init.c            | 127 ++++++++++++++++++++++++++++++++++
 src/gsl/message.c         |  37 ++++++++++
 src/gsl/stream.c          |  65 ++++++++++++++++++
 src/gsl/strerror.c        | 100 +++++++++++++++++++++++++++
 src/main.c                |   2 +-
 13 files changed, 896 insertions(+), 11 deletions(-)

diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 68ec92a..0a723ce 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -18,7 +18,7 @@ IF(SPHINXBUILD)
         WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
         )
     ADD_CUSTOM_TARGET(doc ALL DEPENDS doc_man doc_onehtml)
-    INSTALL(FILES ${CMAKE_BINARY_DIR}/doc/man/axe.1 DESTINATION "share/man/man1")
+    INSTALL(FILES ${CMAKE_BINARY_DIR}/doc/man/axe.1 DESTINATION "share/man/man1" RENAME "axe-demux.1")
     SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES doc/)
 ELSE()
     MESSAGE(WARNING "Cannot build documenation, sphinx isn't installed")
diff --git a/docs/gitversion.py b/docs/gitversion.py
index 727a640..72f145e 100644
--- a/docs/gitversion.py
+++ b/docs/gitversion.py
@@ -8,8 +8,8 @@
 # versioneer-0.13 (https://github.com/warner/python-versioneer)
 
 # these strings will be replaced by git during git-archive
-git_refnames = " (HEAD -> master, tag: 0.3.0)"
-git_full = "577fdab42d670dfb8682980b0887fc947e3884e1"
+git_refnames = " (HEAD -> master, tag: 0.3.1)"
+git_full = "5779b83807f368192275a7d5ae37facfd5f85737"
 
 # these strings are filled in when 'setup.py versioneer' creates _version.py
 tag_prefix = ""
diff --git a/src/axe.c b/src/axe.c
index ffcd13b..9d56fec 100644
--- a/src/axe.c
+++ b/src/axe.c
@@ -451,7 +451,7 @@ setup_barcode_lookup_combo(struct axe_config *config)
         this_barcode = config->barcodes[iii];
         if (!axe_barcode_ok(this_barcode)) {
             qes_log_format_fatal(config->logger,
-                                 "setup_lookup -- Bad barcode at %" PRIu64 "\n",
+                                 "setup_lookup -- Bad barcode at %zu\n",
                                  iii);
             goto error;
         }
@@ -591,7 +591,7 @@ load_tries_combo(struct axe_config *config)
         this_bcd = config->barcodes[iii];
         if (!axe_barcode_ok(this_bcd)) {
             qes_log_format_fatal(config->logger,
-                    "load_tries -- Bad R1 barcode at %" PRIu64 "\n", iii);
+                    "load_tries -- Bad R1 barcode at %zu\n", iii);
             ret = -1;
             goto exit;
         }
@@ -602,7 +602,7 @@ load_tries_combo(struct axe_config *config)
             ret = axe_trie_add(config->fwd_trie, this_bcd->seq1, ++bcd1);
             if (ret != 0) {
                 qes_log_format_fatal(config->logger,
-                        "load_tries -- Could not load barcode %s into trie %" PRIu64 "\n",
+                        "load_tries -- Could not load barcode %s into trie %zu\n",
                         this_bcd->seq1, iii);
                 ret = 1;
                 goto exit;
@@ -650,7 +650,7 @@ load_tries_combo(struct axe_config *config)
             ret = axe_trie_add(config->rev_trie, this_bcd->seq2, ++bcd2);
             if (ret != 0) {
                 qes_log_format_fatal(config->logger,
-                        "load_tries -- Could not load barcode %s into trie %" PRIu64 "\n",
+                        "load_tries -- Could not load barcode %s into trie %zu\n",
                         this_bcd->seq2, iii);
                 retval = 1;
                 goto exit;
@@ -725,7 +725,7 @@ load_tries_single(struct axe_config *config)
     for (iii = 0; iii < config->n_barcode_pairs; iii++) {
         this_bcd = config->barcodes[iii];
         if (!axe_barcode_ok(this_bcd)) {
-            fprintf(stderr, "[load_tries] Bad barcode at %" PRIu64 "\n", iii);
+            fprintf(stderr, "[load_tries] Bad barcode at %zu\n", iii);
             return -1;
         }
         /* Either lookup the index of the first read in the barcode table, or
@@ -735,7 +735,7 @@ load_tries_single(struct axe_config *config)
             ret = axe_trie_add(config->fwd_trie, this_bcd->seq1, (int)iii);
             if (ret != 0) {
                 fprintf(stderr,
-                        "ERROR: Could not load barcode %s into trie %" PRIu64 "\n",
+                        "ERROR: Could not load barcode %s into trie %zu\n",
                         this_bcd->seq1, iii);
                 return 1;
             }
@@ -1371,7 +1371,7 @@ hamming_mutate_dna(size_t *n_results_o, const char *str, size_t len,
     size_t results = 0;
     size_t results_alloced = 64;
     size_t iii;
-    uint64_t *alphabet_indicies;
+    uintptr_t *alphabet_indicies;
     int alpha_ret = 0;
     gsl_combination *mut_idx_comb;
 
diff --git a/src/gsl/combination.c b/src/gsl/combination.c
new file mode 100644
index 0000000..6401c04
--- /dev/null
+++ b/src/gsl/combination.c
@@ -0,0 +1,171 @@
+/* combination/combination.c
+ * based on permutation/permutation.c by Brian Gough
+ *
+ * Copyright (C) 2001 Szymon Jaroszewicz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "gsl_errno.h"
+#include "gsl_combination.h"
+
+size_t
+gsl_combination_n (const gsl_combination * c)
+{
+  return c->n ;
+}
+
+size_t
+gsl_combination_k (const gsl_combination * c)
+{
+  return c->k ;
+}
+
+size_t *
+gsl_combination_data (const gsl_combination * c)
+{
+  return c->data ;
+}
+
+int
+gsl_combination_valid (gsl_combination * c)
+{
+  const size_t n = c->n ;
+  const size_t k = c->k ;
+
+  size_t i, j ;
+
+  if( k > n )
+    {
+      GSL_ERROR("combination has k greater than n", GSL_FAILURE) ;
+    }
+  for (i = 0; i < k; i++)
+    {
+      const size_t ci = c->data[i];
+
+      if (ci >= n)
+        {
+          GSL_ERROR("combination index outside range", GSL_FAILURE) ;
+        }
+
+      for (j = 0; j < i; j++)
+        {
+          if (c->data[j] == ci)
+            {
+              GSL_ERROR("duplicate combination index", GSL_FAILURE) ;
+            }
+          if (c->data[j] > ci)
+            {
+              GSL_ERROR("combination indices not in increasing order",
+                        GSL_FAILURE) ;
+            }
+        }
+    }
+
+  return GSL_SUCCESS;
+}
+
+
+int
+gsl_combination_next (gsl_combination * c)
+{
+  /* Replaces c with the next combination (in the standard lexicographical
+   * ordering).  Returns GSL_FAILURE if there is no next combination.
+   */
+  const size_t n = c->n;
+  const size_t k = c->k;
+  size_t *data = c->data;
+  size_t i;
+
+  if(k == 0)
+    {
+      return GSL_FAILURE;
+    }
+  i = k - 1;
+
+  while(i > 0 && data[i] == n - k + i)
+    {
+      i--;
+    }
+  if(i == 0 && data[i] == n - k)
+    {
+      return GSL_FAILURE;
+    }
+  data[i]++;
+  for(; i < k - 1; i++)
+    {
+      data[i + 1] = data[i] + 1;
+    }
+  return GSL_SUCCESS;
+}
+
+int
+gsl_combination_prev (gsl_combination * c)
+{
+  /* Replaces c with the previous combination (in the standard
+   * lexicographical ordering).  Returns GSL_FAILURE if there is no
+   * previous combination.
+   */
+  const size_t n = c->n;
+  const size_t k = c->k;
+  size_t *data = c->data;
+  size_t i;
+
+  if(k == 0)
+    {
+      return GSL_FAILURE;
+    }
+  i = k - 1;
+
+  while(i > 0 && data[i] == data[i-1] + 1)
+    {
+      i--;
+    }
+  if(i == 0 && data[i] == 0)
+    {
+      return GSL_FAILURE;
+    }
+  data[i++]--;
+  for(; i < k; i++)
+    {
+      data[i] = n - k + i;
+    }
+  return GSL_SUCCESS;
+}
+
+int
+gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src)
+{
+   const size_t src_n = src->n;
+   const size_t src_k = src->k;
+   const size_t dest_n = dest->n;
+   const size_t dest_k = dest->k;
+
+   if (src_n != dest_n || src_k != dest_k)
+     {
+       GSL_ERROR ("combination lengths are not equal", GSL_EBADLEN);
+     }
+
+   {
+     size_t j;
+
+     for (j = 0; j < src_k; j++)
+       {
+         dest->data[j] = src->data[j];
+       }
+   }
+
+   return GSL_SUCCESS;
+}
diff --git a/src/gsl/error.c b/src/gsl/error.c
new file mode 100644
index 0000000..ef4a45e
--- /dev/null
+++ b/src/gsl/error.c
@@ -0,0 +1,77 @@
+/* err/error.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gsl_errno.h"
+#include "gsl_message.h"
+
+gsl_error_handler_t * gsl_error_handler = NULL;
+
+static void no_error_handler (const char *reason, const char *file, int line, int gsl_errno);
+
+void
+gsl_error (const char * reason, const char * file, int line, int gsl_errno)
+{
+  if (gsl_error_handler)
+    {
+      (*gsl_error_handler) (reason, file, line, gsl_errno);
+      return ;
+    }
+
+  gsl_stream_printf ("ERROR", file, line, reason);
+
+  fflush (stdout);
+  fprintf (stderr, "Default GSL error handler invoked.\n");
+  fflush (stderr);
+
+  abort ();
+}
+
+gsl_error_handler_t *
+gsl_set_error_handler (gsl_error_handler_t * new_handler)
+{
+  gsl_error_handler_t * previous_handler = gsl_error_handler;
+  gsl_error_handler = new_handler;
+  return previous_handler;
+}
+
+
+gsl_error_handler_t *
+gsl_set_error_handler_off (void)
+{
+  gsl_error_handler_t * previous_handler = gsl_error_handler;
+  gsl_error_handler = no_error_handler;
+  return previous_handler;
+}
+
+static void
+no_error_handler (const char *reason, const char *file, int line, int gsl_errno)
+{
+  /* do nothing */
+  (void) reason;
+  (void) file;
+  (void) line;
+  (void) gsl_errno;
+  return;
+}
+
+
diff --git a/src/gsl/gsl_combination.h b/src/gsl/gsl_combination.h
new file mode 100644
index 0000000..ee13dfb
--- /dev/null
+++ b/src/gsl/gsl_combination.h
@@ -0,0 +1,76 @@
+/* combination/gsl_combination.h
+ * based on permutation/gsl_permutation.h by Brian Gough
+ *
+ * Copyright (C) 2001 Szymon Jaroszewicz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSL_COMBINATION_H__
+#define __GSL_COMBINATION_H__
+
+#include <stdlib.h>
+#include "gsl_errno.h"
+
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+__BEGIN_DECLS
+
+struct gsl_combination_struct
+{
+  size_t n;
+  size_t k;
+  size_t *data;
+};
+
+typedef struct gsl_combination_struct gsl_combination;
+
+gsl_combination *gsl_combination_alloc (const size_t n, const size_t k);
+gsl_combination *gsl_combination_calloc (const size_t n, const size_t k);
+void gsl_combination_init_first (gsl_combination * c);
+void gsl_combination_init_last (gsl_combination * c);
+void gsl_combination_free (gsl_combination * c);
+int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src);
+
+int gsl_combination_fread (FILE * stream, gsl_combination * c);
+int gsl_combination_fwrite (FILE * stream, const gsl_combination * c);
+int gsl_combination_fscanf (FILE * stream, gsl_combination * c);
+int gsl_combination_fprintf (FILE * stream, const gsl_combination * c, const char *format);
+
+size_t gsl_combination_n (const gsl_combination * c);
+size_t gsl_combination_k (const gsl_combination * c);
+size_t * gsl_combination_data (const gsl_combination * c);
+
+int gsl_combination_valid (gsl_combination * c);
+int gsl_combination_next (gsl_combination * c);
+int gsl_combination_prev (gsl_combination * c);
+
+static inline size_t
+gsl_combination_get (const gsl_combination * c, const size_t i)
+{
+  return c->data[i];
+}
+
+__END_DECLS
+
+#endif /* __GSL_COMBINATION_H__ */
diff --git a/src/gsl/gsl_errno.h b/src/gsl/gsl_errno.h
new file mode 100644
index 0000000..76a998c
--- /dev/null
+++ b/src/gsl/gsl_errno.h
@@ -0,0 +1,153 @@
+/* err/gsl_errno.h
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSL_ERRNO_H__
+#define __GSL_ERRNO_H__
+
+#include <stdio.h>
+#include <errno.h>
+
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+__BEGIN_DECLS
+
+enum {
+  GSL_SUCCESS  = 0,
+  GSL_FAILURE  = -1,
+  GSL_CONTINUE = -2,  /* iteration has not converged */
+  GSL_EDOM     = 1,   /* input domain error, e.g sqrt(-1) */
+  GSL_ERANGE   = 2,   /* output range error, e.g. exp(1e100) */
+  GSL_EFAULT   = 3,   /* invalid pointer */
+  GSL_EINVAL   = 4,   /* invalid argument supplied by user */
+  GSL_EFAILED  = 5,   /* generic failure */
+  GSL_EFACTOR  = 6,   /* factorization failed */
+  GSL_ESANITY  = 7,   /* sanity check failed - shouldn't happen */
+  GSL_ENOMEM   = 8,   /* malloc failed */
+  GSL_EBADFUNC = 9,   /* problem with user-supplied function */
+  GSL_ERUNAWAY = 10,  /* iterative process is out of control */
+  GSL_EMAXITER = 11,  /* exceeded max number of iterations */
+  GSL_EZERODIV = 12,  /* tried to divide by zero */
+  GSL_EBADTOL  = 13,  /* user specified an invalid tolerance */
+  GSL_ETOL     = 14,  /* failed to reach the specified tolerance */
+  GSL_EUNDRFLW = 15,  /* underflow */
+  GSL_EOVRFLW  = 16,  /* overflow  */
+  GSL_ELOSS    = 17,  /* loss of accuracy */
+  GSL_EROUND   = 18,  /* failed because of roundoff error */
+  GSL_EBADLEN  = 19,  /* matrix, vector lengths are not conformant */
+  GSL_ENOTSQR  = 20,  /* matrix not square */
+  GSL_ESING    = 21,  /* apparent singularity detected */
+  GSL_EDIVERGE = 22,  /* integral or series is divergent */
+  GSL_EUNSUP   = 23,  /* requested feature is not supported by the hardware */
+  GSL_EUNIMPL  = 24,  /* requested feature not (yet) implemented */
+  GSL_ECACHE   = 25,  /* cache limit exceeded */
+  GSL_ETABLE   = 26,  /* table limit exceeded */
+  GSL_ENOPROG  = 27,  /* iteration is not making progress towards solution */
+  GSL_ENOPROGJ = 28,  /* jacobian evaluations are not improving the solution */
+  GSL_ETOLF    = 29,  /* cannot reach the specified tolerance in F */
+  GSL_ETOLX    = 30,  /* cannot reach the specified tolerance in X */
+  GSL_ETOLG    = 31,  /* cannot reach the specified tolerance in gradient */
+  GSL_EOF      = 32   /* end of file */
+} ;
+
+void gsl_error (const char * reason, const char * file, int line,
+                int gsl_errno);
+
+void gsl_stream_printf (const char *label, const char *file,
+                        int line, const char *reason);
+
+const char * gsl_strerror (const int gsl_errno);
+
+typedef void gsl_error_handler_t (const char * reason, const char * file,
+                                  int line, int gsl_errno);
+
+typedef void gsl_stream_handler_t (const char * label, const char * file,
+                                   int line, const char * reason);
+
+gsl_error_handler_t *
+gsl_set_error_handler (gsl_error_handler_t * new_handler);
+
+gsl_error_handler_t *
+gsl_set_error_handler_off (void);
+
+gsl_stream_handler_t *
+gsl_set_stream_handler (gsl_stream_handler_t * new_handler);
+
+FILE * gsl_set_stream (FILE * new_stream);
+
+/* GSL_ERROR: call the error handler, and return the error code */
+
+#define GSL_ERROR(reason, gsl_errno) \
+       do { \
+       gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
+       return gsl_errno ; \
+       } while (0)
+
+/* GSL_ERROR_VAL: call the error handler, and return the given value */
+
+#define GSL_ERROR_VAL(reason, gsl_errno, value) \
+       do { \
+       gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
+       return value ; \
+       } while (0)
+
+/* GSL_ERROR_VOID: call the error handler, and then return
+   (for void functions which still need to generate an error) */
+
+#define GSL_ERROR_VOID(reason, gsl_errno) \
+       do { \
+       gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
+       return ; \
+       } while (0)
+
+/* GSL_ERROR_NULL suitable for out-of-memory conditions */
+
+#define GSL_ERROR_NULL(reason, gsl_errno) GSL_ERROR_VAL(reason, gsl_errno, 0)
+
+/* Sometimes you have several status results returned from
+ * function calls and you want to combine them in some sensible
+ * way. You cannot produce a "total" status condition, but you can
+ * pick one from a set of conditions based on an implied hierarchy.
+ *
+ * In other words:
+ *    you have: status_a, status_b, ...
+ *    you want: status = (status_a if it is bad, or status_b if it is bad,...)
+ *
+ * In this example you consider status_a to be more important and
+ * it is checked first, followed by the others in the order specified.
+ *
+ * Here are some dumb macros to do this.
+ */
+#define GSL_ERROR_SELECT_2(a,b)       ((a) != GSL_SUCCESS ? (a) : ((b) != GSL_SUCCESS ? (b) : GSL_SUCCESS))
+#define GSL_ERROR_SELECT_3(a,b,c)     ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_2(b,c))
+#define GSL_ERROR_SELECT_4(a,b,c,d)   ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_3(b,c,d))
+#define GSL_ERROR_SELECT_5(a,b,c,d,e) ((a) != GSL_SUCCESS ? (a) : GSL_ERROR_SELECT_4(b,c,d,e))
+
+#define GSL_STATUS_UPDATE(sp, s) do { if ((s) != GSL_SUCCESS) *(sp) = (s);} while(0)
+
+__END_DECLS
+
+#endif /* __GSL_ERRNO_H__ */
diff --git a/src/gsl/gsl_message.h b/src/gsl/gsl_message.h
new file mode 100644
index 0000000..2061ddb
--- /dev/null
+++ b/src/gsl/gsl_message.h
@@ -0,0 +1,79 @@
+/* err/gsl_message.h
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __GSL_MESSAGE_H__
+#define __GSL_MESSAGE_H__
+
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+__BEGIN_DECLS
+
+/* Provide a general messaging service for client use.  Messages can
+ * be selectively turned off at compile time by defining an
+ * appropriate message mask. Client code which uses the GSL_MESSAGE()
+ * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK.
+ *
+ * The messaging service can be completely turned off
+ * by defining GSL_MESSAGING_OFF.  */
+
+void gsl_message(const char * message, const char * file, int line,
+                 unsigned int mask);
+
+#ifndef GSL_MESSAGE_MASK
+#define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */
+#endif
+
+unsigned int gsl_message_mask ;
+
+/* Provide some symolic masks for client ease of use. */
+
+enum {
+  GSL_MESSAGE_MASK_A = 1,
+  GSL_MESSAGE_MASK_B = 2,
+  GSL_MESSAGE_MASK_C = 4,
+  GSL_MESSAGE_MASK_D = 8,
+  GSL_MESSAGE_MASK_E = 16,
+  GSL_MESSAGE_MASK_F = 32,
+  GSL_MESSAGE_MASK_G = 64,
+  GSL_MESSAGE_MASK_H = 128
+} ;
+
+#ifdef GSL_MESSAGING_OFF        /* throw away messages */
+#define GSL_MESSAGE(message, mask) do { } while(0)
+#else                           /* output all messages */
+#define GSL_MESSAGE(message, mask) \
+       do { \
+       if (mask & GSL_MESSAGE_MASK) \
+         gsl_message (message, __FILE__, __LINE__, mask) ; \
+       } while (0)
+#endif
+
+__END_DECLS
+
+#endif /* __GSL_MESSAGE_H__ */
+
+
diff --git a/src/gsl/init.c b/src/gsl/init.c
new file mode 100644
index 0000000..3a50c78
--- /dev/null
+++ b/src/gsl/init.c
@@ -0,0 +1,127 @@
+/* combination/init.c
+ * based on permutation/init.c by Brian Gough
+ *
+ * Copyright (C) 2001 Szymon Jaroszewicz
+ * Copyright (C) 2009 Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include "gsl_errno.h"
+#include "gsl_combination.h"
+
+gsl_combination *
+gsl_combination_alloc (const size_t n, const size_t k)
+{
+  gsl_combination * c;
+
+  if (n == 0)
+    {
+      GSL_ERROR_VAL ("combination parameter n must be positive integer",
+                        GSL_EDOM, 0);
+    }
+  if (k > n)
+    {
+      GSL_ERROR_VAL ("combination length k must be an integer less than or equal to n",
+                        GSL_EDOM, 0);
+    }
+  c = (gsl_combination *) malloc (sizeof (gsl_combination));
+
+  if (c == 0)
+    {
+      GSL_ERROR_VAL ("failed to allocate space for combination struct",
+                        GSL_ENOMEM, 0);
+    }
+
+  if (k > 0)
+    {
+      c->data = (size_t *) malloc (k * sizeof (size_t));
+
+      if (c->data == 0)
+        {
+          free (c);             /* exception in constructor, avoid memory leak */
+
+          GSL_ERROR_VAL ("failed to allocate space for combination data",
+                         GSL_ENOMEM, 0);
+        }
+    }
+  else
+    {
+      c->data = 0;
+    }
+
+  c->n = n;
+  c->k = k;
+
+  return c;
+}
+
+gsl_combination *
+gsl_combination_calloc (const size_t n, const size_t k)
+{
+  size_t i;
+
+  gsl_combination * c =  gsl_combination_alloc (n, k);
+
+  if (c == 0)
+    return 0;
+
+  /* initialize combination to identity */
+
+  for (i = 0; i < k; i++)
+    {
+      c->data[i] = i;
+    }
+
+  return c;
+}
+
+void
+gsl_combination_init_first (gsl_combination * c)
+{
+  const size_t k = c->k ;
+  size_t i;
+
+  /* initialize combination to identity */
+
+  for (i = 0; i < k; i++)
+    {
+      c->data[i] = i;
+    }
+}
+
+void
+gsl_combination_init_last (gsl_combination * c)
+{
+  const size_t k = c->k ;
+  size_t i;
+  size_t n = c->n;
+
+  /* initialize combination to identity */
+
+  for (i = 0; i < k; i++)
+    {
+      c->data[i] = n - k + i;
+    }
+}
+
+void
+gsl_combination_free (gsl_combination * c)
+{
+  if (c == NULL) return;
+  if (c->k > 0) free (c->data);
+  free (c);
+}
diff --git a/src/gsl/message.c b/src/gsl/message.c
new file mode 100644
index 0000000..a8961b0
--- /dev/null
+++ b/src/gsl/message.c
@@ -0,0 +1,37 @@
+/* err/message.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gsl_errno.h"
+#include "gsl_message.h"
+
+unsigned int gsl_message_mask = GSL_MESSAGE_MASK;
+
+void
+gsl_message (const char * reason, const char * file, int line,
+             unsigned int mask)
+{
+  if (mask & gsl_message_mask)
+    {
+      gsl_stream_printf ("MESSAGE", file, line, reason);
+    }
+}
diff --git a/src/gsl/stream.c b/src/gsl/stream.c
new file mode 100644
index 0000000..8cf2ef1
--- /dev/null
+++ b/src/gsl/stream.c
@@ -0,0 +1,65 @@
+/* err/stream.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gsl_errno.h"
+#include "gsl_message.h"
+
+FILE * gsl_stream = NULL ;
+gsl_stream_handler_t * gsl_stream_handler = NULL;
+
+void
+gsl_stream_printf (const char *label, const char *file, int line,
+                   const char *reason)
+{
+  if (gsl_stream == NULL)
+    {
+      gsl_stream = stderr;
+    }
+  if (gsl_stream_handler)
+    {
+      (*gsl_stream_handler) (label, file, line, reason);
+      return;
+    }
+  fprintf (gsl_stream, "gsl: %s:%d: %s: %s\n", file, line, label, reason);
+
+}
+
+gsl_stream_handler_t *
+gsl_set_stream_handler (gsl_stream_handler_t * new_handler)
+{
+  gsl_stream_handler_t * previous_handler = gsl_stream_handler;
+  gsl_stream_handler = new_handler;
+  return previous_handler;
+}
+
+FILE *
+gsl_set_stream (FILE * new_stream)
+{
+  FILE * previous_stream;
+  if (gsl_stream == NULL) {
+    gsl_stream = stderr;
+  }
+  previous_stream = gsl_stream;
+  gsl_stream = new_stream;
+  return previous_stream;
+}
diff --git a/src/gsl/strerror.c b/src/gsl/strerror.c
new file mode 100644
index 0000000..398a132
--- /dev/null
+++ b/src/gsl/strerror.c
@@ -0,0 +1,100 @@
+/* err/strerror.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "gsl_errno.h"
+
+const char *
+gsl_strerror (const int gsl_errno)
+{
+  switch (gsl_errno)
+    {
+    case GSL_SUCCESS:
+      return "success" ;
+    case GSL_FAILURE:
+      return "failure" ;
+    case GSL_CONTINUE:
+      return "the iteration has not converged yet";
+    case GSL_EDOM:
+      return "input domain error" ;
+    case GSL_ERANGE:
+      return "output range error" ;
+    case GSL_EFAULT:
+      return "invalid pointer" ;
+    case GSL_EINVAL:
+      return "invalid argument supplied by user" ;
+    case GSL_EFAILED:
+      return "generic failure" ;
+    case GSL_EFACTOR:
+      return "factorization failed" ;
+    case GSL_ESANITY:
+      return "sanity check failed - shouldn't happen" ;
+    case GSL_ENOMEM:
+      return "malloc failed" ;
+    case GSL_EBADFUNC:
+      return "problem with user-supplied function";
+    case GSL_ERUNAWAY:
+      return "iterative process is out of control";
+    case GSL_EMAXITER:
+      return "exceeded max number of iterations" ;
+    case GSL_EZERODIV:
+      return "tried to divide by zero" ;
+    case GSL_EBADTOL:
+      return "specified tolerance is invalid or theoretically unattainable" ;
+    case GSL_ETOL:
+      return "failed to reach the specified tolerance" ;
+    case GSL_EUNDRFLW:
+      return "underflow" ;
+    case GSL_EOVRFLW:
+      return "overflow" ;
+    case GSL_ELOSS:
+      return "loss of accuracy" ;
+    case GSL_EROUND:
+      return "roundoff error" ;
+    case GSL_EBADLEN:
+      return "matrix/vector sizes are not conformant" ;
+    case GSL_ENOTSQR:
+      return "matrix not square" ;
+    case GSL_ESING:
+      return "singularity or extremely bad function behavior detected" ;
+    case GSL_EDIVERGE:
+      return "integral or series is divergent" ;
+    case GSL_EUNSUP:
+      return "the required feature is not supported by this hardware platform";
+    case GSL_EUNIMPL:
+      return "the requested feature is not (yet) implemented";
+    case GSL_ECACHE:
+      return "cache limit exceeded";
+    case GSL_ETABLE:
+      return "table limit exceeded";
+    case GSL_ENOPROG:
+      return "iteration is not making progress towards solution";
+    case GSL_ENOPROGJ:
+      return "jacobian evaluations are not improving the solution";
+    case GSL_ETOLF:
+      return "cannot reach the specified tolerance in F";
+    case GSL_ETOLX:
+      return "cannot reach the specified tolerance in X";
+    case GSL_ETOLG:
+      return "cannot reach the specified tolerance in gradient";
+    case GSL_EOF:
+      return "end of file";
+    default:
+      return "unknown error code" ;
+    }
+}
diff --git a/src/main.c b/src/main.c
index 08aa30b..8ac237c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -217,7 +217,7 @@ parse_args(struct axe_config *config, int argc, char * const *argv)
         goto error;
     }
     if (config->mismatches > 4) {
-        fprintf(stderr, "ERROR: Silly mismatch level %" PRIu64 "\n",
+        fprintf(stderr, "ERROR: Silly mismatch level %zu\n",
                 config->mismatches);
         goto error;
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/axe-demultiplexer.git



More information about the debian-med-commit mailing list