From 6c194d265bb5406e43466832f8f7f880e31a237f Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Mon, 11 Aug 2014 10:06:32 +0200
Subject: [PATCH] Resolve all unknown symbols

---
 bob/io/base/bobskin.cpp                       |   1 +
 bob/io/base/cpp/CodecRegistry.cpp             |   1 +
 bob/io/base/cpp/HDF5Attribute.cpp             |   1 +
 bob/io/base/cpp/HDF5Dataset.cpp               |   1 +
 bob/io/base/cpp/HDF5File.cpp                  |   1 +
 bob/io/base/cpp/HDF5Group.cpp                 |   1 +
 bob/io/base/cpp/HDF5Types.cpp                 |   1 +
 bob/io/base/cpp/HDF5Utils.cpp                 |   1 +
 bob/io/base/cpp/blitz_array.cpp               |   1 +
 bob/io/base/file.cpp                          |   9 +-
 bob/io/base/include/bob.io.base/HDF5Dataset.h |   1 +
 bob/io/base/include/bob.io.base/api.h         |   4 +-
 bob/io/base/include/bob.io.base/utils.h       | 104 ------------------
 bob/io/base/typeinfo.cpp                      |   2 +-
 bob/io/base/utils.cpp                         |  17 +--
 setup.py                                      |   5 +-
 16 files changed, 29 insertions(+), 122 deletions(-)
 delete mode 100644 bob/io/base/include/bob.io.base/utils.h

diff --git a/bob/io/base/bobskin.cpp b/bob/io/base/bobskin.cpp
index 12117c1..8a23c66 100644
--- a/bob/io/base/bobskin.cpp
+++ b/bob/io/base/bobskin.cpp
@@ -5,6 +5,7 @@
  * @brief Implementation of our bobskin class
  */
 
+#define BOB_IO_BASE_MODULE
 #include "bobskin.h"
 #include <stdexcept>
 
diff --git a/bob/io/base/cpp/CodecRegistry.cpp b/bob/io/base/cpp/CodecRegistry.cpp
index e3ce5fd..483215e 100644
--- a/bob/io/base/cpp/CodecRegistry.cpp
+++ b/bob/io/base/cpp/CodecRegistry.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include "CodecRegistry.h"
diff --git a/bob/io/base/cpp/HDF5Attribute.cpp b/bob/io/base/cpp/HDF5Attribute.cpp
index 05d79bc..2d42802 100644
--- a/bob/io/base/cpp/HDF5Attribute.cpp
+++ b/bob/io/base/cpp/HDF5Attribute.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include <bob.io.base/HDF5Attribute.h>
diff --git a/bob/io/base/cpp/HDF5Dataset.cpp b/bob/io/base/cpp/HDF5Dataset.cpp
index ac0167c..3e4b93d 100644
--- a/bob/io/base/cpp/HDF5Dataset.cpp
+++ b/bob/io/base/cpp/HDF5Dataset.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include <boost/format.hpp>
diff --git a/bob/io/base/cpp/HDF5File.cpp b/bob/io/base/cpp/HDF5File.cpp
index 796e31f..3f838b4 100644
--- a/bob/io/base/cpp/HDF5File.cpp
+++ b/bob/io/base/cpp/HDF5File.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.io.base/HDF5File.h>
 #include <boost/format.hpp>
 
diff --git a/bob/io/base/cpp/HDF5Group.cpp b/bob/io/base/cpp/HDF5Group.cpp
index 43d2c1a..486b7ea 100644
--- a/bob/io/base/cpp/HDF5Group.cpp
+++ b/bob/io/base/cpp/HDF5Group.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include <boost/make_shared.hpp>
diff --git a/bob/io/base/cpp/HDF5Types.cpp b/bob/io/base/cpp/HDF5Types.cpp
index 3f1f07d..e628d52 100644
--- a/bob/io/base/cpp/HDF5Types.cpp
+++ b/bob/io/base/cpp/HDF5Types.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include <sstream>
diff --git a/bob/io/base/cpp/HDF5Utils.cpp b/bob/io/base/cpp/HDF5Utils.cpp
index 3cbff40..f06bd11 100644
--- a/bob/io/base/cpp/HDF5Utils.cpp
+++ b/bob/io/base/cpp/HDF5Utils.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <bob.core/logging.h>
 
 #include <boost/format.hpp>
diff --git a/bob/io/base/cpp/blitz_array.cpp b/bob/io/base/cpp/blitz_array.cpp
index 0fd2837..4ea4a7c 100644
--- a/bob/io/base/cpp/blitz_array.cpp
+++ b/bob/io/base/cpp/blitz_array.cpp
@@ -7,6 +7,7 @@
  * Copyright (C) Idiap Research Institute, Martigny, Switzerland
  */
 
+#define BOB_IO_BASE_MODULE
 #include <stdexcept>
 
 #include <bob.io.base/blitz_array.h>
diff --git a/bob/io/base/file.cpp b/bob/io/base/file.cpp
index 321bcad..3f36c38 100644
--- a/bob/io/base/file.cpp
+++ b/bob/io/base/file.cpp
@@ -8,6 +8,7 @@
 #define BOB_IO_BASE_MODULE
 #include "bobskin.h"
 #include <bob.io.base/api.h>
+#include <bob.io.base/File.h>
 #include <numpy/arrayobject.h>
 #include <bob.blitz/capi.h>
 #include <bob.blitz/cleanup.h>
@@ -118,10 +119,10 @@ static int PyBobIoFile_Init(PyBobIoFileObject* self, PyObject *args, PyObject* k
 
   try {
     if (pretend_extension) {
-      self->f = BobIo_OpenWithExtension(c_filename, mode, pretend_extension);
+      self->f = BobIoFile_OpenWithExtension(c_filename, mode, pretend_extension);
     }
     else {
-      self->f = BobIo_Open(c_filename, mode);
+      self->f = BobIoFile_Open(c_filename, mode);
     }
   }
   catch (std::exception& e) {
@@ -493,7 +494,7 @@ Returns the current position of the newly written array.\n\
 "
 );
 
-PyObject* PyBobIo_TypeInfoAsTuple (const BobIoTypeinfo& ti) {
+PyObject* PyBobIo_TypeinfoAsTuple (const BobIoTypeinfo& ti) {
 
   if (ti.dtype == NPY_NOTYPE) return 0;
 
@@ -529,7 +530,7 @@ static PyObject* PyBobIoFile_Describe(PyBobIoFileObject* self, PyObject *args, P
   else info = &self->f->type();
 
   /* Now return type description and tuples with shape and strides */
-  return PyBobIo_TypeInfoAsTuple(*info);
+  return PyBobIo_TypeinfoAsTuple(*info);
 }
 
 PyDoc_STRVAR(s_describe_str, "describe");
diff --git a/bob/io/base/include/bob.io.base/HDF5Dataset.h b/bob/io/base/include/bob.io.base/HDF5Dataset.h
index 5572410..9059bab 100644
--- a/bob/io/base/include/bob.io.base/HDF5Dataset.h
+++ b/bob/io/base/include/bob.io.base/HDF5Dataset.h
@@ -13,6 +13,7 @@
 #include <vector>
 
 #include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
 #include <blitz/array.h>
 #include <hdf5.h>
 
diff --git a/bob/io/base/include/bob.io.base/api.h b/bob/io/base/include/bob.io.base/api.h
index 9f6551b..59b1dbb 100644
--- a/bob/io/base/include/bob.io.base/api.h
+++ b/bob/io/base/include/bob.io.base/api.h
@@ -148,10 +148,10 @@ typedef struct {
 #define BobIoReorder_ColToRow_PROTO (const void*, void*, const BobIoTypeinfo*)
 
 #define BobIoReorder_RowToColComplex_RET int
-#define BobIoReorder_RowToColComplex_PROTO (const void*, void*, const BobIoTypeinfo*)
+#define BobIoReorder_RowToColComplex_PROTO (const void*, void*, void*, const BobIoTypeinfo*)
 
 #define BobIoReorder_ColToRowComplex_RET int
-#define BobIoReorder_ColToRowComplex_PROTO (const void*, void*, const BobIoTypeinfo*)
+#define BobIoReorder_ColToRowComplex_PROTO (const void*, const void*, void*, const BobIoTypeinfo*)
 
 /**********************************
  * Bindings for bob.io.base.File *
diff --git a/bob/io/base/include/bob.io.base/utils.h b/bob/io/base/include/bob.io.base/utils.h
deleted file mode 100644
index 04931e0..0000000
--- a/bob/io/base/include/bob.io.base/utils.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @author Andre Anjos <andre.anjos@idiap.ch>
- * @date Wed  3 Oct 07:46:49 2012
- *
- * @brief Utilities for easy manipulation of filed data.
- */
-
-#ifndef BOB_IO_BASE_BASE_UTILS_H
-#define BOB_IO_BASE_BASE_UTILS_H
-
-#include <bob.io.base/File.h>
-#include <boost/shared_ptr.hpp>
-
-namespace bob { namespace io { namespace base {
-
-  /**
-   * Creates a new array codec using the filename extension to determine which
-   * codec to use. The opening mode is passed to the underlying registered File
-   * implementation.
-   *
-   * Here are the meanings of the mode flag:
-   *
-   * 'r': opens for reading only - no modifications can occur; it is an
-   *      error to open a file that does not exist for read-only operations.
-   * 'w': opens for reading and writing, but truncates the file if it
-   *      exists; it is not an error to open files that do not exist with
-   *      this flag.
-   * 'a': opens for reading and writing - any type of modification can
-   *      occur. If the file does not exist, this flag is effectively like
-   *      'w'.
-   */
-  boost::shared_ptr<File> open (const char* filename, char mode);
-
-  /**
-   * Opens the file pretending it has a different extension (that is, using a
-   * different codec) then the one expected (if any). This allows you to write
-   * a file with the extension you want, but still using one of the available
-   * codecs.
-   */
-  boost::shared_ptr<File> open (const char* filename, char mode,
-      const char* pretend_extension);
-
-  /**
-   * Peeks the file and returns the type information for reading individual
-   * frames (or samples) from the file.
-   *
-   * This method is equivalent to calling open() with 'r' as mode flag and then
-   * calling type() on the returned bob::io::base::File object.
-   */
-  BobIoTypeinfo peek (const char* filename);
-
-  /**
-   * Peeks the file and returns the type information for reading the whole
-   * contents in a single shot.
-   *
-   * This method is equivalent to calling open() with 'r' as mode flag and then
-   * calling type_all() on the returned bob::io::base::File object.
-   */
-  BobIoTypeinfo peek_all (const char* filename);
-
-  /**
-   * Opens for reading and load all contents
-   *
-   * This method is equivalent to calling open() with 'r' as mode flag and then
-   * calling read_all() on the returned bob::io::base::File object.
-   */
-  template <typename T, int N> blitz::Array<T,N> load (const char* filename) {
-    return open(filename, 'r')->read_all<T,N>();
-  }
-
-  /**
-   * Opens for reading and load a particular frame (or sample)
-   *
-   * This method is equivalent to calling open() with 'r' as mode flag and then
-   * calling read(index) on the returned bob::io::base::File object.
-   */
-  template <typename T, int N> blitz::Array<T,N> load (const char* filename, size_t index) {
-    return open(filename, 'r')->read<T,N>(index);
-  }
-
-  /**
-   * Opens for appending and add an array to it
-   *
-   * This method is equivalent to calling open() with 'a' as mode flag and then
-   * calling append(data) on the returned bob::io::base::File object.
-   */
-  template <typename T, int N> void append (const char* filename, const blitz::Array<T,N>& data) {
-    open(filename, 'a')->append(data);
-  }
-
-  /**
-   * Opens for writing and write an array to it. If the file exists before the
-   * call to this method, it is truncated.
-   *
-   * This method is equivalent to calling open() with 'w' as mode flag and then
-   * calling write(data) on the returned bob::io::base::File object.
-   */
-  template <typename T, int N> void save (const char* filename, const blitz::Array<T,N>& data) {
-    open(filename, 'w')->write(data);
-  }
-
-}}}
-
-#endif /* BOB_IO_BASE_BASE_UTILS_H */
diff --git a/bob/io/base/typeinfo.cpp b/bob/io/base/typeinfo.cpp
index ff275c9..386843f 100644
--- a/bob/io/base/typeinfo.cpp
+++ b/bob/io/base/typeinfo.cpp
@@ -67,7 +67,7 @@ int BobIoTypeinfo_SignedSet (BobIoTypeinfo* self, int dtype, Py_ssize_t nd,
 }
 
 int BobIoTypeinfo_SetWithStrides (BobIoTypeinfo* self, int dtype,
-    Py_ssize_t nd, const Py_ssize_t* shape, const Py_ssize_t* stride) {
+    size_t nd, const size_t* shape, const size_t* stride) {
   self->dtype = dtype;
 
   if (nd > (BOB_BLITZ_MAXDIMS+1)) {
diff --git a/bob/io/base/utils.cpp b/bob/io/base/utils.cpp
index 17a7fde..53ebd5f 100644
--- a/bob/io/base/utils.cpp
+++ b/bob/io/base/utils.cpp
@@ -9,28 +9,29 @@
 
 #define BOB_IO_BASE_MODULE
 #include <bob.io.base/api.h>
+#include <bob.io.base/File.h>
 #include "cpp/CodecRegistry.h"
 
-boost::shared_ptr<bob::io::base::File> BobIoFile_Open (const char* filename,
-    char mode, const char* pretend_extension) {
+boost::shared_ptr<bob::io::base::File> BobIoFile_Open
+  (const char* filename, char mode) {
 
   boost::shared_ptr<bob::io::base::CodecRegistry> instance = bob::io::base::CodecRegistry::instance();
-  return instance->findByExtension(pretend_extension)(filename, mode);
+  return instance->findByFilenameExtension(filename)(filename, mode);
 
 }
 
-boost::shared_ptr<bob::io::base::File> BobIoFile_OpenWithExtension
-  (const char* filename, char mode) {
+boost::shared_ptr<bob::io::base::File> BobIoFile_OpenWithExtension (const char* filename,
+    char mode, const char* pretend_extension) {
 
   boost::shared_ptr<bob::io::base::CodecRegistry> instance = bob::io::base::CodecRegistry::instance();
-  return instance->findByFilenameExtension(filename)(filename, mode);
+  return instance->findByExtension(pretend_extension)(filename, mode);
 
 }
 
 void BobIoFile_Peek (const char* filename, BobIoTypeinfo* info) {
-  BobIoTypeinfo_Copy(info, BobIoFile_Open(filename, 'r')->type());
+  BobIoTypeinfo_Copy(info, &BobIoFile_Open(filename, 'r')->type());
 }
 
 void BobIoFile_PeekAll (const char* filename, BobIoTypeinfo* info) {
-  BobIoTypeinfo_Copy(info, BobIoFile_Open(filename, 'r')->type_all());
+  BobIoTypeinfo_Copy(info, &BobIoFile_Open(filename, 'r')->type_all());
 }
diff --git a/setup.py b/setup.py
index 5d2078a..70f76bf 100644
--- a/setup.py
+++ b/setup.py
@@ -168,11 +168,9 @@ setup(
         ),
       Extension("bob.io.base._library",
         [
-          "bob/io/base/utils.cpp",
           "bob/io/base/cpp/TensorFileHeader.cpp",
           "bob/io/base/cpp/TensorFile.cpp",
           "bob/io/base/cpp/blitz_array.cpp",
-
           "bob/io/base/cpp/CodecRegistry.cpp",
           "bob/io/base/cpp/HDF5Attribute.cpp",
           "bob/io/base/cpp/HDF5Dataset.cpp",
@@ -181,6 +179,8 @@ setup(
           "bob/io/base/cpp/HDF5Types.cpp",
           "bob/io/base/cpp/HDF5Utils.cpp",
 
+          "bob/io/base/file.cpp",
+          "bob/io/base/utils.cpp",
           "bob/io/base/csv.cpp",
           "bob/io/base/hdf5plugin.cpp",
           "bob/io/base/torch3.cpp",
@@ -189,7 +189,6 @@ setup(
           "bob/io/base/typeinfo.cpp",
           "bob/io/base/bobskin.cpp",
           "bob/io/base/codec.cpp",
-          "bob/io/base/file.cpp",
           "bob/io/base/hdf5.cpp",
           "bob/io/base/main.cpp",
           ],
-- 
GitLab